This is a basic installation and set up guide for Arch. Before we getting in to the setup, her’s a simple intro. Arch is a DIY GNU/Linux distro which allows you to customize the system as you wish! It supports the x86-64 architecture. Below is a general architecture diagram for the base linux subsystem setup (this will help visualize the setup steps ):
Installation Methods
We can set up Arch Linux:
With a guided installer like archinstall (tried by me) The installer is released as a part of the official ISO images since 2021. This is a python library can be downloaded via pip or ran using git. Other guided installers: archfi, and Anarchy
Without the guided installer This is the default installation method and requires you to manually configure all the components as per the official guide.
Arch Modes
As I understand, based on the firmware and disk partitioning - Master Boot Record (partition table) and GUID Partition Table, we have different modes to set up Arch. Here’s a quick overview below:
- Legacy/BIOS Mode
- BIOS is short for Basic Input-Output system. It’s low-level software that resides in a chip on your computer’s motherboard.
- The BIOS loads when your computer starts up. The BIOS goes through a POST, or Power-On Self Test, before booting your operating system. It checks to ensure your hardware configuration is valid and working properly. If something is wrong, you’ll see an error message or hear a cryptic series of beep codes. When your computer boots—and after the POST finishes—the BIOS looks for a Master Boot Record or MBR, stored on the boot device and uses it to launch the bootloader TLDR; BIOS is responsible for waking up your computer’s hardware components, ensures they’re functioning properly, and then runs the bootloader that boots Windows or whatever other operating system you have installed.
- The traditional BIOS still has serious limitations. It can only boot from drives of 2.1 TB or less. 8 TB drives are now common, and a computer with a BIOS can’t boot from them. That limitation is due to the way the BIOS’s Master Boot Record system works.The BIOS must run in 16-bit processor mode, and only has 1 MB of space to execute in. It has trouble initializing multiple hardware devices at once, which leads to a slower boot process when initializing all the hardware interfaces and devices on a modern PC.
- UEFI Mode
- The Unified Extensible Firmware Interface (UEFI, successor of the EFI) is an interface between operating systems and firmware. It provides a standard environment for booting an operating system and running pre-boot applications. Developed in 2007, UEFI replaces the traditional BIOS on PCs.
- This new standard avoids the limitations of the BIOS. The UEFI firmware can boot from drives of 2.2TB or larger—in fact, the theoretical limit is 9.4 zettabytes. UEFI uses the GPT partitioning scheme instead of MBR. It also boots in a more standardized way, launching EFI executables rather than running code from a drive’s master boot record.
- UEFI can run in 32-bit or 64-bit mode and has more addressable address space than BIOS, which means your boot process is faster.
- UEFI is packed with other features. It supports Secure Boot, which means the operating system can be checked for validity to ensure no malware has tampered with the boot process. It can support networking features right in the UEFI firmware itself, which can aid in remote troubleshooting and configuration. With a traditional BIOS, you have to be sitting in front of a physical computer to configure it.
- Check this out if you want to know the specifics regarding UEFI mode in Linux: https://www.happyassassin.net/posts/2014/01/25/uefi-boot-how-does-that-actually-work-then/
Note: The official installation image does not support Secure Boot (FS#53864). Secure Boot support was initially added in archlinux-2013.07.01-dual.iso
and later removed in archlinux-2016.06.01-dual.iso
. At that time prebootloader was replaced with efitools, even though the latter uses unsigned EFI binaries. There has been no support for Secure Boot in the official installation medium ever since.
In order to boot an installation medium in a Secure Boot system, you will need to either disable Secure Boot or modify the image in order to add a signed boot loader. Archboot images provide a way to use secure boot on installation media.
In this article, I’ll go over the setting up Arch Linux without the guided installer on Virtual Box.
FYI- I’m setting Arch on a VirtualBox VM in UEFI mode with GUID Partition Table (GPT) partition. I will add details regarding setting up for BIOS/legacy mode and MBR partition details but may not have the screenshots.
If you’re setting it up on your machine:
- Please create a live USB of Arch Linux to set up and then follow the guide from #6.
- Disable Secure Boot or modify the official ISO image accordingly.
Pre- Installation Steps
- Download and setup VirtualBox from the official site
- Download the official ISO image and the ISO PGP signature from Arch Linux official site
- Before the installation we’ll verify the acquired ISO image using GnuPG. Digital signatures are used to ensure that you get an exact copy from the original packager and not a malicious version from a compromised site. OpenPGP programs such as GPG/GnuPG are used to sign and verify those packages.
gpg --keyserver-options auto-key-retrieve --verify archlinux-version-x86_64.iso.sig
Substitute ‘archlinux-version-x86_64.iso.sig’ with the name of the ISO PGP Signature file.
The output should have Good Signature mentioned similar to the below screenshot:
- Create the VM on VirtualBox with the below specifications:
- Create a new machine and name it Arch Linux.
- Specify the path to the downloaded Arch Linux ISO.
- Choose base memory as 1024 MB (default)
- Assign 1GB of RAM (default). If you have the RAM, you can allocate 2GB.
- Enable the UEFI mode.
- Create a virtual hadisk (VDI) and allocate20GB.
- Click Create.
- Click start to run the VM and press enter to choose Arch Linux Install Medium (x86_64, x64 UEFI). This is the first option. If you’re setting up Arch in legacy/BIOS mode, it should show as Arch Linux Install Medium (x86_64, x64 BIOS)
- For enabling/setting up the internet. If you use a wired connection, it is usually picked up automatically. As I’m setting it up on a VM, it was picked u automatically. To check connection to the internet, we’ll use ping command:
ping -c 3 google.com
Wi-Fi requires some additional settings. For Wi-Fi, we’ll use iwctl
:
iwctl
...
Output:
#iwctl
[iwd]#
Command to get your system’s wireless device name
[iwd]# device list
...
Output:
[iwd]# device list
#You should see something like this:
Devices
--------------------------------------------
Name Address Powered Adapter Mode
--------------------------------------------
wlan0 ... on ... ...
To get the list of WiFi networks, run the below command. Replace wlan0
with your device name on the below command and all the following commands.
station wlan0 get-networks
...
Output:
[iwd]# station wlan0 get-networks
#You should see something like this:
Available Networks
--------------------------------------------
Network Name Security Signal
--------------------------------------------
TP-Link_8DAB psk *****
dlink wep *****
To connect to the WiFi network, run the below command with the WiFi access point name from the above “get-networks” command. Enter your WiFi password when prompted.
station wlan0 connect
...
Output:
[iwd]# station wlan0 connect
#You should see something like this:
Type the network passprahase for TP-Link_8DAB psk.
Passphrase: *******
Exit the iwctl
using exit
or Ctrl+C and test the connection again using ping
command.
- Now moving to Partitions! For partitioning the disks, we’ll use command line based partition manager- fdisk
- When recognized by the live system, disks are assigned to a block device such as
/dev/sda
,/dev/nvme0n1
or/dev/mmcblk0
. To identify these devices, use lsblk or fdisk.
fdisk -l
Results ending in rom
, loop
or airootfs
may be ignored. mmcblk*
devices ending in rpbm
, boot0
and boot1
can be ignored.
- Check if you have UEFI mode enabled using this command:
ls /sys/firmware/efi/efivars
If this directory exists, you have a UEFI enabled system. You should follow the steps for UEFI system.
- If you already have a partition table, skip this step. If your hard drive is brand-new as in the case of a virtual machine or you want to re-partition your hard drive, run this command to create a new partition table:
cfdisk /dev/sda
Steps to follow for UEFI with GPT: In the label type window, select GPT. ss for gpt Example layout for 20 GB Disk Size which I’m following
Mount Point | Partition | Partition Type | Suggested Size |
---|---|---|---|
/mnt/boot | /dev/_efi_system_partition | EFI Partition System | 512MB |
[SWAP] | /dev/swap_partition | Linux Swap | 9.5GB |
/mnt | /dev/root_partition | Linux x86 Root (/) | 10GB |
Use the arrow keys and enter to create 3 partitions with cfdisk
:
- /dev/sda1 # choose 512Mb of space (UEFI)
- /dev/sda2 # choose at least 10 GB of space (root)
- /dev/sda3 # choose all the left space (home)
Write the table to your hard drive and quit.
Steps to follow for BIOS with MBR: Example layouts for 20 GB Disk Size.
Mount Point | Partition | Partition Type | Suggested Size |
---|---|---|---|
[SWAP] | /dev/swap_partition | Linux Swap | 10GB |
/mnt | /dev/root_partition | Linux x86 Root (/) | 10GB |
If you do the legacy installation, skip the step of UEFI formatting because you should not have the UEFI partition.
Use the arrow keys and enter to create 2 partitions with cfdisk
:
- /dev/sda1 # choose at least 10 GB of space (root)
- /dev/sda2 # choose all the left space (home)
Write the table to your hard drive and quit.
Mount the partitions:
#For UEFI partition:
mkfs.fat -F32 /dev/sda1
#For non-UEFI partitions:
mkfs.ext4 /dev/sda2
#For Swap partition
mkswap /dev/sda3
- Mount the filesystems:
#Mount the root volume to `/mnt`:
mount /dev/sda2 /mnt
#For UEFI systems, create new dir /mnt/boot and mount the EFI system partition:
mount --mkdir /dev/sda1 /mnt/boot
#For Swap volume,
swapon /dev/sda3
- Configuring Reflectors
Packages to be installed must be downloaded from mirror servers, which are defined in /etc/pacman.d/mirrorlist
. On the live system, after connecting to the internet, reflector updates the mirror list by choosing 20 most recently synchronized HTTPS mirrors and sorting them by download rate. The top mirror is chosen automatically and it may not always be a good choice. Let’s update to ensure we have good mirror list available.
# Install reflector to update the list of fastest mirrors located in your country:
pacman -Sy reflector
#Make a backup of mirror list (just in case):
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
#Get the mirror list and save it
reflector -c "India" -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist
Woohoo! We’re done with all the pre-installation steps :)
Installation Steps
Using the pacstrap script we’ll install the base package, Linux kernel and firmware for common hardware.
I’m also adding nano
editor (you can use vim or anyother editor) and sudo
(short for super user do)
pacstrap -i /mnt base linux linux-firmware sudo nano
Let’s move to configuring the system!
Configure the system
- Generate the fstab file
The fstab file can be used to define how disk partitions, various other block devices, or remote file systems should be mounted into the file system. You can type genfstab -help
to see the options available and it’s description.
One can use genfstab
to generate fstab entries for mounted partitions given a filesystem root. This can be useful when installing and that’s what we’ll do.
There are different ways to identify file systems that will be mounted in /etc/fstab
: kernel name descriptor, file system label and UUID, and GPT partition label and UUID for GPT disks. Kernel name descriptors should not be used, while UUIDs or PARTUUIDs should be preferred over labels because:
- Labels have to be unambiguous to prevent any possible conflicts.
- Labels can be up to 16 characters long.
- Since the label is a property of the filesystem, it is not suitable for addressing a single RAID device persistently.
Thus, we’ll generate an fstab file using UUIDs as identifiers. We’ll use -U
which specifies that you want to generate the output based on a volume UUID.
So genfstab -U /mnt
will output all current mounts under the /mnt
mount point. We can save that output to the /mnt/etc/fstab
file using the >>
operator.
genfstab -U /mnt >> /mnt/etc/fstab
chroot
(change root) to the installed system Changing root is commonly done for performing system maintenance on systems where booting and/or logging in is no longer possible. Common examples are:
- Reinstalling the boot loader.
- Rebuilding the initramfs image.
- Upgrading or downgrading packages.
- Resetting a forgotten password.
- Building packages in a clean chroot.
Now using arch-chroot we’ll enter the mounted disk as root.
# arch-chroot /mnt
- Set locale
To set the localization, you will have to work in
nano
editor.
Run command to open file in the editor:
nano /etc/locale.gen
In the file find the language you are going to use and uncomment it by removing #
. In my case, I am going to install English (en_US.UTF-8 UTF-8).
You can either manually do it or activate the search option using the shortcut Ctrl + W. Press Ctrl+O Enter to save and Ctrl+X Enter to exit the editor.
Run command to generate the locale:
locale-gen
Finally, Create the locale.conf file, and set the LANG variable accordingly:
echo "LANG=en_US.UTF-8" > /etc/locale.conf
- Set the time zone by creating a symbolic link A symbolic link, also known as a symlink or soft link, is a special type of file that points to another file or directory. Symbolic links are commonly used to create shortcuts or aliases for files or directories located in the file system.
# Run command to get details about all the zones:
ls /usr/share/zoneinfo/
#Run command to create the link:
ln -sf /usr/share/zoneinfo/Asia/Calcutta/etc/localtime
# Run hwclock to set the local time on the system:
hwclock --systohc --utc
- Set hostname
Hostname is basically the name of your computer on the network. I’m name it arch
but you can choose whatever you want. Use the following command:
echo arch > /etc/hostname
Local host name resolution is provided by nss-myhostname
(an NSS module provided by systemd) without having to edit /etc/hosts
file. It is enabled by default.
But some software may still read the /etc/hosts
file directly. So let’s edit /etc/hosts
file in nano and add the following lines to it:
nano /etc/hosts
Add these lines at the end of the file:
127.0.0.1 localhost
::1 localhost
127.0.1.1 arch
If you use a static IP address, replace 127.0.1.1
with your static IP address given by the Internet provider. Press Ctrl+O Enter and Ctrl+X Enter to save and exit the editor.
- Configure the network
We’ll use
NetworkManager
package:NetworkManager
is a network management tool that provides easy automatic connection to the Internet. NetworkManager manages your network interfaces, detects available connections and automatically connects network devices when connections for the device become available. In practice, NM provides “set it and forget it” functionality—after connecting to a network on a given network interface, NM remembers the connection and will automatically connect you in the future (unless you disable automatic connection, of course). Thenetworkmanager
package contains a few things: theNetworkManager
daemon itself, thenmcli
command line interface, and thenmtui
and a text user interface. To install the package, we’ll use the package managerpacman
:
pacman -S networkmanager
Since Automatic network configuration is accomplished using Dynamic Host Configuration Protocol (DHCP). The network’s DHCP server provides IP address(es), the default gateway IP address(es) and optionally also DNS name servers upon request from the DHCP client. We’ll use systemd-resolved
for DNS resolution which NetworkManager can then use for DNS resolution, i.e. converting human-readable domain names into computer-friendly IP addresses.
# Check service status
systemctl status systemd-resolved.service
# If the service is not active and running, enable and start it
systemctl enable --now systemd-resolved.service
- For wired internet connection, Enable NM using :
systemctl enable NetworkManager
- For WiFi connection: First enable Wi-Fi and list available wireless networks:
# Ensure Wi-Fi is enabled
nmcli radio wifi
...
Output:
nmcli radio wifi on
# List available Wi-Fi networks
nmcli device wifi list
...
Output:
BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY
AA:11:BB:22:CC:33 MyCoolNetwork Infra 6 230 Mbit/s 95 ▂▄▆_ WPA2
DD:44:EE:55:FF:66 AnotherNetork Infra 6 195 Mbit/s 90 ▂▄▆_ WPA1 WPA2
GG:77:HH:88:II:99 FooBarNetwork Infra 6 175 Mbit/s 85 ▂▄▆_ --
Identify your desired network’s SSID, and connect as follows:
# Specify network SSID and password (for secured networks)
nmcli device wifi connect {SSID} password [password]
...
Output:
#Secured Network
nmcli device wifi connect 'MyCoolNetwork' password 'my_secure_password'
# Unsecured networks don't need a password
nmcli device wifi connect 'FooBarNetwork'
- Set the password for root user
The
passwd
command lets you change the password for a user. By default it affects the current user’s password which is theroot
right now.
passwd
You’ll have to type the password twice. It will not show when you’re typing, not even as *****
- Add a non-root user: Using your Linux system as the root user for long is not a good idea so creating a non-root user is important. To create a new user, execute the following command:
useradd -m -G wheel bhavs
The useradd
command lets you create a new user.
-m
option indicates that you also want it to create the corresponding home directory. The -G
option will add the new user to the wheel
group which is the administration user group in Arch Linux.
Now you can use the passwd
command once again to set the password for the newly created user:
passwd bhavs
Finally, you’ll have to enable sudo
privilege for this new user. To do so, open the /etc/sudoers
file using nano. Once open, locate the following line and uncomment it:
# %wheel ALL=(ALL) ALL
This file essentially means that all users in the wheel
group can use sudo
by providing their password. Save the file by hitting Ctrl + O and exit nano by hitting Ctrl + X. Now the new user will be able to use sudo
when necessary.
- Installing the microcode: Processor manufacturers release stability and security updates to the processor microcode. These updates provide bug fixes that can be critical to the stability of your system. Without them, you may experience spurious crashes or unexpected system halts that can be difficult to track down.
PS- In virtual machines and containers, the microcode updates belongs on the host, not in the guest system.
To acquire updated microcode, depending on the processor, install one of the following packages:
- amd-ucode for AMD processors,
- intel-ucode for Intel processors
# for amd processors
pacman -S amd-ucode
# for intel processors
pacman -S intel-ucode
- Install and configure the bootloader:
A boot loader is a piece of software started by the firmware (BIOS or UEFI). It is responsible for loading the kernel with the wanted kernel parameters and any external initramfs images. There are several bootloaders you can install on Arch Linux. I recommend the GRUB bootloader which is built-in and supports both UEFI and BIOS. It is the most popular, highly configurable and easy to use bootloader.
- For UEFI:
#Install the GRUB bootloader and EFI boot manager packages:
pacman -Sy grub efibootmgr
# The mkdir command creates a directory called `efi` inside the `/boot` directory. After creating the directory, we'll mount the EFI system partition in that directory:
mount --mkdir /dev/sda1 /boot/efi
# Check if everything is mounted correctly:
lsblk
#Install GRUB in the newly mounted EFI system partition:
grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi --removable
#The grub-mkconfig command generates the GRUB configuration file and saves it to a given target location- /boot/grub/grub.cfg
grub-mkconfig -o /boot/grub/grub.cfg
- For BIOS:
#Install GRUB:
grub-install /dev/sda
#The grub-mkconfig command generates the GRUB configuration file and saves it to a given target location- /boot/grub/grub.cfg
grub-mkconfig -o /boot/grub/grub.cfg
- Install Desktop Environment:
To run programs with graphical user interfaces on your system, you’ll have to install an X Window System implementation and Audio. The most common one is xorg
. I’ve also added virtualbox-guest-utils
since I’m setting up Arch on a VM.
pacman -Sy pulseaudio pulseaudio-alsa xorg xorg-xinit xorg-server virtualbox-guest-utils
Now that you’ve installed Xorg, you’re ready to install a desktop environment. Arch Linux supports a long list of desktop environments like GNOME, Plasma, XFCE etc. I’m installing GNOME in this guide.
# Install GNOME package
pacman -Sy gnome
#Enable the GDM or Gnome Display Manager service
systemctl enable gdm
- Final Step: Reboot
#First come out of the Arch-Chroot environment:
exit
#Unmount the root partition to make sure there are no pending operations:
umount -R /mnt
#Reboot the machine:
reboot
Wait until you see the GRUB menu. Choose Arch Linux from the list and wait until the system finishes booting up.
Arch Linux (Minimal) Installation is done! Congratulations!! Reminder- This is a very minimal installation. From this point, you can install what you want and configure your Arch Linux as you want. If you have any queries, check out the Arch Linux forums.