Arch Linux is an x86-64 Linux distribution that focuses on the KISS(Keep It Simple, Stupid) principle. This is achieved by using the rolling release model where each release has its own attached new packages. With this model, there is no “major release” of completely new versions of the system, and hence regular updates are required to get the latest versions. This adopted principle ensures that there are minimal and distribution-specific changes which in turn reduces breakage with updates.
The Arch project was started in March 2002 by Judd Vinet after inspiration from CRUX. Ever since its first release, Arch gained massive popularity and is currently among the best 10 Linux distributions.
Pacman, the default package manager for Arch Linux is used to install, remove and update packages. This installation covers steps you can use to install Arch Linux on your system.
You will need the following pre-requisites met before we install Arch Linux.
- A 64bit system
- At least 1GB of RAM and 20GB of free hard-drive space
- Knowledge of Linux command line utilities
- An internet connection
- USB/DVD drive
Having met the above requirements, proceed and install Arch Linux with the steps below:
Step 1 – Create bootable disk for Arch Linux
Download the Arch Linux ISO file from the official Arch Linux downloads page. There are several download options, choose one that works best for you.
To be able to install Arch Linux on a physical system, you need to create bootable media using one of the tools below:
- Ventoy: for Linux systems that accomodates multiple ISO files
- Rufus: this application is used to convert a disk into bootable media supported by Windows and maCOS operating systems.
- woeUSB for Linux users.
- Etcher Tool for macOS
On the Linux command line, you can create a bootable media using the below commands:
# Identify USB device
sudo lsblk
# Flash Arch Linux to USB drive
sudo dd bs=4M if=Arch_linux.iso of=/dev/sdX status=progress oflag=sync
In the command above, replace /Arch_linux.iso with the path of the downloaded ISO file and /dev/sdx with the path of your USB device.
Step 2 – Boot into Arch Linux installer
Insert the bootable USB disk on your system, Ensure that you modify boot options in BIOS to boot from the USB disk.
When the system boot into the USB disk, you will the below options.
Select the first option to install Arch Linux.
Step 3 – Set the preferred Keyboard Layout
The system will boot into a live mode, proceed and set the keyboard Layout to use during the installation.
The default layout is the US mapping. List the available options.
ls /usr/share/kbd/keymaps/**/*.map.gz
You can change the layout to a preferred one say Latin using the command below.
loadkeys de-latin1
Step 4 – Verify internet access
Verify if you have a working internet connection using the ping
command below.
ping -c 3 google.com
With a working internet, set the system time using the Network Time Protocol(NTP).
timedatectl set-ntp true
Check the status:
$ timedatectl status
Local time: Wed 2022-02-09 11:33:26 UTC
Universal time: Wed 2022-02-09 11:33:26 UTC
RTC time: Wed 2022-02-09 11:33:26
Time zone: UTC (UTC, +0000)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
Step 5 – Partition the Disk
List the available disks using the command:
lsblk
Sample Output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 715.4M 1 loop /run/archiso/airootfs
sda 8:0 0 40G 0 disk
sr0 11:0 1 864.3M 0 rom /run/archiso/bootmnt
Now we will use cfdisk
to create partitions for the system. Use the command below to create a partition.
cfdisk /dev/sda
Remember to replace sda with the disk you want to make partitions on. Now proceed and create a dos label type on the disk.
You will then be granted the available free disk to create partitions on.
Select New as shown above to create a new partition. Set the partition size in GB, but remember to leave some free space(two times the amount of RAM) for the swap partition.
Set this partition as your primary partition.
Now you will have your new partition created along with the remaining free space. Make this partition bootable as below
On the free remaining space, create another partition using similar steps but on this one, instead of making it bootable, select the type option.
In the type list, set the disk type to 82 Linux swap / Solaris.
Now apply the changes by selecting Write then type Yes.
Once the changes have been written to the disk, Quit.
Step 6 – Create Filesystems
We will create filesystems for the two portions:
- Bootable partition(/dev/sda1)
- Swap partition(/dev/sda2)
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 715.4M 1 loop /run/archiso/airootfs
sda 8:0 0 40G 0 disk
├─sda1 8:1 0 35G 0 part
└─sda2 8:2 0 5G 0 part
sr0 11:0 1 864.3M 0 rom /run/archiso/bootmnt
To create an EXT4 file system for the bootable partition use the command.
mkfs.ext4 /dev/sda1
Remember to replace sda1 with the appropriate partition.
Output:
mke2fs 1.46.4 (18-Aug-2021)
Discarding device blocks: done
Creating filesystem with 9175040 4k blocks and 2293760 inodes
Filesystem UUID: 17e814cd-b1c6-42fc-9d05-f911d5afcc07
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done
Next, create a file system for the swap partition.
mkswap /dev/sda2
Sample output:
Setting up swapspace version 1, size = 5 GiB (5367656448 bytes)
no label, UUID=be05235f-49eb-4d8f-a919-85778c6fa1f6
Step 7 – Mount the filesystems
Now mount the created partitions using the below command.
mount /dev/sda1 /mnt
swapon /dev/sda2
We have now mounted the bootable partition and activated the swap space filesystem.
Step 8 – Update the Arch Linux Mirror List
Updating the mirror list is so essential since the mirrors far away will slow down the process and can cause errors during the installation.
Begin by syncing the repository as below.
pacman -Syy
Sample output:
:: Synchronizing package databases...
core 136.4 KiB 6.66 MiB/s 00:00 [######################] 100%
extra 1554.5 KiB 44.6 MiB/s 00:00 [######################] 100%
community 6.1 MiB 86.5 MiB/s 00:00 [######################] 100%
In this guide, we will use reflector
to update the mirror list. Install it as below.
pacman -S reflector
Dependency tree:
resolving dependencies...
looking for conflicting packages...
Packages (1) reflector-2021.11-2
Total Download Size: 0.03 MiB
Total Installed Size: 0.10 MiB
Net Upgrade Size: 0.00 MiB
:: Proceed with installation? [Y/n] y
Take a backup of the available mirrors.
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
Now update the Mirror list using reflector.
reflector -c "YY" -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist
Remember to replace YY with the country code, for example, use KE for Kenya.
Step 9 – Install the Arch Linux Base System
To install the base system use the pacstrap
command below.
pacstrap /mnt base linux linux-firmware
sample output:
.....
:: Retrieving packages...
linux-5.16.7.arc... 155.7 MiB 48.4 MiB/s 00:03 [######################] 100%
linux-firmware-2... 134.1 MiB 39.8 MiB/s 00:03 [######################] 100%
gcc-libs-11.1.0-... 30.3 MiB 27.8 MiB/s 00:01 [######################] 100%
icu-70.1-1-x86_64 10.7 MiB 27.4 MiB/s 00:00 [######################] 100%
glibc-2.33-5-x86_64 9.8 MiB 26.3 MiB/s 00:00 [######################] 100%
systemd-250.3-3-... 7.2 MiB 26.6 MiB/s 00:00 [######################] 100%
binutils-2.36.1-... 6.2 MiB 24.6 MiB/s 00:00 [######################] 100%
openssl-1.1.1.m-... 3.6 MiB 23.3 MiB/s 00:00 [######################] 100%
glib2-2.70.3-1-x... 2.8 MiB 16.3 MiB/s 00:00 [######################] 100%
gnutls-3.7.3-1-x... 2.8 MiB 19.7 MiB/s 00:00 [######################] 100%
coreutils-9.0-2-... 2.7 MiB 19.2 MiB/s 00:00 [######################] 100%
gnupg-2.2.32-2-x... 2.4 MiB 17.9 MiB/s 00:00 [######################] 100%
util-linux-2.37.... 2.3 MiB 17.6 MiB/s 00:00 [######################] 100%
gettext-0.21-1-x... 2.1 MiB 16.3 MiB/s 00:00 [######################] 100%
sqlite-3.37.2-1-... 1743.4 KiB 17.6 MiB/s 00:00 [######################] 100%
bash-5.1.016-1-x... 1667.7 KiB 16.8 MiB/s 00:00 [######################] 100%
libxml2-2.9.12-7... 1386.5 KiB 15.6 MiB/s 00:00 [######################] 100%
....
==> Generating module dependencies
==> Creating zstd-compressed initcpio image: /boot/initramfs-linux-fallback.img
==> Image generation successful
(12/12) Reloading system bus configuration...
Skipped: Running in chroot.
pacstrap /mnt base linux linux-firmware 16.14s user 11.34s system 40% cpu 1:08.66 total
This process may take quite some time depending on your internet speed.
Step 10 – Configure the Arch Linux System
With the base system installed, we need to make a few configurations. First, generate the fstab file with the mount points:
genfstab -U /mnt >> /mnt/etc/fstab
Now navigate into the mounted disk using the command:
arch-chroot /mnt
Now make the below configurations:
Set the TimeZone
List available timezones:
timedatectl list-timezones
Se the appropriate timezone.
timedatectl set-timezone Time/Zone
Replace Time/Zone with the appropriate timezone. Example:
timedatectl set-timezone Africa/Nairobi
Set the Locale
this is used to determine your language, numbering, and currency format. Set the preferred locale in the below file by uncommenting it.
# pacman -S vim
# vim /etc/locale.gen
Once preferred changes have been made, save the file and proceed. For US English.
en_US.UTF-8 UTF-8
Create system users
Create a password for the root user:
$ passwd
New password:
Retype new password:
passwd: password updated successfully
Create a standard system user.
useradd -m -G wheel,users -s /bin/bash user1
passwd user1
Install required packages:
pacman -S bash-completion openssh zsh xterm chromium sudo dhclient networkmanager --noconfirm
pacman -S xorg --noconfirm
Allow the created user to execute commands.
echo "export EDITOR=vim" >> ~/.bashrc
source ~/.bashrc
visudo
Uncomment the below lines:
%wheel ALL=(ALL) ALL
Set Hostname
Begin by creating the hostname for the system.
echo arch.localhost > /etc/hostname
Create the hosts file as below.
vim /etc/hosts
In the file, add the below lines:
127.0.0.1 localhost
::1 localhost
127.0.1.1 arch.localhost
Step 11 – Install Grub Loader on Arch Linux
Depending on your system, there are two methods:
Non-UEFI system
For a non-UEFI system, proceed as below.
pacman -S grub os-prober
grub-install /dev/sda
Create a config file for the GRUB.
grub-mkconfig -o /boot/grub/grub.cfg
UEFI system
For a UEFI system, proceed as below.
pacman -S grub efibootmgr
mkdir /boot/efi
mount /dev/sda1 /boot/efi
Now install GRUB.
grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi
Create a config file for the GRUB.
grub-mkconfig -o /boot/grub/grub.cfg
Step 12 – Install the Desktop Environment on Arch Linux.
Those who need GUI on Arch Linux need to install a desktop environment.
##For KDE
pacman -S plasma kde-applications-meta
systemctl enable sddm.service
##For Gnome
pacman -S gnome gnome-extra
pacman -S gdm
systemctl enable gdm
##For XFCE
pacman -S xfce4 xfce4-goodies xfce4-mixer gstreamer0.10-good-plugins \ libxnvctrl xscreensaver # pacman -S lightdm lightdm-gtk-greeter
systemctl enable lightdm.service
##For Cinnamon
pacman -S cinnamon
pacman –S gdm
systemctl enable gdm
Reboot the system.
exit
umount -R /mnt
reboot
Step 13 – Post Arch Linux installation configurations
Once your system reboots, you should be able to see the login window as below.
On successful authentication, you will see the below dashboard.
Verify your installation under system settings-> About the system.
Launch the terminal and start and enable the Networking manager.
sudo systemctl start NetworkManager.service
sudo systemctl enable NetworkManager.service
You can also edit your connection using the nmtui
tool
nmtui
Switch between static and DHCP configurations.
Conclusion.
At this point, it is safe to assume that this guide on how to install Arch Linux – Step by Step With Screenshots has been a success. In case you find any problem with this setup, let us know.