skip to content

Arch Linux install guide

/ 6 min read

Arch Linux logo

Arch is a very lightweight distribution based on systemd init system and for a lot of people it’s the most useful distro due to his powerful package manager (pacman) and the AUR (Arch User Repository) where you can find every software you want.. trust me, everything.

For many people the “problem” of Arch is his installation process because, on the official iso, you have to install it via terminal, so no gui.

When me and my friend Mattia booted for the first time Arch it was disconcerting for us: we didn’t think we had to do everything from the terminal! The first reaction was and now? So we started looking for guides and tutorials on how to install this (at the time) impossible distribution and after a lot of attempts we did it.

This guide comes from that experience and from all the little minutiae found around and obviously we did not know of the existence of the magical wiki.

Before we start with the guide I want to say that I’ve also created an automated install script called myArchInstaller for the installation but.. you know, it’s better if you install it by hand.

I want to clarify one thing: this guide is created with the purpose of being easy to understand and quick. Some points could not be correct for your computer (I refer to a computer with a wired internet connection and a uefi bios). If so, I suggest you go to the official guide to consult your specific case.

So, here we are!

1. Medium creation

The first step concerns the creation of the usb medium which contains our arch iso. Go on the download page, pick the best mirror for you and download the iso. After that insert the usb drive you want to use for the medium, run an lsblk command and check which drive is your medium. Then write the iso using dd command:

dd if=arch.iso of=/dev/$your_medium oflag=direct bs=16M status=progress

If you don’t have write permissions use it with sudo or doas.

2. Reboot and run your arch medium

Do I have to tell you how to do it?

3. (optional) Load you keyboard translation tables

If you don’t have an us keyboard you must load you keyboard translation tables. How? Check your layout with

ls /usr/share/kbd/keymaps/**/*.map.gz

and then use the command

loadkeys $your_kb

4. Disk partitioning

Check the disk you want to use for you arch installation with one of these two commands: fdisk -l / lsblk. Run

cfdisk /dev/$your_disk

to manipulate your partition table and select the GPT partition table. Now this part is very important, you have to declare spaces for each individual partition! I suggest you my usual configuration:

Partition number --- size --- filesystem type --- purpose

  1. 500MB --- EFI System --- EFI boot partition
  2. 8/16GB --- Linux Swap --- Swap partition
  3. rest of the space --- Linux --- Linux system

So create and write them.

5. Filesystems

Now you have to generate the filesystem for each partition. If you followed the previous step you can generate your fs typing these commands. Follow this example: the partition no. 2 of your drive (for this example sdb) will be /dev/sdb2.

mkfs.fat -F32 /dev/$your_disk_PARTITION_N1
mkswap /dev/$your_disk_PARTITION_N2
mkfs.ext4 /dev/$your_disk_PARTITION_N3

Remember to enable your swap partition running the command

swapon /dev/$your_disk_PARTITION_N2

6. Disk mount and creation of the linux filesystem

Mount the partition you will use for the linux system with

mount /dev/$your_disk_PARTITION_N3 /mnt

and “populate it” installing packages to the specified root directory with the pacstrap command. I usually install in addition to the kernel, firmware and basic applications also nano, a text editor. So launch the command:

pacstrap -K /mnt base base-devel linux linux-firmware nano

and wait the download and installation process.

7. Generate the fstab file

This is another important step because the fstab file (located in /mnt/etc/fstab) contains the partitions which need to be mounted at startup. Run:

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

8. Chrooting and setting up the system

Now we have to set up some things like the locales and the hostname. To do this we need to chroot the newly created system with:

arch-chroot /mnt
  1. If you don’t now your specific timezone you can print all of them with:
timedatectl list-timezones

After that you can select it using:

timedatectl set-timezone your_region/your_city
  1. Now it’s up to locales. Use nano to edit the file which contains all the locales and uncomment your preferred locale:
nano /etc/locale.gen

Now generate it using

locale-gen
  1. Set up your language printing it with the echo command:
echo LANG=xx_XX.UTF-8 > /etc/locale.conf
  1. You have to define a name for your machine. You can call it how you want but for this example i’ll use the name arch:
echo arch > /etc/hostname
  1. Now it’s the /etc/hosts time. Open it with
nano /etc/hosts

and fill it with these lines:

127.0.0.1  localhost
::1        localhost
127.0.1.1  arch (this is your hostname, so if it's not arch change it)
  1. A password is something you need to know to log in the system. So.. type
passwd

and write a password for the root user.

  1. (optional) If you want to create now another user you can follow this point. In always create an user with the wheel group permissions, so I have first to set the wheel permissions to be used with sudo. To do this type
nano /etc/sudoers

to open the sudoers file and uncomment the line where is written allow members of group wheel... Now we can create an user with sudo permissions!

useradd -m -G wheel -s /bin/bash “$your_username”

this command will create your user! To set the password simply type passwd and immediatly after your username, like

passwd username
  1. This is the last point of the section, I promise you. We’ve to set up the internet connection. To do this let’s use the package manager pacman to download net-tools (configuration tools for Linux networking) and networkmanager (a connection manager). To do this use this command:
pacman -S net-tools networkmanager

. So now enable the service for the next boot using systemctl:

systemctl enable NetworkManager

9. Grub

We are at the last section, perhaps the most important.. we have to install the bootloader, in this case GRUB. Let’s install the binaries with

pacman -S efibootmgr grub

After that we have to create the EFI folder where we will mount the EFI partition. So type

mkdir /boot/efi

and

mount /dev/$your_disk_PARTITION_N1 /boot/efi

to mount it. Here we are, let’s install and create the grub configuration file. Type

grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi

to install grub in the efi directory and

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

to create your config.

We’have finished! The arch installation process is complete, you can now reboot to your system typing

reboot

Have a good time :)