Back in 2012, a colleague Justin Caningon wrote an Archlinux installation guide. I thought it would be a good time to update this guide for 2017.
I’ve been playing around with PCIx passthrough with KVM and OVMF lately and decided it was time to write another guide.
1. Download the distro.
Hop over to here and grab the latest ISO of arch.
Get a USB drive thats at least the size of the ISO. At the time of writing the arch ISO is 500mb.
2. Prepare the USB for booting into arch for installation.
Arch is such a well documented distribution, that we can head over here to get the commands for prepping that flash drive.
I am using OSX to do this, and it goes like this:
a. Put the flash drive in the machine.
b. Open disk utility.
c. Eject the mounted partition of the flash drive.
d. Open the terminal app.
e. Type ‘diskutil list’. To find out which drive you will be working with.
f. Issue ‘ dd bs=4m if=/path/to/archlinux.iso of=/dev/diskx‘
g. Wait a few minutes for this to complete, and then put it in the machine to have arch installed on it.
3. Boot the machine into the Arch Linux installation live OS.
Select the USB you just created to boot from and you’ll get the arch boot menu.
You’ll want to select the ‘Boot Arch Linux (x86_x64).
This will drop you right into a shell.
From here we can begin installing arch.
4. Partition the disks.
We want to find out where to install this. I’ve got 7 SSDs and 1 PCIx M2 drive.
‘fdisk’ will give me a listing of the disks on the system. Since I have so many, I am going to issue ‘fdisk -l | more’.
Your’e going to get a whole lot of output here. Its up to you to find the right disk. Typically this is best found looking at the size of the disk in question.
Once you’ve found it, lets partition the disks.
We’re going to use ‘cfdisk’ to create our installation. I am going to use my 480GB PCIx drive for this installation. Partitions will look thus:
/dev/sda1 15GB installation of archlinux
/dev/sda2 2x RAM swap disk (ive got 128GB of RAM here, so this will be 256GB)
/dev/sda3(5) ext partition holding the user data
so type in ‘cfdisk /dev/sd(x)’. In my system, the PCIx drive is /dev/sdk.
You’ll get this menu
Were going to create the partitions using the lower menu so it looks like this:
The sdk1 and sdk2 partitions are primary partitions.
The sdk3 partition is an extended partition.
Make sure you mark sdk1 as bootable.
Write out and remember to type out ‘yes’ to get the writes in.
Then quit and well get on to making file systems.
5. Make the filesystems on the newly partitioned disks.
We’re going to use ext4 on sdk1 and sdk5.
Then we will make the sdk2 a swap.
We’ll use ‘mkfs.ext4′ on the /dev/sdk1 and sdk5:
Follow this procedure on /dev/sdk5.
Next we’ll make the swap partition.
‘mkswap’ and ‘swapon’ are the key commands here.
6. Mount the new partitions and install arch linux.
Well use the ‘mnt’ command to mount these partitions into the /mnt directory.
This will mount up those partitions to the /mnt directory so that we can install arch into that drive.
Next, well install Arch.
Here well use ‘pacstrap’ to bring all the installation media from the internet.
We will ‘pacstrap ‘base’ and ‘base-devel’ into the system.
This step will take quite a while depending on your internet connection. Sit back and relax while this runs through.
7. Prep the new system
a) Generate the fstab on the new system.
‘genfstab /mnt >> /mnt/etc/fstab’ will be the command of choice here.
b) Session into the new installation with
‘arch-chroot /mnt /bin/bash’
c) Edit the /etc/locale.gen file and add the line ‘en_US.UTF-8 UTF-8′, or if youre out of the US, add/uncomment your locale.
Then generate the locale file with ‘locale-gen’.
d) Edit the /etc/locale.conf and add the line ‘LANG=en_US.UTF-8′. Quit and save that file.
e) Next we’ll set the local timezone. You can list the timezones with ‘ls /usr/share/zoneinfo’.
I am in San Francisco, so I am going to use ‘/usr/share/zoneinfo/America/Los_Angeles’ for PST.
The way we set the local time is through this command. ‘ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime’
Mine was there already so I had to remove the existing /etc/localtime directory.
f) Sync the clock to UTC with this command, ‘ hwclock –systohc –utc’
g) Change your password with ‘passwd’
h) Next we’ll install GRUB with ‘pacman -S grub os-prober‘, ‘grub-install /dev/sdk1‘, and ‘grub-mkconfig -o /boot/grub/grub.cfg‘
Once you have done this, you can ‘exit’ and unmount the mounted drives.
A reboot will bring you into the installation. Don’t forget to remove that USB drive.