How To Install Arch Linux 2021 [Step by Step Guide]

0

Arch Linux is a well-known open-source Linux distribution for x86-64 computers and is very popular among intermediate and advanced Linux users. Its development is purely driven by the community and the core development circle.

Arch Linux follows the KISS principle (“keep it short and simple”), which means you will only get a minimal base system from the Arch Linux installation and have to configure the system further to use it.

Arch Linux uses a rolling release model, i.e., packages are provided throughout the day and no major releases. Pacman allows users to keep systems updated easily, daily.

Requirements

  • An x86_64 (64 bit) machine
  • 512 MB of RAM
  • At least 1GB of free disk space
  • An Internet Connectivity
  • USB flash drive or Blank CD for burning the installation image.

Arch Linux has dropped support for 32bit installation from Feb 2017 and now supports only x86_64 installation.

Try Arch Linux 2021 VM Images

If you do not have time to install Arch Linux 2021, use the below link to download a ready to run Arch Linux 2021 VirtualBox and VMware images.

Install Arch Linux

Here, we will see how to install Arch Linux’s latest version (v 2021.01.1) from USB / CD.

Arch Linux installation process requires an internet connection to retrieve packages from Arch Linux mirrors.

Arch Linux ISO images do not support secure boot. You would need to disable the secure boot to the ISO image. If needed, you can set up a secure boot post the installation.

Step 1: Download Arch Linux

Download the latest version of Arch Linux from the official website.

Download Arch Linux Latest Version

Step 2: Create a Live USB / Write a Bootable CD

We will now create a live USB / write a bootable CD from the downloaded ISO image.

Create a live USB

Replace /path/to/archlinux.iso with the path to the downloaded ISO file and /dev/sdx with your USB drive name.

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress oflag=sync

Write a bootable CD/DVD/BD

Replace /path/to/archlinux.iso with the path to the downloaded ISO file.

### CD ###

cdrecord -v -sao dev=/dev/sr0 isoimage.iso

### DVD or Blu-Ray Disc ###

growisofs -dvd-compat -Z /dev/sr0=/home/user_name/Downloads/LinuxMint.iso

Step 3: Boot from Live USB or CD/DVD/BD

Power on your system and press F2, F10 or F12 to change/select the boot order.

To boot from Live USB, you need to select boot from USB or removable drive. To boot from CD, you need to select boot from CD/DVD ROM drive.

Once the system boots from Live USB or CD, you will get the Arch Linux installer screen, like below.

Choose Boot Arch Linux (x86_64) and then press Enter.

BIOS

Arch Linux Booting in BIOS Mode
Arch Linux Booting in BIOS Mode

UEFI

Arch Linux Booting in UEFI Mode
Arch Linux Booting in UEFI Mode

Finally, after various checks, you will get the root prompt.

Arch Linux Root Prompt
Arch Linux Root Prompt

Boot Mode (BIOS or UEFI)

Booting into the right mode helps us create the required partitions for the system. From the Arch Linux installer screen, you can easily find it out whether the system is booted in BIOS or UEFI. However, you can validate it by listing the directory.

ls /sys/firmware/efi/efivars
Arch Linux Booting Mode Check
Arch Linux Booting Mode Check

If the above command lists the contents without error, then the system is booted in UEFI mode.

If the directory does not exist, the system may be booted in BIOS mode.

Arch Linux Booting Mode Check
Arch Linux Booting Mode Check

In case the system did not boot into the mode you desired, refer to the system manual.

Step 4: Setup Network

As I said earlier, the system needs an active internet connection. If your environment has a DHCP server, then the system will get an IP Address automatically.

My system has an ethernet interface, which is connected to the internet via LAN cable. If your system has Wi-Fi, use the iwctl, an interactive prompt to authenticate to the wireless network.

Check the internet connectivity.

ifconfig

ping -c 2 google.com
Internet Connectivity Check
Internet Connectivity Check

If your system does not get a reply, then configure a static IP address on your system so that your system can connect to the internet to download packages.

ip addr flush dev ens33

ifconfig ens33 192.168.1.100 netmask 255.255.255.0

route add default gw 192.168.1.2

echo "nameserver 192.168.1.2" >> /etc/resolv.conf

echo "nameserver 8.8.8.8" >> /etc/resolv.conf

Replace the network card and IP address according to your environment.

Step 5: Partition Disk

We will now create the partitions on the hard disk for the OS installation. First, list the available disks using the fdisk command.

fdisk -l
Available Disks
Available Disks

The system has a 1 TB disk (/dev/sda) and will use that disk for OS installation. The name of the disk varies depending upon the system. The disks can have other names such as vda, hda, etc.

Now, we will use the fdisk command to create partitions as per the requirement.

Partition details are shown below.

BIOS

/boot1024 MB

swap4 GB (min 512 MB)

/ ~ 1000 GB (remaining space)

UEFI

/efi – 1024 MB

swap4 GB (min 512 MB)

/~ 1000 GB (remaining space)

fdisk /dev/sda

/boot:

Create Boot Partition
Create Boot Partition

/efi:

Create EFI Partition
Create EFI Partition

SWAP:

Create SWAP Partition
Create SWAP Partition

/ (root):

Create Root Partition
Create Root Partition

Once you have created partitions, use p to confirm the creation of partitions and then, w to save the changes.

Save Partition Layout
Save Partition Layout

Verify parttions using the fdisk -l command. We now have three partitions.

/dev/sda1/boot or /efi

/dev/sda2 swap

/dev/sda3/ (root)

Arch Linux Partitions
Arch Linux Partitions

Step 6: Create Filesystem

Now, its time format the created partitions with the required file systems. You can format /boot or /efi (/dev/sda1) as EXT2 or EXT3 for BIOS and Fat32 for UEFI, Swap (/dev/sda2) as swap and / (/dev/sda3) as EXT4 filesystem.

BIOS

mkfs.ext2 /dev/sda1

mkfs.ext4 /dev/sda3

mkswp /dev/sda2

UEFI

mkfs.fat -F32 /dev/sda1

mkfs.ext4 /dev/sda3

mkswp /dev/sda2

Step 7: Mount Partitions

Once you have formatted the partitions, use the mount command to mount them. / (root) partition must be mounted on /mnt directory.

If you Additional partitions, then those need to be mounted on the respective directories on /mnt. For Ex: /boot partition needs to be mounted on /mnt/boot.

Also, you would need to initialize the swap partition.

BIOS

mount /dev/sda3 /mnt

mkdir /mnt/boot

mount /dev/sda1 /mnt/boot

swapon /dev/sda2

UEFI

mount /dev/sda3 /mnt

mkdir /mnt/efi

mount /dev/sda1 /mnt/efi

swapon /dev/sda2

Step 8: Select Mirrors

Arch Linux’s packages must be downloaded from internet mirror servers. Mirrors are defined in /etc/pacman.d/mirrorlist. The mirror that tops the list is given priority for downloading a package that may not be ideal for all situations considering geographical, availability, and out-of-sync issues.

Use the reflector to retrieve the latest mirror from the Arch Linux mirror status, filter the up-to-date mirrors, sort them by speed and update the mirror list file.

Backup the existing mirror list.

 cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup

Then, update the mirrorlist file with 10 mirrors by download speed.

reflector --verbose --latest 10 --sort rate --save /etc/pacman.d/mirrorlist

Step 9: Install Arch Linux Base System

Now, it’s time to install the Arch Linux base system.

pacstrap /mnt/ base linux linux-firmware net-tools networkmanager openssh vi

The installation will take at least 15 to 30 minutes to complete depending upon your internet speed.

The below message confirms that the Arch Linux Installation has been completed successfully.

Arch Linux Installation Completed
Arch Linux Installation Completed

Step 10: Create fstab

After the base installation, generate the fstab file for the system using the genfstab command.

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

Verify the fstab entries using the below command.

cat /mnt/etc/fstab
Generate fstab Entries
Generate fstab Entries

Step 11: Arch Linux System Configuration

To configure Arch Linux further, you must chroot to the new system. The chroot changes the root directory for the current running process, and their children

arch-chroot /mnt

Step 12: Set System Language

You can configure the system language by uncommenting the required languages from /etc/locale.gen file.

vi /etc/locale.gen

Uncomment en_US.UTF-8 UTF-8 for American-English and then generate locales by running.

locale-gen

Set the LANG variable in /etc/locale.conf file.

echo "LANG=en_US.UTF-8"  > /etc/locale.conf

Step 13: Set Timezone

Now, configure the system time zone by creating a symlink of your timezone to the /etc/localtime file.

ln -sf /usr/share/zoneinfo/US/Central /etc/localtime

All the available timezones are found under /usr/share/zoneinfo directory.

Also, set the hardware clock to UTC.

hwclock --systohc --utc

Step 14: Set Hostname

Place the system hostname in /etc/hostname file.

echo "archlinux-2021.itzgeek.local" > /etc/hostname

Step 15: Set root password

Use the passwd command in the terminal to set the root password.

passwd

Step 16: Install GRUB Boot Loader

Arch Linux requires a boot loader to boot the system. You can install the grub boot loader using the below commands.

BIOS

pacman -S grub

grub-install /dev/sda

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

UEFI

pacman -S grub efibootmgr

grub-install --efi--directory=/efi

grub-mkconfig -o /boot/grub/grub.cfg
Install GRUB Boot Loader
Install GRUB Boot Loader

Step 17: Reboot

Exit from the chroot system and then reboot.

exit

reboot

Step 18: Login to Arch Linux

Once the reboot is complete, you would get the Arch Linux login prompt. Log in as the root user and the password you set during the os installation.

Arch Linux Login
Arch Linux Login

Conclusion

That’s All. You have successfully installed Arch Linux 2021. Follow the post-installation recommendations to get the most out of the installation.

You might also like