How To Install Arch Linux: A Comfy 100% Arch Installation Guide

How To Install Arch Linux: A Comfy 100% Arch Installation Guide


Hi everyone, welcome to MusaBase! In this comprehensive, step-by-step Arch Linux Installation guide, we'll learn how to:

  • Make a bootable USB and log into Arch Live ISO
  • Create and format Arch Linux partitions
  • Successfully chroot into our new Arch environment
  • Base system installaion with Pacstrap and configure core services, such as setting timezone, locales, root password, user with SUDO privileges
  • Install and confgiure GRUB

By the end of this guide, you'll overcome common roadblocks and have a fully functional Arch Linux system running smoothly on our PC.







Prerequisites

Although Linux itself is a lightweight operating system, installing Arch Linux requires a solid understanding of the process. Since Arch Linux has a manual installation method, mistakes, such as accidentally formatting your hard drive can happen.
To avoid data loss, i strongly recommend testing the installation steps in Virtual Machine first. Once you're confident that everything works smoothly, you can proceed with installing it as your main OS.
Before continuing, ensure your system meets the following requirements.
I'll be using the Arch Linux official Installation guide for this walkthrough plus i am installing it on a UEFI system.

Minimum System Requirements:

  •   Ram: At least 512 MB, but 2 GB is recommended.
  •   Storage: At least 1 GB, but 20 GB is recommended for a complete setup.
  •   Processor: x86-64 compatible.
  •   Internet Connection: A good Working internet connection.
  •   USB drive: At least 2 GB of storage for creating a bootable installer.



Step 1: Acquire Arch Linux ISO & Creating a Bootable USB

You can use any USB bootloader utility, such as Rufus, Balena Etcher, or dd.
For this guide, I'm using Universal USB Installer (UUI) because it's lightweight and easy to use.


1.1. Download UUI:

Once you have downloaded and installed the tool, you will see the following window:


1.2. Download the Arch Linux ISO

  • Now, it's time to download Arch Linux ISO file. You can get it from the official Arch Linux website:
  • Download Arch Linux ISO

After visiting the website, you'll see a list of available ISO files. If you have a torrent client like uTorrent or qBittorrent, you can download the ISO using the torrent file. Simply click on the torrent link to initiate the download in your torrent client.
Alternatively, you can download the ISO file directly from your browser.


1.3. Creating Bootable USB for Arch Installation

Now, follow these steps to create a bootable USB drive for Arch Linux:

  • Run UUI and select your USB drive, You may need to prepare your USB for EFI booting, simply check the "Prepare this drive" option, and UUI will automatically apply the necessary adjustments.
  • Click on the second dropdown menu and select Arch Linux from the list of available options.
  • once Arch Linux is selected, provide the Arch Linux ISO file to UUI.
  • Finally, click the "Create" button. UUI will now start flashing the ISO onto your USB drive.

Visual Guide:
Refer to the following images for further clarification:




Step 2: Booting into the Arch Installer

To run linux or its installation media, you must disable Secure Boot in your system's BIOS. Follow these steps:


  • Enter BIOS/UEFI Settings: Restart your computer and access the BIOS/UEFI settings (usally by pressing F2,F12,ESC, or DEL during startup).
  • Disable Secure Boot: Locate the Boot Options section, disable Secure Boot, then save changes and restart your PC.
  • Access the Boot Menu: As your computer restarts, open the Boot Menu (same key as BIOS/UEFI or F8/F10 in some systems).
  • Select the USB Drive:Choose your bootable USB drive to launch the Arch Linux installer.



Step 3: Setting Up the installation Environmnet

Once you successfully boot into the USB, you will be seeing this screen:


  • Navigate the Boot Menu: Use your arrow keys to select the first option, that contains:   Arch Linux install medium (x86_x64, UEFI)  .
  • Press Enter, This will load the Linux installation files and automatically proceed to the installation screen.
  • It will load linux installation files and timeout. And it will show this screen:

The first thing we would want do here is check if our internet is UP and running.
Use "ping" command to test connectivity

ping archlinux.org

If you see a response with time values, your internet is working correctly:

Exit the Ping Command:

  • Press Ctrl + c to exit from running command.

For Wi-Fi Connection:
  • Run iwctl command. This command will open a prompt to manage network interfaces.
  • Run station list in the opened prompt, This will display a list of avaiable network interfaces.
  • Now type station wlan0 get-networks, This scans for available WiFi networks..
  • Look for WIFI SSID that resembles to yours.
  • After choosingthe SSID write "station wlan0 connect "YOUR_SSID_NAME"".
  • Enter your WIFI passowrd and connect

Make sure to check the "ping" command to check if you have connected to internet.




Step 4: Disk Partitioning using cfdisk

There are multiple ways to create partitions for Arch Linux, including fdisk, cfdisk, parted, gparted, etc. In this tutoiral, we'll use cfdisk, which provides a simple Curses-base interface.

  • Type cfdisk and press Enter.
  • Select GPT and press Enter.
  • After selecting the gpt label we would have the following screen:

Navigating cfdisk Interface

  • Use Up () & Down () Arrow keys to move between disk partitions.
  • Use Left () & Right () Arrow keys to navigate the options menu.

4.1. Creating the Boot Partition

  • Select [ New ] and press Enter.

We'll be prompted to specify the partition size. The boot partition should be between 512 MB and 1 GB, depending on your preference.

  • Type the desired size in digits.
  • Use capital G for Gigabytes (GB) or a capital M for Megabytes (MB).

For this guide, I am allocating 1 GB to the boot partition. While you can adjust this based on your requirements, it should not be less than 512 MB.


4.2. Creating the Swap Partition

This partition will be used by linux when it will run out of RAM.
In other words, The Swap partition acts as virtual memory when the system runs out of physical RAM.

  • Select Free space and press Enter
  • Follow the same steps as the boot partition to create the swap partition.
  • Allocate between 8 GB and 32 GB based on your system's needs.

4.3. Creating the Root Partition

Now, we will allocate the remaining disk space to the root partition.

  • Select Free space, which will be automatically be set to the remaining disk space. Press Enter.

4.4. Writing the Partition Table

Once you've created all your partitions, it's time to commit the changes by writing the new partition table to disk.

  • Use the Left & Right arrow keys to navigate and select [ Write ].It will open up a prompt asking if you want to write this partition or not.
  • Confirm by typing yes and pressing Enter.

At this stage, all partitions are successfully created, and the filesystem is now ready for data storage.
If everything went right then we should have our partitions structure like this:


4.5. Finalizing the Partition Setup

  • Select [ Quit ] from the menu to exit cfdisk and return to the Arch Linux terminal.



Step 5: Formatting Partitions

Now, we need to format each partition to their respective File System

  • Root partition: Will be formatted in EXT4 file system.
  • Boot partition: Will be formatted in EFI file system.
  • Swap partition: Will be formattd in SWAP file system.

5.1. Listing Storage Devices

  • Run lsblk, it will list out all connected storage devices.
lsblk
Device Type Purpose
loop0 Virtual device Disk image(e.g, ISO files)
sda Physical storage Main internal HDD/SDD
sr0 Optical drive CD/DVD-ROM
sdb USB flash drive External storage (auto-assinged after /dev/sda)

5.2. Formatting the Root Partition

First we will format the root partition, for me this is /dev/sda3.

  • We can use mkfs commmand to format each partition.
  • To format the root partition, run:
mkfs.ext4 /dev/sda3

5.3. Formatting the Boot Partition

Now we will format the boot partition, for me this is /dev/sda1.

  • To format the boot partition, run:
mkfs.fat -F 32 /dev/sda1

5.4. Setting Up the Swap Partition

The swap partition does not require formatting. Instead, we need to initialize it as a swap area, for me the this partition is /dev/sda2

  • To make a swap partition, simply run:
mkswap /dev/sda2

With these steps completed, all parititons are now properly formatted and ready for the next stage of the Arch Linux installation (Mounting Partitions).




Step 6: Mounting Partitions

Now that we have created and formatted our partition to the Linux filesystem, it's time to mount them so we can proceed with the installation. In the live ISO, we'll mount each partition at a temporary directory /mnt.

6.1. Mount the Root Partition

First, we will mount the root partition, for me this is /dev/sda3

  • To mount the root partition, run:
mount /dev/sda3 /mnt

6.2. Mount the Boot Partition

Next, we'll mount the boot partition. However, the /boot/efi directory does not exist in our root partition yet. We need to create it first.

  • To create the directory, we need to run mkdir:
mkdir -p /mnt/boot/efi


Now that we have created the boot directory, let's mount the boot partition.

  • To mount the boot partition, run:
mount /dev/sda1 /mnt/boot/efi

6.3. Enabling the Swap Partition

Next, we'll turn on the swap partition, we don't have to mount it anywhere we just have to turn it on, for me this is /dev/sda2

  • To turn on the swap partition, run:
swapon /dev/sda2

6.4. Verifying the Partition Structure

  • To ensure we have created the correct structure for the Linux filesytem, type:
lsblk

Press Enter and it should be displaying the structure like this:




Step 7: Installing the Base System

Arch Linux provides the pacstrap script to install essential packages into the root filesystem of a new installation.

7.1: Installing Linux Firmware and Base Packages

  • To install the Linux firmware and base packages necessary for managing the OS, run:
pacstrap /mnt base linux linux-firmware sof-firmware base-devel grub
efibootmgr nano networkmanager

It can take upto 5 or 10 minutes depending on the speed of your internet connection.

The above command will:

7.2: Resolve Common Errors

If you hit any error while downloading packages from pacstrap then try one of the following methods:

7.2.1: PGP Signature Error ("Invalid or Corrupted Packatge")

If you hit any error realted to unknown trust such as:

invalid or corrupted package (PGP signature)
signature from "Foo <foo@archlinux.org>" is unknown trust"

This usually happens beacuse of out-dated keyring, we just need to reinitialize it by running these commands:

pacman -Sy archlinux-keyring
pacman-key --init
pacman-key --populate archlinux

7.2.2: System Clock Error

  • Incorrect time makes valid signatures appear expired or invalid.
  • If your system clock is not synced with your region then the "invalid signature" error would still occur even after trying the pacman-key --init method.
  • To fix this run:
timedatectl set-ntp true
hwclock -w
  • After syncing your system clock, run keyring update again.

7.2.3: Mirror or Network Download Failures

  • This error usually occurs when there's a:
    • A Bad Internet Connection
    • Proxy Misconfiguration
    • Outdated Mirror List
failed to retrieve some files
download library error
Connection timed out after 10000 milliseconds
404 or certificate errors during download

Its either because of faulty network connection or proxy or an an outdated or slow mirror list.

Verify Internet Connection:
  • Start by checking the network connection is up and running:
ping archlinux.org

Clear Proxy Variables
  • Just for pre-caution clear all related variable by running:
unset \
http_proxy https_proxy ftp_proxy rsync_proxy \
HTTP_PROXY HTTPS_PROXY FTP_PROXY RSYNC_PROXY

Refresh and Optimize the Mirror List with Reflector
  • A fast, up-to-date mirror list is important. Use Reflector to automate this process.
  • Install or update Reflector in live environment by running:
pacman -Sy reflector
  • Optional: Back-up any exisiting mirror list:
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
  • Next, generate a fast, new mirror list using HTTPS, by sorting speed and selecting recent synchronization:
reflector --latest 20 --protocol https --sort rate --save /etc/pacman.d/mirrorlist

7.3: Update Pacman and Re-run Pacstrap

  • Next, refresh the package databases by running this command:
pacman -Syy
  • Finally, retry the pacstrap installation:
pacstrap /mnt base linux linux-firmware sof-firmware base-devel nano grub efibootmgr networkmanager



Step 8: Generating the File System Table or fstab

During the installation, we manually mounted the partitions at /mnt, but these mounts are temporary. Now, we need to retrieve the filesystem information from these temporary mounts and store it in a configuration file. This ensures that the system automatically mounts these partitions at every startup, allowing Linux to locate its files and data properly.
Genfstab is a Bash script that is used to automatically detect all mounts under a given mountpoint, its output can then be redirected into a file, usually /etc/fstab.

  • To fetch the filesystem, run:
genfstab /mnt

At this point, we can see the mounted filesystems listed in the terminal. However, we don't need this output displayed on the terminal, we need to save it to a file instead.

  • To store the mount information in an actual file, run:
genfstab /mnt > /mnt/etc/fstab

Now, the fstab content from the terminal is saved inside a file.

  • To verify that the filesystem table has been successfully stored in /mnt/etc/fstab, run:
cat /mnt/etc/fstab



Step 9: Chrooting or Change Root into the Installed System

Now, we need to switch the root directory of the current environment to the newly installed system's root directory (chroot).
Before installing any GUI or Desktop Environment, you must install and configure packages, set up system configuration file, install the bootloader, set the root password, and create a user account.

  • To change the current root to installed system's root, run:
arch-chroot /mnt

Note that when you change the root from the live installation environment to the installed system's environment, the shell prompt color will change.
Like this:

Now, you can install and configure the necessary components.




Step 10: Configuring The Base System

In the chroot environment, we need to configure several files necessary for the system and add a user account. Although you can use the root account with full access, it is not recommended until you are fully aware of the risks.The items to configure in the chroot include:

  • Setting Up Time Zone
  • Localization
  • Hostname
  • Root Password
  • Add a User and Granting sudo Privileges
  • User Password
  • Sudo Setup

10.1: Setting Up Time Zone

  • To set our timezone to localtime, run:
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
  • The acutal command would look like this:
ln -sf /usr/share/zoneinfo/Asia/Karachi /etc/localtime
  • To confirm that the time has been set correctly, run:
date
  • Next, synchronize the system clock by running:
hwclock --systohc

10.2: Localization

A locale is a set of parameters that defines your system's language, region, and cultural conventions. It includes settings for:

  • Language: The language used for system messages, menus, and user interfaces.
  • Character Encoding: How text is encoded (e.g, UTF-8, fr_FR.UTF-8).
  • Regional Conventions: Formats for dates, times, numbers, and currency.

  • To set your locale, run:
nano /etc/locale.gen

The above nano command will open the locale.gen file in the terminal from there we can set locale to our needs.

  • Nano will open up a file like this:

  • We can navigate this file with keybaord's arrow keys.
  • Select the preset you want and delete # from the line. It will uncomment that preset.

I am choosing en_US encoding for my system. But you can choose your preferred encoding.


  • Press ctrl + o to save the changes then press enter to apply changes.
  • To exit from nano editor press ctrl + x and it will exit you from nano editor.

  • Now we need to generate the locale we just uncommented.
  • To generate locale, run:
locale-gen

  • Now we have to specify the locale in the locale.conf file because some program would be using this file.
  • Run:
nano /etc/locale.conf

It will open up a empty text file, where we will specify our locale.


  • Type the locale preset in the locale.conf file like this LANG=en_US.UTF-8 or fr_FR.UTF-8 UTF8 depending on your locale and save the file.
LANG=en_US.UTF-8
  • Press ctrl + o to save the changes. And press Enter to apply the changes.
  • Now Press ctrl + x to exit from the file. It will exit you to terminal.

10.3: Hostname

The hostname is the name assigned to your system on a network, which helps identify your computer when communicating with other device.

  • To set the hostname for your system, run:
nano /etc/hostname

This may open an empty file. Type the desired hostname (for my system i am typing, MusaBase).


  • Type the hostname you want.
  • Press ctrl + o save changes then press Enter to apply changes.
  • Now to exit from hostname file press ctrl + x and it will exit you to terminal.
  • I am setting MusaBase hostname for my system.

10.4: Root Password

Now for security we need to set the root password.

  • The root user (superuser) has full control over system.
  • The root password is used to log in as root and perform administrative tasks.

  • To set root password, run:
passwd

After typing passwd command you will be prompted to enter and re-enter the password for the root user.
Make sure to use a strong password, as root has full system control.


10.5: Add a User with sudo Privileges

Adding a user with sudo privileges in Linux improves security by limiting direct root access and reducing the risk of accidental system damage, while also enabling controlled administrative access with auditability.

  • To add user run:
useradd -m -G wheel -s /bin/bash username

10.5.1: User Password

Now we have to set password for the user we just added.

  • Its really simple just run:
passwd username

10.5.2: Sudo Setup

Finally, set up sudo for the new user in the wheel group to allow controlled administrative access without directly using the root account. This improves security, prevents accidental system damage, and allows for auditability of privileged commands. Instead of logging is as root, the user can temporarily gain elevated privileges using sudo.

  • To do this, type:
EDITOR=nano visudo

It will open up a sudoers file in the terminal where we will make the changes.


  • Navigate to bottom with keyboard arrow keys.
  • Navigate until you find this line:
# %wheel ALL=(ALL:ALL) ALL

  • Use Del key or backspace to remove the # symbol.

  • Now Press ctrl + o to save the changes then press Enter to apply the changes.
  • Now to exit press ctrl + x and it will exit you to terminal.



Step 11: Updating System with User Account

Now that we have added sudo privileges for our new user, it's time to test some sudo operations to verify that the new user has the necessary permissions. First, we will change our user.

  • To change from root to the user we added, run:
su username

Now, we will run a simple update command using pacman.

  • Run:
sudo pacman -Syu

The above command will prompt you for your user's password, then update your system if any updates are available. If your system is already up-to-date, it will simply inform you that no updates are needed.
My system was missing some updates so the -Syu updated my system but you might not have to.




Step 12: Enabling Core Services

Before finally restarting the PC and logging into the installed system, we need to enable some core services, However, before enabling core services, we must exit from your user's shell prompt [username@archiso /] and return to the root shell prompt [root@archiso /].

  • To exit from user's shell prompt, run:
exit

Now, we will enable Core Services like:

  • Enabling Network Manager
  • Grub Bootloader.

12.1. Enable Network Manager

We'll use the systemctl command to ensure that the system can automatically manage network connections after reboot.

  • To enable NetworkManager, run:
systemctl enable NetworkManager

12.2. Grub Bootloader

GRUB (GRand Unified Bootloader) is a powerful and flexible bootloader used in Linux systems to manage the startup process. It loads the operating system kernel into memory and allows you to select between multiple OS installations. GRUB supports both UEFI and BIOS, offers a command-line interface, and can be customized for advanced boot configurations.

  • To Install GRUB, run:
grub-install /dev/sda
# OR
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB

Now that GRUB is installed, you also need to generate its initial configuration file.

  • To generate the GRUB config file, run:
grub-mkconfig -o /boot/grub/grub.cfg



Step 13: Rebooting

Now that all the steps are complete, we will exit the chroot environment and unmount all drives to prepare for rebooting into the newly installed Arch Linux Operating system.

  • To exit from chroot environment, simply run:
exit

Next, unmount all drives that are not in use before rebooting the system.

  • To unmount all non-busy drives, run:
umount -a

Finally, reboot the system. This will take you to the GRUB Bootloader, where you can select and boot into your newly installed Arch Linux operating system.

  • Type the following command to reboot:
reboot



Step 14: Boot into Freshly Installed Operating System

After rebooting, the system will load into GRUB Bootloader, and you will see the following screen:

Once you select Arch Linux, you will be greeted by Arch Linux's tty1 welcome screen, displaying your configured hostname:

At this point, enter the username and password you set during the user creation process, then press Enter.

After successfully entering your credentials, you will be logged into your Arch Linux distribution. You will then see the following screen:

Here you go, now you have a fully installed and minimally configured Arch Linux system running on your PC.




Afterwards:

If you wish to install a graphical environment, I recommend KDE Plasma with a SDDM. It is highly customizeable, lightweight, and user-friendly.

  • To install KDE Plasma & SDDM, run:
sudo pacman -S plasma sddm

The system may prompt you for your user's password. If so enter your password. The installation process will begin, downloading the base packages and dependencies required for KDE Plasma. Press Enter as needed to confirm the installation. Depending on your internet speed, this process may take 5 to 10 minutes.

Additional Applications

Installing only KDE Plasma is not enough, You will also need some basic applications to get started, such as a terminal emulator (Konsole), a text editor (Kate), and a web browser (Firefox).

  • To install these basic applications, run:
sudo pacman -S konsole kate firefox

Enable the SDDM

Now that KDE Plasma with SDDM and the necessary applications are installed, it's time to enable and start the SDDM.

  • Run:
sudo systemctl enable --now sddm

After a few seconds we would have the KDE Plasma Login Screen:

Enter your password here for your user. and after a few seconds, you will be logged into the Plasma desktop environment. From here, you can user your system like a regular desktop PC, installing applications either though Plasma's application manager or via the terminal.




Congratulations! You now have a fully functional Arch Linux system with the KDE Plasma desktop environmnet installed. Here are some suggestions for what to do next:

  • Customize Your Desktop: Explore KDE Plasma's extensive customization options to tailor your desktop to your preferences.
  • Install Additional Software: Use pacman or a graphical package manager to install more applications as needed.
  • Update Your System: Regularly update your system to ensure you have the latest security patches and software updates, Run update command from time to time.
sudo pacman -Syu
  • Explore Arch Linux Documentation: Arch Linux has excellent documentation. Visit the Arch Wiki for advanced configuration and troubleshooting.
  • Learn More About Linux and Implement: Dive deeper into Linux by exploring the terminal scripting, and system administration.

🎉 Congratulations, your Arch Linux setup is complete!

If this guide helped you, subscribe for more step-by-step tutorials.
1O1 out, I`ll see you in the next one!



Load comments