Arch Linux is one of the most versatile GNU Linux distribution due to its simplicity and cutting edge software packages due to its Rolling Release model, Arch Linux is not addressed for beginners in Linux world. It also provides a complicated command-line installer, with no Graphical Interface support. The command-line installation model makes the job of installing the system very flexible but also very difficult for Linux beginners.
On top of all, Arch Linux provides its own software packages repositories via Pacman Package Manager. Arch Linux also provides a Multiarch environment for different CPU Architectures, such as 32bit, 64bit, and ARM.
The software packages, dependencies, and security patches are mostly updated on a regular basis, making Arch Linux a cutting-edge distribution with a few solid tested packages for a production environment.
Arch Linux also maintains the AUR – Arch User Repository, which is a huge community-driven software repositories mirror. AUR repo mirrors allow users to compile software from sources and install it via Pacman and Yaourt (Yet Another User Repository Tool) package managers.
This tutorial presents a step by step basic Arch Linux installation process through a CD/USB bootable image on UEFI based machines. For other customizations or details visit the Official Arch Linux Wiki page at https://wiki.archlinux.org.
Step 1: Create a Disk Partitions Layout
1. First of all, go do the Arch Linux download page and grab the latest CD image (i.e. current stable version: 2020.05.01), create a bootable CD/USB then plug it into your system CD/USB drive.
2. IMPORTANT STEP! Also, make sure your system has an Ethernet plugged in cable with internet connectivity and also an active DHCP server enabled.
3. After the CD/USB boots up you will be presented with first Arch Linux Installer options. Here, select Arch Linux archiso x86_64 UEFI CD and press Enter key to continue.
4. After the installer decompresses and loads the Linux Kernel you will be automatically thrown to an Arch Linux Bash terminal (TTY) with root privileges.
A good step now is to list your machine NICs and verify internet network connection by issuing the following commands.
# ifconfig # ping -c2 google.com
In case you don’t have a DHCP server configured at your premises to dynamically allocate IP addresses to clients, issue the below commands to manually configure an IP address for Arch Live media.
Replace the network interface and IP addresses accordingly.
# ifconfig eno16777736 192.168.1.52 netmask 255.255.255.0 # route add default gw 192.168.1.1 # echo “nameserver 18.104.22.168” >> /etc/resolv.conf
On this step, you can also list your machine hard disk by issuing the following commands.
# cat /proc/partitions # ls /dev/[s|x|v]d* # lsblk # fdisk –l
In case your machine is a virtual based machine, the hard disks can have other names than sdx, such as xvda, vda, etc. Issue the below command to list virtual disk if you’re unaware of the disk naming scheme.
# ls /dev | grep ‘^[s|v|x][v|d]’$*
Important to note is that the name convention for Raspberry PI drive storage usually is /dev/mmcblk0 and for some types of hardware RAID cards can be /dev/cciss.
5. On the next step, we’ll start to configure the Hard Disk partitions. For this stage you can run cfdisk, cgdisk, parted or gdisk utilities to perform a disk partition layout for a GPT disk. I strongly recommend using cfdisk for its wizard-driven and simplicity in use.
For a basic partition, the layout table uses the following structure.
- EFI System partition (
/dev/sda1) with 300M size, FAT32 formatted.
- Swap partition (
/dev/sda2) with 2xRAM recommended size, Swap On.
- Root partition (
/dev/sda3) with at least 20G size or rest of HDD space, ext4 formatted.
Now let’s actually start creating disk layout partition table by running cfdisk command against machine hard drive, select GPT label type, then select Free Space then hit on New from the bottom menu, as illustrated in the below screenshots.
# cfdisk /dev/sda
6. Type the partition size in MB (300M) and press enter key, select Type from the bottom menu and choose EFI System partition type, as shown in the following screenshots.
You’ve finished configuring the EFI System partition.
7. Next, let’s create the Swap partition using the same procedure. Use down arrow key and select again the remaining Free Space and repeat the steps above: New -> partition size 2xRAM size recommended (you can safely use 1G) -> Type Linux swap.
Use the below screenshots as a guide to creating the swap partition.
8. Finally, for
/(root) partition use the following configuration: New -> Size: rest of free space -> Type Linux filesystem.
After you review Partition Table select Write, answer with yes in order to apply disk changes and then, type quit to exit cfdisk utility, as shown in the below images.
9. For now, your partition table has been written to HDD GPT but no file system was yet created on top of it. You can also review the partition table summary by running fdisk command.
# fdisk -l
10. Now, it’s time to format the partitions with the required file systems. Issue the following commands to create a FAT32 file system for EFI System partition (/dev/sda), to create the EXT4 file system for the root partition (/dev/sda3) and create the swap partition for /dev/sda2.
# mkfs.fat -F32 /dev/sda1 # mkfs.ext4 /dev/sda3 # mkswap /dev/sda2
Step 2: Install Arch Linux
11. In order to install Arch Linux, the
/(root) partition must be mounted to
/mnt directory mount point in order to be accessible. Also, the swap partition needs to be initialized. Issue the below commands to configure this step.
# mount /dev/sda3 /mnt # ls /mnt # swapon /dev/sda2
12. After the partitions had been made accessible, is time to perform Arch Linux system installation. To increase installation packages download speed you can edit /etc/pacman.d/mirrorlist file and select the closest mirror website (usually choose your country server location) on top of the mirror file list.
# nano /etc/pacman.d/mirrorlist
You can also enable Arch Multilib support for the live system by uncommenting the following lines from /etc/pacman.conf file.
[multilib] Include = /etc/pacman.d/mirrorlist
13. Next, start installing Arch Linux by issuing the following command.
# pacstrap /mnt base base-devel linux linux-firmware nano vim
Depending on your system resources and internet speed the installer can take from 5 to 20 min to complete.
14. After the installation completes, generate fstab file for your new Arch Linux system by issuing the following command.
# genfstab -U -p /mnt >> /mnt/etc/fstab
Subsequently, inspect fstab file content by running the below command.
# cat /mnt/etc/fstab
Step 3: Arch Linux System Configuration
15. In order to further configure Arch Linux, you must chroot into
/mnt the system path and add a hostname for your system by issuing the below commands.
# arch-chroot /mnt # echo "archbox-tecmint" > /etc/hostname
16. Next, configure your system Language. Choose and uncomment your preferred encoding languages from /etc/locale.gen file then set your locale by running the following commands.
# pacman -S nano # nano /etc/locale.gen
the locale.gen file excerpt:
en_US.UTF-8 UTF-8 en_US ISO-8859-1
Generate your system language layout.
# locale-gen # echo LANG=en_US.UTF-8 > /etc/locale.conf # export LANG=en_US.UTF-8
17. The next step is to configure your system time zone by creating a symlink for your sub time zone (/usr/share/zoneinfo/Continent/Main_city) to /etc/localtime file path.
# ls /usr/share/zoneinfo/ # ln -s /usr/share/zoneinfo/Aisa/Kolkata /etc/localtime
You should also configure the hardware clock to use UTC (the hardware clock is usually set to the local time).
# hwclock --systohc --utc
18. Like many famous Linux distributions, Arch Linux uses repo mirrors for different world locations and multiple system architectures. The standard repositories are enabled by default, but if you want to activate Multilib repositories you must uncomment
[multilib] directives from /etc/pacman.conf file, as shown in the below excerpt.
# nano /etc/pacman.conf
19. If you want to enable Yaourt Package Tool support (used for downloading and building AUR packages) go to the bottom of the /etc/pacman.conf file and add the following directives.
[archlinuxfr] SigLevel = Never Server = http://repo.archlinux.fr/$arch
20. After the repository file has been edited, synchronize and update database mirrors and packages by running the below command.
# pacman -Syu
21. Next, set up a password for the root account and create a new user with Sudo privileges in the Arch box by issuing the commands below. Also, expire the user password in order to force the new user to change the password at first login.
# passwd # useradd -mg users -G wheel,storage,power -s /bin/bash your_new_user # passwd your_new_user # chage -d 0 your_new_user
22. After the new user has been added you need to install the sudo package and update the wheel group line from /etc/sudoers file in order to grant root privileges to the newly added user.
# pacman -S sudo # pacman -S vim # visudo
Add this line to /etc/sudoers file:
%wheel ALL=(ALL) ALL
24. On the last step, install the Boot Loader in order for Arch to boot up after restart. The default boot loader for Linux distributions and Arch Linux also is represented by the GRUB package.
To install the GRUB boot loader in UEFI machines on the first hard-disk and also detect Arch Linux and configure the GRUB boot loader file, run the following commands as illustrated in the following screenshots.
# pacman -S grub efibootmgr dosfstools os-prober mtools # mkdir /boot/EFI # mount /dev/sda1 /boot/EFI #Mount FAT32 EFI partition # grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck
25. Finally, create the GRUB configuration file by issuing the following command.
# grub-mkconfig -o /boot/grub/grub.cfg
Congratulations! Arch Linux is now installed and configured for your box. The last steps needed now are to exit the chroot environment, unmount the partitions and reboot system by issuing the below commands.
# exit # umount -a # telinit 6
26. After reboot, remove the installation media image and the system will boot directly into the GRUB menu as shown below.
27. When the system boots-up into Arch Linux, log in with the credentials configured for your user during the installation process and change the user account password as shown below.
28. You will lose the internet network connection because no DHCP client is running by default in the system. In order to overcome this problem, issue the following command with root privileges in order to start and enable the DHCP client.
Also, check if the network interface is up and has an IP address allocated by the DHCP server and if the internet connection works as expected. Ping a random domain to test the internet connection.
$ sudo systemctl start dhcpcd $ sudo systemctl enable dhcpcd # ip a # ping -c2 google.com
For now, the Arch Linux system contains only the basic software packages needed to manage the system from Command-Line, with no Graphical User Interface.
Due to its high-portability, rolling release cycles, source packages compilation, granular control over installed software and processing speed, Arch Linux resembles in many ways with Gentoo Linux, but cannot rise to Gentoo complex architectural design.
However, the process of managing an Arch Linux system is not recommended for Linux beginners. Linux beginners that want to operate an Arch-like Linux system should first learn Arch Linux principles by installing the Manjaro Linux distribution.