We’ve all strugled with installing Linux systems from scratch such as Arch or Gentoo, specially the first time we do so.
Up next is the most basic Arch Linux install you can achieve on a system without things breaking. While using an UEFI partition of course.
In case you’re doing this on a virtual machine, just have the ISO on hand as the virtualizer will need it.
First off, boot the machine with the ISO or the USB drive.
You should take into account that this is going to format the drive on the machine you’re booting. I’ll say it again:
Caution, the following commands will erase the drive you’re using for the install, any data inside of them might be unrecoverable.
After the machine has been booted we’ll be presented with a prompt, from there we can use
gdisk to do the disk formatting. In this case you’re presented with the drive
From gdisk delete any content that might be on the drive:
Create a new partition, in this case the EFI partition which will allow you to boot the machine with UEFI:
Press enter until you’re prompted with the size of the "Last Sector" and input the following:
Then select the type of filesystem that will be on the partition, since this is an EFI partition the code is:
Afterwards we just create the main root partition for the system install:
To write these changes just press:
These steps will create two partitions:
- /dev/sda1 -> EFI Partition
- /dev/sda2 -> Root Partition
After the partition table has been created you can define the filesystems for the installation, for the EFI partition you need a vFAT filesystem, you can define it as follows:
As for the root partition, lets run things a little classic with ext4:
Then mount them for the OS install, the /boot directory is created so the EFI has a place to be mounted on:
mount /dev/sda2 /mnt mkdir /mnt/boot mount /dev/sda1 /mnt/boot
The fun part, you first need to select a mirror, the pacman repos have a lot of mirror worldwide, you can select the one that suits you the most, I won’t go into detail on how to decide since it depends on a lot of factors. Usually the one within your own country or the one closest to you should work best. You can find the repo list and edit it with:
Strap it!, you can install the actual OS with the following command:
pacstrap /mnt base base-devel
This step will take a bit, depending on the type of drive you’re installing to, the speed of the machine and the speed of the USB drive, go and grab a cup of cofee on the meantime.
It’ll be done soon enough, you still need to install the bootloader for the machine to be able to boot into your new and shiny Arch installation.
Installing the bootloader
Installing the bootloader is pretty straightforward, in the case of Arch it’s kind of more hands-on than the other more user-friendly Linux distros such as ubuntu or other Arch derivatives such as Mandriva but it’s not as hard the old days… anyhow:
arch-chroot /mnt bootctl install
And edit the bootloader’s configuration file with:
vi /boot/loader/loader.conf and just leave the following entries (delete everything else):
default arch timeout 4
For the final bootloader configuration we need to get the PARTUUID for the partition, do this with
blkid and set it up on the entry for the Arch boot:
vi /boot/loader/entries/arch.conf title Arch Linux linux /vmlinuz-linux initrd /initramfs-linux.img options root=PARTUUID="YOUR_/dev/sda2_PARTUUID" rw
Again, YOUR_/dev/sda2_PARTUUID = The PARTUUID you got from the command: blkid
For the final step, and as a recommendation to avoid future lack of basic software components, just install some basic dependencies for the machine:
pacman -S linux linux-headers linux-firmware netctl dhcpcd mkinitcpio wpa_supplicant
There you go. You just installed a base Arch system, now go ahead and hack it up so it resembles whatever you want and whatever you want to use it for.