Open In App

Arch Linux Installation and Configuration on UEFI Machines

Improve
Improve
Like Article
Like
Save
Share
Report

Arch Linux is one of the independently developed Linux distros with its community and official package repositories. Arch Linux is known for its minimal base system, configuration flexibility, and bleeding edge software rollouts. Followed the official arch installation guide from the Arch wiki website with a few tweaks that we will do while installing Arch.

This article describes how to install and configure Arch Linux on a UEFI machine. 

Prerequisites

A computer that is x86-64 compatible uses UEFI boot, has at least 512 MB or more of Ram, and a USB drive for the Boot drive.

Installing Arch is divided into five phases:

  • Preparing the Installation medium
  • Booting the live system 
  • Pre-installation Setup
  • Installing the base system and essential packages
  • Configure the system
  • Setting up the Grub Boot Manager

Phase 1: Preparing the Installation medium

We need to prepare a boot drive by burning the Arch Linux iso using software like Rufus.

Step 1: Download the iso

The official iso image file can be downloaded from the Arch Wiki website download page, choose a mirror according to your country and download the .iso file.

Step 2: Verify the iso image

One of the important steps is to verify the integrity of the iso file you downloaded. You can use any verification tool to verify the iso file, We will use certutil for windows or sha1sum for Linux. First, generate the hash of the iso file using the tool you are using, we have used certutil as follows:

 

As you can see we have generated the SHA1 hash now we just need to compare it with the SHA1 hash on the download website.

 

The SHA1 hash for the iso we downloaded is the same as the generated one now we can proceed further.

Step 3: Burning the ISO image 

Once the iso is verified it can be burned to the USB drive using Rufus or Etcher. Download either of them from their official sites we  have used Rufus over here

 

Once the process is completed by Rufus the drive is ready to be booted into.

Phase 2: Booting the live system 

Before booting into the drive, make sure the Secure Boot option is disabled in the BIOS settings and that the bootable USB drive is connected to a working USB port on the booting computer. 

Once done, you should figure out how to get into the boot menu of your particular computer. eg:- On HP computers press the F9 key several times while restarting. 

In the boot menu, you can see all the drives that can be booted on your system. Select your Arch USB drive. 

If everything works well you will be directed to the following screen.

 

 Continue with the first option. If you get an error, check the previous steps again.

Phase 3: Pre-installation Setup

If you are on the following screen you have now successfully booted into the live environment. 

 

Let’s check the boot mode with the following command: 

ls /sys/firmware/efi/efivars

 

A bunch of files will be listed which means you booted in UEFI mode. If the directory is not available, you have booted in BIOS mode.

Step 1: Connect to the Internet

First, let’s see all the network interfaces available by the following command

ip link

 

You can see the Ethernet, Wifi, and their states like Up or DOWN depending on if connected or not. We recommend using an ethernet connection but you can also go with a wireless connection by using iwctl.

Step 2: Update the system clock

Let us synchronize the system clock so it is accurate by this command

timedatectl set-ntp true

Step 3: Partitioning the disk

The official docs use the Fdisk tool for disk partitioning, but we use cfdisk, which has a GUI, so it’s probably a quick and easy way to partition a disk. 
Simply create the following types of partitions using the cfdisk command as shown in the image below.

cfdisk

 

After running the command cfdisk you will see a screen like the above, it shows all the drives your system has with their capacities.

 

Press Enter on the New option at the bottom, enter 500MB as the partition size, set the partition type to  EFI system and you’re done, you just created an EFI System partition of size 500 MB which we will be using as a boot partition. Same way create the following type of partitions as shown:

 

We have created 3 GPT partitions an EFI system partition for boot ( at least 500MB), a swap, and a root partition. You can allocate them whatever amount of memory you want.

Step 4: Formatting the Partitions

Once the partition has been created, each newly created partition must be formatted with an appropriate file system.

Let’s start with the EFI system partition which is /dev/sda1 in our case,

mkfs.fat -F 32 /dev/efi_system_partition

Output:

 

Now let’s format the swap partition,

mkswap /dev/swap_partition

Output:

 

And at last the root partition,

mkfs.ext4 /dev/root_partition

Output:

 

Step 5: Mounting the file system

So far we have created a partition and formatted it, but that’s not enough. Because how Linux has to know which partition is used for what purpose, it needs to mount the partitions.

First, mount the root partition to /mnt partition 

mount /dev/root_partition /mnt

If you created a swap partition, it needs to be enabled before you can use it,

swapon /dev/swap_partition

Output:

 

Phase 4: Installing the base system and essential packages

Up Till now, we haven’t even installed Linux. To install the Linux kernel along with the required packages, run the following command:

pacstrap /mnt base linux linux-firmware

It is going to install base packages such as utilities for the file system, firmware for other devices, text editor, networking essential software, etc.

 

This will install a non-LTS Linux kernel and its firmware. To install the LTS kernel, run the following command:

pacstrap /mnt base linux-lts linux-firmware

Phase 5: Configure the system

Once the base system installation is done we will do the further configurations in /mnt. 

Step 1: Chroot to /mnt

arch-chroot /mnt

By this, we are now in the directory where we have created our Arch installation. You can see the change in the shell prompt,

 

Step 2: Configure Network Manager

The network manager is one of the most important software in Linux, as its responsible for networking on a Linux machine.

Let’s install it with a few other packages by this command:

pacman -S networkmanager wpa_supplicant wireless_tools netctl 

It will install NetworkManager and other software needed for wireless connection setup. 

Now let’s handover the task of starting the network manager every time we reboot system control by running this,

systemctl enable NetworkManager

Output:

 

Step 3:  Configure Boot Settings

Create a new initramfs by running the following command for normal Linux:

mkinitcpio -p linux

For installation with the LTS kernel run this

mkinitcpio -p linux-lts

This will configure all settings about the boot process.

 

Step 4:  Localization

Let’s set up the locale for the installation by choosing a locale:

nano /etc/locale.gen

uncomment the locale you want,

 

we uncommented en_US.UTF-8 as this is what we prefer to use, after selecting an appropriate locale run the following command:

locale-gen

Output:

 

All done, the selected locale settings have been generated.

Step 5: Time Zone

Lets setup the timezone according to your location, run the following command to do so:

ln -sf /usr/share/zoneinfo/Region/City /etc/localtime

Here region and city are the places which you want in the timezone.

 

 As we reside in India, we have done this,

 

Step 6: Configure Hostname

The hostname is the name of the machine, we can set it up using the following steps:

hostnamectl set-hostname host_name

Now configure the host file,

nano /etc/hosts

Add the following content to it

127.0.1.1 host_name
127.0.0.1 localhost

 

Step 7: Creating a non-root user

Currently, we are using the system as a root user which is not recommended, let’s create a user for ourselves along with sudo privileges,

useradd -m -g users -G wheel user_name

Now, it has created the user of the username you provided let’s set the password for the user created,

passwd user_name

 

Just a single step lets to enable sudo privileges for non-root users, this is as follows:

EDITOR=nano visudo

now find and uncomment the line the following line,

 

All done, save it by ctrl+ o and exit nano editor by ctrl + x.

Phase 6: Setting up the Grub Boot Manager

Step 1: Installing Grub

All system configurations are missing just one crucial piece of the puzzle. i.e. the boot manager. Linux uses the grub boot manager, this is how we can install it.

pacman -S grub efibootmgr dosfstools os-prober mtools

mkdir /boot/EFI

mount /dev/efi_system_partition /boot/EFI

We have mounted the boot partition to the /boot/EFI directory where we will set up grub.

Step 2: Generating Grub file

First, install grub for x86_64 machine

grub-install –target=x86_64-efi –bootloader-id=grub_uefi –recheck

 

To configure the locale of the grub boot screen run the following command

cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo

finally, let us generate the grub config file:

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

 

Now reboot the system and you have a newly installed Arch Linux.



Last Updated : 22 Feb, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads