How to install Arch Linux on UEFI machine

February 15, 2018

Partitioning

I’m gonna create three separate partitions for my system: one for EFI system, second for swap and third for the system itself.

Run cfdisk /dev/sda command and choose gpt.

partition type size
sda1EFI system550M
sda2Linux swap40G
sda3Linux filesystemrest of space

Write down changes by choosing Write and answer yes to confirm, then quit cfdisk.

Formatting

Next we need to format our partitions with the required filesystems and make the swap partition.

mkfs.fat -F32 /dev/sda1
mkswap /dev/sda2
mkfs.ext4 /dev/sda3

Installing Arch Linux

Before we install the system we need our sda3 partition to be mounted. And I’m also initializing the swap partition in this step.

mount /dev/sda3 /mnt
swapon /dev/sda2

It’s a good idea to check mirrorlist just before we start to choose the closest mirror. Run this command to open the mirrorlist file nano /etc/pacman.d/mirrorlist and just copy/paste your country server location on top of the list and save the file.

Next, I assume you have working internet connection and we may start installing the system (takes some time)

pacstrap /mnt base base-devel

Configuring

After the installation completes, we need to generate fstab file

genfstab -U -p /mnt >> /mnt/etc/fstab

Chroot into your system path and generate a hostname

arch-chroot /mnt
echo arch > /etc/hostname

Configure your system language by editing /etc/locale.gen file. Open the file by running nano /etc/locale.gen and uncomment the needed locale the save it. Then generate your system language layout.

locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG=en_US.UTF-8

Configure your time zone by creating a symlink and configure your hardware clock to use UTC as it’s usually set to the local time.

ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime
hwclock --systohc --utc

Setup the password for the root account and create a new user with sudo privileges and create a password for the user as well.

passwd
useradd -mg users -G wheel,storage,power -s /bin/bash YourNewUser
passwd YourNewUser

After that install the sudo package and update the sudoers file to grant administrative privileges to the user. Uncomment this line: %wheel ALL=(ALL) ALL and save the file.

pacman -S sudo
nano /etc/sudoers

Installing the bootloader (GRUB)

Install the bootloader and needed packages, create a mounting point and mount the sda1 partition.

pacman -S grub efibootmgr dosfstools os-prober mtools
mkdir /boot/EFI
mount /dev/sda1 /boot/EFI 
grub-install --target=x86_64-efi  --bootloader-id=grub_uefi --recheck

Don’t forget to create the GRUB config file

grub-mkconfig -o /boot/grub/grub.cfg

Now when Arch and the bootloader is installed we need to exit chroot environment, unmount all partitions and reboot to our newly installed system.

exit
umount -a
telinit 6

Log in with your user credentials when Arch boots up and start/enable the dhcpcd client.

sudo systemctl start dhcpcd
sudo systemctl enable dhcpcd

That’s it.