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 kinda gives tough time for beginners in Linux world. It also a command-line-only installer, with no GUI. The command-line installation model makes the job of installing the system very flexible but also very difficult for Linux beginners.
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.
So, in this article I’ll show you how to install Arch Linux in UEFI mode. I’ll also cover how to install your preferred desktop environment (for this article KDE)
Create Arch Linux bootable USB
You can create a bootable USB using Linux or Windows. The tool that we’re going to use is called Etcher. It is available for Linux, Windows and macOS as well.
Download Etcher from here. Using Etcher is pretty simple. First select the Arch Linux ISO, then the USB drive which you want to use and then click on flash to start creating the bootable USB.
Plug out the usb storage device safely and plug it into the machine you want to boot. Now open boot menu and select the bootable USB drive you’ve just created. The key to open boot menu for me is F12, this can be different for your machine. Please Google and check what’s yours.
After the 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. Make sure you have an ethernet cable plugged in directly from PC to your router and the router has DHCP server enabled.
After the installer decompresses and loads the Linux Kernel you will be automatically thrown to an Arch Linux Bash terminal (TTY) with root privileges.
First thing to do here is, check your internet connection.
# ping -c4 google.com
If you’re getting a response then you’re good to go.
Installing Arch Linux
Now you’ll need to select the hard drive you want to install Arch Linux on. Make sure you do this step carefully, if you choose wrong drive you might end up losing your data from it.
To list all available hard drives, use the following command.
# 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]’$*
On the next step, we’ll start to configure the Hard Disk partitions. For this stage you can run cfdisk, cgdisk 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.
# cfdisk /dev/sda
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.
/(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.
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/sda1), to create the EXT4 file system for the root partition.(/dev/sda2)
# mkfs.fat -F32 /dev/sda1 # mkfs.ext4 /dev/sda2
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/sda2 /mnt
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
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.
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
Arch Linux System Configuration
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 "droidmonster" > /etc/hostname
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
Generate your system language layout.
# locale-gen # echo LANG=en_US.UTF-8 > /etc/locale.conf # export LANG=en_US.UTF-8
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
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
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
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
Finally, create the GRUB configuration file by issuing the following command.
# grub-mkconfig -o /boot/grub/grub.cfg
At this point Arch Linux is installed but there are a few more things we need to do.
# sudo pacman -S networkmanager # sudo systemctl enable networkmanager
Now reboot your machine and boot from the hard drive you’ve installed Arch Linux to. Once booted use your username and password you created earlier to log-in
Installing desktop environment (KDE Plasma) on Arch Linux
# sudo pacman -S xorg xorg-server # sudo pacman -S plasma kde-applications # sudo pacman -S sddm # sudo systemctl enable sddm
After this is done just reboot. Now you’ll be able to log-in to your KDE Plasma Arch Linux Install.