How To install Arch Linux: Installation and post-installation

TechVio
11 min readDec 20, 2021

--

Arch Linux is an independent operating system, it’s based on GNU/Linux, it’s minimal, modern, lightweight, and simple, but the installation process is quite painful and complicated for new Linux users.

There are scripts to automate that for very new Linux users, there are even GUI installers, but why not try the hard way? Trust me, it’s so funny, so what are we waiting for, let’s get started.

By following this installation process, I assume that you have background knowledge about GNU/Linux tools, and I assume that you have used Linux at least once, if you are new, just use Ubuntu, it’s a great start, proceed at your own risk, to stay safe, I recommend try the installation in a VM, if it works, then you can apply it to your system, if not, then don’t do it yet, research about the problem, and try to fix it in a VM.

Pre-Installation:

Download Arch ISO file from the original website

Go to the Arch Linux download page here, and download the latest ISO version, you can use either the BitTorrent download it which I recommend, or just use the direct HTTP download, it is recommended to check the integrity of the ISO file to ensure your security.

Burn The ISO file into a storage medium

After downloading the ISO file and checking its integrity, now it’s time to burn it into a storage medium, you can use whatever you have, like USB, CD/DVD, but I recommend using a USB, there are a lot of tools that you can use like Rufus for Windows or BalenaEtcher for Linux.

Installation:

Boot into the live environment

After setting up your installation medium, plug it into your PC, if using UEFI, disable secure boot.

After loading the system, you will see a terminal, you are now ready to get started

Check for boot mode

Before starting the installation, we need to know which boot mode your installation is in, to do that, you need to type this command:

ls /sys/firmware/efi/efivars

If you see some files, then you are running on UEFI boot mode, if the directory doesn’t exist, then you running on BIOS boot mode.

Check for internet connection

The installation will require an internet connection, you need to make sure that it’s running by pinging a website, you can do that by writing this command:

ping -c 4 8.8.8.8

If you see something like that:

64 bytes from 8.8.8.8: icmp_seq=1 ttl=117 time=49.4 ms

Then you are good to go.

Update the system clock

You need to synchronize your clock to keep it accurate, to do that, type this:

timedatectl set-ntp true

Disk partitioning

Now it’s time for real work, we need to partition our disk where we will install arch on it.

Warning: All data will be wiped, backup before starting this step

Before we start partitioning, we need to identify the disk, to do that, we need to type this command:

lsblk

You can identify your disk by it’s size, once you find your desired disk, check it’s name, this is an example from my PC:

sda      8:0    0 119.2G  0 disk

In my case, the disk name is sda, remember yours, you are gonna need it.

Also, make sure that your drive doesn’t have any partitions and empty.

Now it’s time for partitioning, type this command, but replace sda with yours, remember it ? We are gonna use cfdisk because it’s user-friendly, you can use whatever tool you want, it’s up to you:

cfdisk /dev/sda (replace it with yours)

You will see now a screen with multiple choices, if you are in UEFI boot mode, choose GPT, if you are in BIOS mode, choose MBR, I will explain about the difference between MBR and GPT in another post.

Partitioning for UEFI

If you are on BIOS boot mode, skip that.

After choosing labor type, you will see a screen like this:

In UEFI, we need to make 3 partitions, boot, root and swap partitions.

We are gonna start with the boot partition, press on [New], and give the partition 500M, after this, you will see that a new partition has been created, Press on [Type] and choose EFI System (it’s at the very top), if you see [Bootable], press it.

We are gonna now create swap partition, the order doesn’t matter, press the down arrow to choose the remaining free space, press on [New], and give the partition 1G, you can add more if you want, but it’s not that required, press on [Type] and choose Linux Swap.

We are gonna now create root partition;, again, the order doesn’t matter, press the down arrow to choose the remaining free space, press on [New], and give the partition the remainder of your drive space, press on [Type] and choose Linux filesystem.

The final result may look something like that, after that, press on [Write], confirm by writing yes, and press on [Quit].

Partitioning for BIOS

Skip if you are running on UEFI boot mode.

After choosing labor type, you will see a screen like this:

In BIOS, we need just 2 partitions, root and swap partitions

We are gonna start with creating swap partition, the order doesn’t matter, press on [New], and give the partition 1G, you can add more if you want, but it’s not that required, you will see that a new partition has been created, press on [Type] and choose Linux Swap.

We are gonna now create root partition;, again, the order doesn’t matter, press the down arrow to choose the remaining free space, press on [New], and give the partition the remainder of your drive space, press on [Type] and choose Linux filesystem, if you see [Bootable], press it.

After that, press on [Write], confirm by writing yes, and press on [Quit].

Important information

it’s important to remember each of those and which partition they represent.

What is the difference about partitioning in UEFI and BIOS (Skip if not interested)

Let’s explain what these partitions are doing:

Boot (EFI): This is where boot files are stored, in UEFI, these files are stored in a separate partition, while in BIOS they are integrated with the root partition.

Root: This is the main partition where the system will be stored in.

Swap: You can call it like a backup partition when RAM gets full.

In BIOS we need to make the entire root partition bootable, because the boot files are integrated with root partition, while in UEFI, we need to make the boot partition only bootable, as there where the boot files are stored independently, more explaining in another post if I can.

Formatting the partitions (UEFI)

If you are on BIOS, skip this.

Now it’s time to format our partitions.

Format root partition (/dev/sda3 in my case, it may be different depending from the order):

mkfs.ext4 /dev/sda3

Format and enable swap partition (/dev/sda2 in my case, it may be different depending from the order):

mkswap /dev/sda2swapon /dev/sda2

Format boot partition (/dev/sda1 in my case, it may be different depending from the order):

mkfs.fat -F 32 /dev/sda1

Formatting the partitions (BIOS)

If you are on UEFI, skip this.

Now it’s time to format our partitions.

Format root partition (/dev/sda2 in my case, it may be different depending from the order):

mkfs.ext4 /dev/sda2

Format and enable swap partition (/dev/sda1 in my case, it may be different depending from the order):

mkswap /dev/sda1swapon /dev/sda1

Mounting the partitions (UEFI)

If you are on BIOS, skip this.

We need to mount now our partitions.

Mount root partition (/dev/sda3 in my case, it may be different depending from the order):

mount /dev/sda3 /mnt

Mount boot partition (/dev/sda1 in my case, it may be different depending from the order):

mkdir /mnt/boot
mount /dev/sda1 /mnt/boot

Mounting the partitions (BIOS)

If you are on UEFI, skip this.

We need to mount now our partitions.

Mount root partition (/dev/sda2 in my case, it may be different depending from the order):

mount /dev/sda2 /mnt

Installing the base system

Now we are gonna install the base Arch Linux system, driver, and some essential tools into our root partition (intel-ucode: for intel users only, remove it if using AMD, and replace it with amd-ucode) (I will use nano for this tutorial, but I personally use vim, if you don’t know how to use vim, then DO NOT use it until you learn about it):

pacstrap /mnt base linux linux-firmware base-devel sudo grub efibootmgr networkmanager dhcpcd dhcp os-prober intel-ucode git nano

This may take a while depending on your internet speed.

Fstab

Now we need to generate an fstab file, so it will know where to mount the system at boot, to do that we are gonna type this command:

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

Chroot

We are gonna now move to our installed arch by chrooting into it, to do that we are gonna type this command:

arch-chroot /mnt

Timezone

We need to configure the timezone, to do that we are gonna type this command (Replace Values):

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

You may need to explore the zoneinfo directory and subdirectories to find your timezone.

Hardware clock

this will configure the hardware clock of the system, type this command:

hwclock --systohc

Localization

Edit /etc/locale.genusing nano:

nano /etc/locale.gen

Uncomment en_US.UTF-8 UTF-8 and other needed locales. after that, generate and configure the locale by running these commands:

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

Hostname

To setup your hostname, which is what identifies you in the network, you need to type this command (Replace Values, you can choose whatever name you want):

echo techvio > /etc/hostname

Hosts

To configure hosts, we need to edit /etc/hosts, to do that, type this command:

nano /etc/hosts

And add those (Replace techvio with your hostname):

127.0.0.1   localhost
::1 localhost
127.0.1.1 techvio.localdomain techvio

Enabling network

We need to enable the network in our system, to do that, we need to type these commands:

systemctl enable dhcpcd
systemctl enable NetworkManager

Specifying the root password

We are gonna need to setup the root password, you can do that by simply typing this command:

passwd

follow the steps shown in the terminal.

Configure GRUB bootloader

For the last step in our installation process, we are gonna configure the GRUB bootloader, to do that, you need to type these commands:

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

Reboot

You have now installed Arch Linux successfully, congratulations, all that you have is to write these commands to reboot into your system:

exitumount -R /mntreboot

log into the system

After the reboot, you will need to log to your system, simply type your username (root) and your password, we have just installed the base Arch Linux system, now it’s time to post-installation.

Post-installation

Now that we have installed the system, we are gonna do a process called post-installation, if you don’t know what post-installation is, it’s simply setting up a system after installing it, by installing drivers, desktop environment…

Setting up a user

Being the root all the time is actually a bad idea, you are risking your security by doing that, you can fix that by setting up a normal user for most of tasks, and use root when needed by using sudo, you can do that by typing these commands (replace techvio with your desired username):

useradd -m -G wheel -s /bin/bash techviosu techviopasswd

Adding the user to sudoers

To be able to operate task as root when needed using sudo, you need to add the new user to sudoers, you can do that by editing /etc/sudoers, if you are familiar with vim/vi, you can use the visudo command, this is safer, but if you are using nano, you need to type this command:

nano /etc/sudoers

Uncomment that line by removing #:

# %wheel ALL=(ALL) ALL

Save and exit, try if it’s working by using this command:

sudo su

Type your password, if you are a root user, then you have configured your user correctly, if not, and you see any error, then you have made a mistake in /etc/sudoers.

Installing yay

Arch Linux’s default package manager (pacman) is nice, but yay is much better, it’s an AUR (Arch User Repository) helper, to install it, follow these steps, you should not be a root in these steps:

1- Clone yay using git:

git clone https://aur.archlinux.org/yay.git

2- Go to yay directory:

cd yay

3- Build the package (write your password when prompted):

makepkg -si PKGBUILD

Now you have installed yay, you need to learn pacman basics as yay is based on it.

Install a desktop environment with some tools

Arch Linux by default comes with a desktop environment, nor tools, so we are gonna install them, we are gonna use KDE for this tutorial, but you can use whatever desktop environment you want, we are gonna also install some basic tools like a terminal, firefox, KDE apps…

yay -Sy plasma kde-applications firefox terminator xorg sddm enchant mythes-en ttf-liberation hunspell-en_US ttf-bitstream-vera pkgstats adobe-source-sans-pro-fonts gst-plugins-good ttf-droid ttf-dejavu aspell-en icedtea-web gst-libav ttf-ubuntu-font-family ttf-anonymous-pro jre8-openjdk languagetool libmythes vlc libreoffice aria2 gedit jre11-openjdk jre-openjdk p7zip unrar tar rsync thunderbird alsa pulseaudio pulseaudio-alsa alsa-firmware alsa-plugins pipewire pipewire-alsa alsa-lib alsa-tools pavucontrol pipewire-pulse pulseaudio-qt wayland plasma-wayland-session xorg-xwayland wayland-utils weston ufw

These are just some basic applications and drivers and desktop, if you want to install an application, you can use that with yay, here is a reference link for some applications from the ArchWiki.

Enable SDDM

We need now to enable SDDM at boot, we can do it by typing this command:

sudo systemctl enable sddm
SDDM Login

Reboot

This is the last step, after the reboot, you will boot into the desktop, you have now completely installed Arch Linux successfully, you can install applications when needed using yay package manager.

That’s it for today, thank you for reading this tutorial, I hope that you learned something, if you have any feedback, leave it in the comments, and don’t forget to follow us, you are supporting us by that, thank you.

--

--

TechVio

16 years old, IT hobbyist, cyber sercurity student, designer