Difference between revisions of "Archlinux Install"

From gr0x0rd
Jump to navigation Jump to search
Line 109: Line 109:
 
  (add your hostname to the appropriate entries)
 
  (add your hostname to the appropriate entries)
  
==== configure network =====
+
==== configure network ====
  
 
dhcpcd is simple and elegant, but networkmanager has some additional features, such as connectivity to AnyConnect and L2TP endpoints, which I require.  
 
dhcpcd is simple and elegant, but networkmanager has some additional features, such as connectivity to AnyConnect and L2TP endpoints, which I require.  

Revision as of 14:31, 29 October 2017

Installing ArchLinux

Install Prep

Review the documentation and download the boot media

Before getting started you'll probably want to review the ArchLinux install guide and download the latest iso image. I copied the image to a USB drive mounted as /dev/sdf:

$ sudo dd if=Downloads/archlinix_install_image.iso of=/dev/sdf

After this, the USB was inserted into the motherboard, the system powered and the USB selected as the boot device via BIOS. After startup of the live image, Arch offers up a root prompt.

Confirm networking

Confirm you have network access by pinging google or something else. Use ifconfig to determine the local IP.

Enable ssh daemon

There is really no need to do an install by typing out command after command, so an ssh session is necessary and sufficient. In order to get this set up, the first step is to set the root password

# passwd

And then start the sshd service

# systemctl start sshd

You can then ssh into the system from another computer on your network, preferably one with internet access so you can copy-and-paste commands from the install guide or this wiki.

Preparing the disks

One of the reasons for moving on from Gentoo was a lack of any definitive process in the community forums or documentation for setting up a RAID based system. When googling this, all of the related documentation seemed to generate hits from the Arch community docs.

This guide focuses on setting up a system using twin SSD drives in a RAID1 configuration. A step-by-step guide for doing this was found here. Other considerations include simplifying the configuration by dropping the /boot and /swap partitions required by Gentoo, expanding the UEFI partition for boot purposes, and using a swap file as opposed to a swap partition.

It should also be noted that this guide focuses on setting up the system using a single drive, then adding the second after the install is complete, in order to have both systems running at the same time and perform a migration.

Create partition schema using gdisk

Identify what device has been assigned to your primary disk (usually this is /dev/sda) and open it using gdisk.

# gdisk /dev/sda

Once in the gdisk interface, you can use p to show the existing partition schema. Since we are creating a new partition schema, it makes sense to delete the current schema using d. Once complete, the partition schema should be empty:

Command (? for help): p
Disk /dev/sda: 468862128 sectors, 223.6 GiB
Model: KINGSTON SH103S3
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): 0356C9E8-4FEB-4F09-A617-54F462861ABD
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 468862094
Partitions will be aligned on 2048-sector boundaries
Total free space is 468862061 sectors (223.6 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name

Command (? for help): 

Create the boot/UEFI partition using n. Use the default sector as its starting point (2048). I created a 1G partition using +1G when prompted. When prompted for the code for the partition, EF00 was entered as per the documentation.

Next, the primary root partition was created. The remainder of the disk was used for the partition as per defaults. The partition type also defaulted to a linux filesystem. The partition layout now appears as follows:

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         2099199   1024.0 MiB  EF00  EFI System
   2         2099200       468862094   222.6 GiB   8300  Linux filesystem

w was used to write this partition table to the disk.

Create the RAIDs

We now create the RAID devices with a single disk only. This is unorthodox but required while our other disk is in use to stage the install. The first drive is creating using older metadata, as noted in the documentation.

# mdadm --create /dev/md0 --metadata 1.0 --raid-devices=2 --level=1 /dev/sda1 missing

Next, we create the root filesystem array.

# mdadm --create /dev/md1 --raid-devices=2 --level=1 /dev/sda2 missing

mdadm gives a warning here about using a recent metadata device as a boot partition. Since this isn't our boot partition, we can ignore this warning and go ahead with creating the array.

Apply filesystems

The UEFI partition needs to be formatted as FAT32.

# mkfs.fat -F32 /dev/md0
mkfs.fat 4.1 (2017-01-24)

The second partition can be whatever is desired; in this case, ext4.

# mkfs.ext4 /dev/md1
mke2fs 1.43.6 (29-Aug-2017)
...
Writing superblocks and filesystem accounting information: done

Mount the partitions

In order to perform the install, the newly created partitions and their filesystems need to be mounted.

# mount /dev/md1 /mnt
# mkdir /mnt/boot
# mount /dev/md0 /mnt/boot

Install the base system

Now that the partitions have been mounted, it's time to install the base system.

# pacstrap -i /mnt base

There will be a number of questions and prompts... simply go with defaults or press y as needed.

Generate the mdadm.conf and fstab

In order to preserve the RAID configuration, we need to import the config from the live installer to the new filesystem.

# mdadm --detail --scan >> /mnt/etc/mdadm.conf
# genfstab -U -p /mnt >> /mnt/etc/fstab

chroot into the new environment

As one would expect, we change root to the newly configured environment.

# arch-chroot /mnt /bin/bash

configure regional settings

# ln -sf /usr/share/zoneinfo/America/Vancouver /etc/localtime
# locale-gen
# nano /etc/hostname
(enter your host name and save the file)
# nano /etc/hosts
(add your hostname to the appropriate entries)

configure network

dhcpcd is simple and elegant, but networkmanager has some additional features, such as connectivity to AnyConnect and L2TP endpoints, which I require.

# pacman -S networkmanager

Configure network manager to start with the system.

# systemctl enable NetworkManager