2015年11月13日金曜日

New PC and Installing Arch Linux

New PC and Installing Arch Linux

I built my new PC (my first custom built pc) and of course I install arch linux on it.

basic build information

here is basic built information.

component spec
CPU AMD fx6300 3.5GHZ 6cores
RAM 16Gb
HDD 1TB HDD and 64GB SSD
GPU MSI GeForce GTX950
MOBO MSI970A G46

Arch Linux Installation Log

This is a log of my installation. Not a guide to installation. If you try to install arch linux, follow installation guide of arch wiki.
https://wiki.archlinux.org/index.php/Installation_guide
and beginners’ guide
https://wiki.archlinux.org/index.php/Beginners%27_guide

Preinstallation

I prepared iso media on my macbook pro.

1. Download and boot the installation medium

I will write image on flash media and boot from it. usb flash installation media

  1. Download iso (https://www.archlinux.org/download/)
    downloaded archlinux-2015.11.01-dual.iso

  2. follow installation media guide

    $ diskutil list  # check how usb is called
  3. unmount usb

    
    $ diskutil unmountDisk /dev/disk2
  4. copy iso to usb

    $ sudo dd if=archlinux-2015.11.01-dual.iso of=/dev/rdisk2 bs=1m

    without sudo I got Permission denied.
    The output was

    659+0 records in
    659+0 records out
    691011584 bytes transferred in 146.929573 secs (4703012     bytes/sec)
  5. eject usb

    $ diskutil eject
  6. boot from usb
    turned on pc and insert usb (skip bios)

2. Partitioning

Procedure is almost same as arch linux beginners’ guide suggest here.
My mobo supports UEFI so I tried to make partition UEFI/GPT setup using GNU parted.

$ fdisk -l 
# output of fdisk
# /dev/sda is ssd and /dev/sdb is hdd for me
$ parted /dev/sda
(parted) mklabel gpt
(parted) mkpart ESP fat32 1MiB 513MiB
(parted) set 1 boot on
(parted) mkpart primary ext4 513MiB 35GiB
(parted) mkpart primary ext4 35GiB 100% 
(parted) quit
$ parted /dev/sdb
(parted) mklabel gpt
(parted) mkpart primary ext4 1MiB 20GiB
(parted) mkpart primary ext4 20GiB 40GiB
(parted) mkpart primary linux-swap 40GiB 64GiB
(parted) mkpart primary ext4 64GiB 100%
(parted) quit
#partition  #Size   #type   #Mount Point
/dev/sda1   512M    FAT32   /boot
/dev/sda2   35 G    ext4    /
/dev/sda3   30 G    ext4    /usr

/dev/sdb1   20 G    ext4    /var
/dev/sdb2   20 G    ext4    /tmp
/dev/sdb3   24 G    swap    
/dev/sdb4   950G    ext4    /home

This partition scheme is not optimal or recommended. This is just a log of my scheme.
If you are interested in recommended partition scheme see arch wiki’s partitioning page.

3. format drives

$ mkfs.fat -F32 /dev/sda1 # cause this is ESP
$ mkfs.ext4 /dev/sda2 # for others ext4 is fine
$ mkswap /dev/sdb2
$ swapon /dev/sdb2

4. mount drives

First mount SSD

$ mount /dev/sda2 /mnt # /dev/sda2 is /
$ mkdir -p /mnt/boot
$ mount /dev/sda1 /mnt/boot
$ mkdir -p /mnt/usr
$ mount /dev/sda3 /mnt/usr

and mount HDD

$ mkdir -p /mnt/var
$ mount /dev/sdb1 /mnt/var
$ mkdir -p /mnt/tmp
$ mount /dev/sdb2 /mnt/tmp
$ mkdir -p /mnt/home
$ mount /dev/sdb4 /mnt/home

5. install arch linux

Before download and install check internet access

$ ping -c 3 google.com

Fortunately my ethernet was already working.
Now install arch linux.

pacstrap /mnt base base-devel

installation was fine.

6. Configuration

Now generate fstab, chroot to /mnt, set locale, time, keyboard and initramfs.

Since I separate / and /usr, a special care is needed in /etc/mkinitcpio.conf. Should read about mkinitcpio on arch wiki especially this part. I found this problem on Stackoverflow here and here. This took me two days googling and to spot.

Setting is below.

  • edit /etc/mkinitcpio.conf
    change HOOKS="base udev autodetect modconf block filesystems keyboard fsck" to HOOKS="base udev autodetect modconf block filesystems keyboard shutdown usr fsck"
  • mark /usr with a passno 0 in /etc/fstab
  • create new init image
$ arch-chroot /mnt /bin/bash
$ mkinitcpio -p linux
  • update /boot/grub.cfg (no need maybe?)
$ grub-mkconfig -o /boot/grub/grub.cfg
  • exit and unmount disks
$ exit
$ umount -R /mnt

7. Install a boot loader

For boot loader, I didn’t follow exactly the way beginners’ guide show because I felt that the way it shows for UEFI/GPT using bootctl is not so popular compared with GRUB. So I used GRUB as boot loader.

Follow the instruction on the arch wiki’s GRUB/UEFI systems.

  • install grub and bootmgr
$ pacman -S grub bootmgr
  • grub-install
$ grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub --recheck
  • Don’t forget generate the main configuration file
$ grub-mkconfig -o /boot/grub/grub.cfg

8. Configure and reboot

So it’s almost done. Configure host name, network, set password. Once configuration is done, unmount all disks and reboot

Written with StackEdit.

0 件のコメント:

コメントを投稿