How to install Arch Linux

An Arch Linux setup with LVM, LUKS, systemd-boot, and GNOME

1247 words · 6 min read

Arch Linux is known for, among many other things~~, such as being at the bleeding edge to a point of unstable~~ (ask anyone trying to get GNOME 3.24 on time), having no graphical installer, thus demanding command line knowledge, which is perhaps intimidating for some. However, Arch Linux allows me to setup a system into my desired state in the shortest amount of time with the least hassles, which is why I keep returning to Arch Linux despite its various annoyances.

The following setup guide is written primarily for myself, because even someone who has installed Arch Linux multiple times can’t remember every step perfectly. Most of these steps, however, should be applicable to other setups. After the process, you should get a basic installation with GNOME on an encrypted logical volume.

1. Enable network connection

The first thing to do after booting from the installation USB drive is to enable network connection. The exact setup may vary, but for my setup with Intel Wifi card, which is supported by the Linux Kernel out-of-the-box, the first step is to run–


–to connect to a wifi network. After that, test your connection by pinging a random website, such as:


2. Prepare your hard drive

My preferred setup is to have one partition as the EFI partition, and a LVM partition for the rest of the hard drive. There are various tools for partitioning hard drive, though I tend to use fdisk. To set up the partitions for /dev/sda, issue the following command:

fdisk /dev/sda

If there are existing partitions that you wish to remove, press d and Enter, then select the partitions you would like to remove one by one. Afterwards, press n and Enter to create new partitions.

The first partition to create is the EFI paritition. After pressing n and Enter, fdisk will ask you a number of questions, such as the beginning and end of the parition you want to create. Other than the end of the first partition, which I will put +500M in, you can press Enter to use defaults.

By default, fdisk creates Linux filesystem for all the partitions. To create the correction partition types, press t and Enter. First, change the partition 1 to EFI partition putting 1 as the HEX code. Repeat the process for partition 2, but put 31, which stands for Linux LVM.

When you have finished it, press w and Enter to write the change to the disk.

Next, we have to format the EFI partition with FAT32.

mkfs.vfat -F32 /dev/sda1

3. Setup encryption and create partitions within the LVM

Encrypt the entire LVM partition by running–

cryptsetup --cipher aes-xts-plain64 --key-size 512 --hash sha512 luksFormat /dev/sda2

You will be prompted to enter a passphrase twice. This passphrase will be used to unlock the partition in the future, as you are about to do now:

cryptsetup luksOpen /dev/sda2 arch

You are about to create a swap partition as well as a root partition within the LVM partition. To create an 8GB swap partition and use all the rest of the space as the root partition, issue the following commands:

pvcreate /dev/mapper/arch
vgcreate vol /dev/mapper/arch
lvcreate --size 8G vol --name swap
lvcreate -l +100%FREE vol --name root
mkfs.ext4 /dev/mapper/vol-root
mkswap /dev/mapper/vol-swap

4. Mount Partitions

mount /dev/mapper/vol-root /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
swapon /dev/mapper/vol-swap

5. Install the system

To install the base system and GNOME desktop, issue the following command:

pacstrap /mnt base base-devel gnome

This will give you the base system, GNOME, and all the dependencies, but without any other software. You can install more (or less) packages at this stage if you wish. If you want to use KDE instead, go ahead.

6. Generate /etc/fstab

The /etc/fstab file stores the information about the filesystem, and this information will be used at startup to mount partitions. To generate the file, run:

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

Open the generated /etc/fstab file to ensure all the necessary partitions are included and set up correctly.

7. Chroot into the system

In this step, we go into the root of the installation, which is mounted at /mnt for the moment, and pretend it is root:

arch-chroot /mnt

8. Setup time zone, locale, and hostname

Now we set the timezone by creating symbolic link to the correct timezone file:

ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
hwclock --systohc --utc

Browse the /usr/share/zoneinfo directory to find the right file to link to.

To setup the locale for the system, open /etc/locale.gen file–

nano /etc/locale.gen

–and uncomment the language you wish to use for your system. In my case, it is en_GB.UTF-8 UTF-8. After saving the changes, run:


Finally, to set the hostname, run the following command:

echo  *your-host-name* > /etc/hostname

Then edit /etc/hosts to look like this:   localhost.localdomain	        localhost
::1         localhost.localdomain	        localhost   *your-host-name*.localdomain  *your-host-name*

9. Create user account

Create your user account:

useradd -m -G wheel -s /bin/bash your-user-name

This will put your user account into wheel group, which is necessary for using sudo (step 10).

Then setup your password:

passwd your-user-name

10. Enable sudo

This allows you to perform tasks with root privilege without using the actual root login. First, open /etc/sudoers

nano /etc/sudoers

–and uncomment the following line to enable root privilege for users inside wheel group:

# %wheel ALL=(ALL) ALL

11. Disable root login

Since your account can now perform tasks with root privilege, the actual root user is unnecessary, so it is safe to disable root account:

passwd -l root

12. Configure mkinitcpio.conf

To configure the generation of the initial ramdisk, you have to configure /etc/mkinitcpio.conf correctly. The most important part of the file is the HOOKS section. The following are the hooks I have for my use case:

HOOKS="systemd autodetect modconf keyboard block sd-encrypt sd-lvm2 filesystems"

If there are other modules and hooks necessary for your use case, this is the time to configure them.

Note: By default, base and udev hooks are used instead of systemd. If you opt for the default setup instead, sd-encrypt and sd-lvm2 should be replaced with encrypt and lvm2. The setup for the bootloader entry will be different if you opt for the default setup.

13. Generate initial ramdisk

After editing /etc/mkinitcpio.conf, generate the image:

mkinitcpio -p linux

14. Install bootloader

To install systemd-boot, run:

bootctl --path=/boot install

As systemd-boot doesn’t generate boot entries automatically (strangely enough, systemd-boot can detect Windows installation and add an entry for Windows automatically), you have to create the entry yourself. Create /boot/loader/entries/arch.conf. The exact content of this file will vary according to your specific setup, but it will look like this:

title   Arch Linux
linux   /vmlinuz-linux
initrd  /initramfs-linux.img
options rd.luks.uuid=[UUID of the encrypted logical volume] rd.luks.options=discard resume=UUID=[UUID of Swap Partition] root=[UUID of Root Parition] ro quiet

15. Enable GDM

GDM is a display manager. It must be enable to allow you to login to your desktop environment. To enable it on startup, run:

systemctl enable gdm

16. Reboot and hope for the best

At this point, the installation should be completed. Exit chroot, restart the computer, and remove the installation USB drive. If you can’t boot into the system at this point, boot from the installation media again and attempt to fix it.

If you can boot into GNOME desktop, congratulations! You have completed the first step towards building your own system.

If you want more tips, head over to my tips on what to do after a fresh Arch Linux install, and how to keep your Arch Linux system stable

 Tech    16 Apr, 2017
 Linux    Arch Linux  
Copyright © Peter Y. Chuang 2019

Peter Y. Chuang


Peter Y. Chuang is a novelist, short story writer, and a music critic. When he’s not writing or reading, he’s probably listening to classical music or tinkering with his computers. He uses Linux (current distro of choice: Arch Linux). Read more about his Linux stuff.

You may also like...