Arch Linux — Complete Installation Guide

Tapas Das
8 min readAug 31, 2020

--

Arch Linux is one of the most popular minimalist Linux distributions in use today. It is a general-purpose (bleeding-edge) rolling release Linux distribution which truly follows the KISS (Keep-It-Simple-Silly) ideology.

Arch Linux adheres to five principles:

  • Simplicity
  • Modernity
  • Pragmatism
  • User centrality
  • Versatility

Arch, however, does have a steep learning curve, and while the documentation for Arch Linux is comprehensive, many new users find it overwhelming and complicated.

The default Arch installation covers only a minimal base system and expects the end users to configure the system by themselves. This is why installing Arch Linux is a challenge in itself but at the same time, it is a learning opportunity for intermediate Linux users.

Let’s get started with the installation process.

Prerequisites

  • A x86_64 (i.e. 64 bit) compatible machine
  • Minimum 512 MB of RAM (recommended 2 GB)
  • At least 2 GB of free disk space (recommended 20 GB for basic usage with a desktop environment)
  • An active internet connection
  • A USB drive with minimum 2 GB of storage capacity
  • Familiarity with Linux command line

Installing Arch Linux

Step-1: Download Arch Linux ISO file

You can download the ISO from Arch’s official website. Both direct download and torrent links are available.

Step-2: Create live USB for installation

You can use balenaEtcher tool to create the live USB. It is available for both Windows and Linux.

Step-3: Boot Arch Linux from the live USB created

Once you have created a live USB for Arch Linux, shut down your PC. Plugin the live USB and boot your system. While booting keep pressing F2, F10 or F12 key (depending upon your system) to go into boot settings.

In here, select to boot from USB or removable disk. Once you do that and the system boots, you should see an option like this:

Note: In some cases, you may not be able to boot from live USB with secure boot enabled. In such cases, disable the secure boot first.

Select Boot Arch Linux (x86_64) option. After various checks, Arch Linux will boot to login prompt with root user.

Step-4: Check if internet connection is working

To install Arch Linux, we will need a functioning Internet connection. If you are using a wired connection, you should already be connected to the Internet. You can check your Internet connection by using the ping command:

# ping -c 3 google.com

Step-5: Enable Network Time Protocol (NTP)

Once we have verified that we have a working Internet connection, we must enable Network Time Protocol (NTP) to allow the system to update the time via the network. To do this, run:

# timedatectl set-ntp true

Step-6: Create partitions on the hard drive

We will create 3 partitions on the hard drive, mentioned below:

  • Root partition
  • Swap partition
  • EFI partition (only for UEFI systems)

To begin with, let’s first list all the disk and partitions on the system using the below command:

# fdisk -l

Select the disk you are going to format and partition:

# cfdisk /dev/sda

A screen similar to the one below should be displayed.

Now select “New”. You will be prompted to enter the partition size. Be sure to leave enough room to create partitions for EFI and swap space (which will be twice the amount of RAM).

Select the partition type as “Linux filesystem” as shown below.

Now, using the same process as before, utilizing the remainder of the space on the drive, create EFI and Swap partitions. Do not make these partitions bootable.

The final disk partitions should look like below image.

Now, write the changes to the drive. To do so, select “Write” and type “yes”. You may now exit “cfdisk” by selecting “Quit”.

Step-7: Create filesystem

Now that the drive has been partitioned, we can create filesystem on it. First let’s create an ext4 filesystem on the “Linux filesystem” partition, using below command:

# mkfs.ext4 /dev/sda2

Second, let’s create FAT32 filesystem on the “EFI System” partition, using the below command:

# mkfs.fat -F32 /dev/sda1

Step-8: Create swap space

Next, we will create a swap space. Swap space in Linux is hard drive space that acts as extra RAM. To do this, run:

# mkswap /dev/sda3

Step-9: Mount the Filesystem and Swap Space

Now that both filesystems and swap space have been created, they must be mounted. To do this, we will use the following commands:

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

These commands will mount the filesystem and activate the swap space, respectively.

Step-10: Select an appropriate mirror

This is a big problem with installing Arch Linux. If you just go with installation steps, you might find that the downloads are way too slow. In some cases, it’s so slow that the download fails.

It’s because the mirrorlist (located in /etc/pacman.d/mirrorlist) has a huge number of mirrors but not in a good order. The top mirror is chosen automatically and it may not always be a good choice.

Thankfully, there is a fix for that. First sync the pacman repository so that you can download and install software:

# pacman -Syy

Now, install reflector that you can use to list the fresh and fast mirrors located in your country:

# pacman -S reflector

Make a backup of mirror list (just in case something goes wrong):

# cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak

Now, get the good mirror list with reflector and save it to mirrorlist. You can change the country from “US” to your own country.

# reflector -c "US" -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist

Step-11: Install the Base Arch System

We will use the pacstrap utility to download and install all the necessary components of Arch Linux. Below is the command for that:

# pacstrap /mnt base base-devel linux linux-firmware vim nano

Note: It will take some time to download and install these packages. If the download gets interrupted, no need to panic. You can run the above command once again and it will resume the download.

Step-12: Generate the fstab File

Next we will generate a fstab file to define how disk partitions, block devices or remote file systems are mounted into the filesystem.

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

Step-13: Chroot into Arch Linux

Now we will use arch-chroot and enter the mounted disk as root.

Actually, now you are using the just installed Arch Linux system on the disk. You’ll have to do some configuration changes to the installed system so that you could run it properly when you boot from the disk.

# arch-chroot /mnt

Step-14: Setting up the timezone

First find your time zone using the below command:

# timedatectl list-timezones

And then set up the timezone using the below command (replace India/Kolkata with your desired time zone):

# timedatectl set-timezone India/Kolkata

Next, update the hardware clock using the below command:

# hwclock --systohc

Step-15: Generate Locale file

This is what sets the language, numbering, date and currency formats for your system.

The file /etc/locale.gen contains all the local settings and system language in a commented format.

Open the file using Vim or Nano editor and uncomment (remove the # from the start of the line) the language you prefer. I have used en_IN.UTF-8 (English with India).

Now generate the locale config file using the below commands:

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

Step-16: Network Configuration

Create a /etc/hostname file and add the hostname entry to this file. Hostname is basically the name of your computer on the network.

In my case, I’ve set the hostname as tapas-vivobook. You can choose whatever you want:

# echo tapas-vivobook > /etc/hostname

The next part is to create the hosts file:

# touch /etc/hosts

And edit this /etc/hosts file with Vim or Nano editor to add the following lines to it (replace tapas-vivobook with hostname you chose earlier):

Step-17: Setup the Root Password

Now we must set the password for the root account using passwd command:

# passwd

Step-18: Install Grub bootloader

First install required packages:

# pacman -S grub efibootmgr

Create the directory where EFI partition will be mounted:

# mkdir /boot/efi

Now, mount the ESP partition you had created.

# mount /dev/sda1 /boot/efi

Now install grub using below command:

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

One final step.

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

Step-19: Install a desktop environment (GNOME in this case)

First install Xorg as display server, using the below command:

# pacman -S xorg

Now, you can install GNOME desktop environment on Arch Linux using below command:

# pacman -S gnome

The last step includes enabling the display manager GDM for Arch. I also suggest enabling Network Manager.

# systemctl start gdm.service
# systemctl enable gdm.service
# systemctl enable NetworkManager.service

Now exit from chroot and shutdown the system:

# exit
# shutdown now

Don’t forget to take out the live USB before powering on the system again. If everything goes well, you should see the Grub screen and then the GNOME login screen.

Concluding Remarks

You might have realised by now that installing Arch Linux is not as easy as installing Ubuntu. However, with a little patience, you can surely accomplish it and then tell the world that you use Arch Linux.

You can keep playing with it and see how powerful Arch is. Let me know in comments if you face any challenges while installing Arch Linux.

Please visit my blog (link below) to explore more on Machine Learning and Linux Computing.

--

--