This beginner’s guide explains the steps on how to install Arch Linux.
Arch Linux is the most bleeding-edge Linux distribution that comes with options to customize everything as per your need. Installing and using Arch Linux is complex for new users. The Arch Linux documentation is one of the most comprehensive but it is sometimes too much for the beginner. Hence this guide to install Arch Linux in a step by step manner.
Note: This guide is for legacy BIOS systems only. For UEFI systems, the installation may vary.
Table of Contents
What you need before installing Arch Linux?
Make sure you have the following list sorted before you install Arch Linux.
- Arch Linux .iso file [download link below]
- USB drive with 2GB or more space
- Stable internet connection
- Know the basic Linux commands and comfortable with the terminal
- A spare laptop/desktop/mobile phone with internet in case you are stuck need help from the internet.
How to Install Arch Linux
Download Arch Linux .iso
You can visit the below page to download Arch Linux. There are torrent files which is a recommended method of downloading the Arch Linux .iso file.
Create a LIVE USB and boot
Write the downloaded Arch Linux .iso image to a USB drive. If you are planning to install it on a virtual machine, then you can skip this step. If you want to install it on Virtual Machine, check out GNOME Boxes or Virtual Machine Manager for an installation guide before you proceed.
If you are using Ubuntu, then you can use the Disks utility to write the .iso image to the drive. Or you can use any utility to create a LIVE USB.
Alternatively, if you are comfortable with the command line you can use the below command to create a LIVE USB for Arch Linux. Change the sdb
to your USB drive number.
Example:
dd bs=4M if=/home/Downloads/archlinux-2020.11.01-x86_64 of=/dev/sdb status=progress && sync
Boot from the Arch Linux LIVE USB
Boot from LIVE USB to install. After a successful boot, you should see the Arch Linux menu. Select the “Arch Linux Install Medium”.
You should be seeing the terminal with the LIVE Arch Linux.
Setup Keyboard Layout
You need to set the keyboard layout if you want as a first step. By default, the US keyboard layout is chosen. You can check the locale using the below command.
To list the available list of keyboard layout use:
ls /usr/share/kbd/keymaps/*/.map.gz
Then load the appropriate layout:
loadkeys <keymap name>
For example, replace <keymap name> with “fr-latin1.map.gz”.
If you are using English US as default, you should skip this step.
Connect to the Internet
First, run a ping to check whether you are already connected.
ping google.com
If not, then check out the Arch Linux networking guide to set up the wired/wireless connection. As I mentioned earlier, to install Arch you need a stable internet connection.
Run the below command to enable the installer to sync time via the internet.
timedatectl set-ntp true
Partition the disk for install
The next step would be partitioning your disk to install Arch Linux. Use this step very carefully as this causes direct writing to your disk and all data would be lost.
If you are not comfortable, you can exit from this step. Then take a backup of all your files and come back.
First list the drives that are available using fdisk.
fdisk -l
This might be different in every system. This will list the available partitions table in your current disk.
The next step is to use cfdisk
– a partition tool with UI to help you to partition the drives. For this guide, I will create one installation partition and a swap partition for Arch Linux. Remember, the cfdisk utility uses arrow keys and enter keys for navigation.
cfdisk /dev/sda
On the next screen choose “dos” as label type.
The selected device partition list displays on the next screen. For this example:
In this screen, I will create two partitions using the free space. One is for installing Arch Linux and another for the swap area. Note down the free space to allocate numbers. The swap area ideally should be twice your device RAM size.
Highlight New at the bottom and press enter.
For this example, I will use 5GB for Arch Install and 1GB for the swap. You can mention the size in G or M for GB and MB respectively.
Next, choose as a primary partition for Arch Linux.
You can see the partition is created as /dev/sda1 with 5GB space.
Now, select free space again and create a new primary partition. Enter space as 1G. You can change this size as per your need.
Select the swap partition and choose type. From the type, list choose ’82 Linux Swap / Solaris’ and press enter.
Both the partition is now created.
From the bottom, choose to Write to make the changes to the disk. After a successful operation, you will see a message as below.
You can also run fdisk -l
to check the partitions which are created.
Create file system and mount
The newly created partitions need a filesystem. For this guide, I will use the ext4 format. Run below commands sequentially to create file systems.
Create an ext4 file system to the /dev/sda1
mkfs.ext4 /dev/sda1
create swap file system to /dev/sda2
mkswap /dev/sda2
Mount the root file system to /mnt
mount /dev/sda1 /mnt
Turn on the swap
swapon /dev/sda2
You need to change the “1” or “2” according to your disk numbers.
Install base system
The next step is to install the Linux base via pacstrap
. This step might require some time as pacstrap
downloads a list of packages required for a basic Linux kernel and additional applications.
pacstrap /mnt base linux linux-firmware nano
Configure the Arch Linux
As you installed the base packages, now its time to create the filesystem table
genfstab -U /mnt >> /mnt/etc/fstab
After creating the file system table, login as root to newly installed Arch Linux.
arch-chroot /mnt
You can run ls to check the installation directories. As you can see the base system is installed.
Configure Timezone
To configure the timezone run the below command. For example, to set US Eastern time, you can run:
ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime
Generate Locale File
The next step is to generate a locale file. This can be changed later as well, once you completed the installation. Run the below commands in sequence to generate a locale file.
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
Create a Hostname File and Enable DHCP
Install DHCP using the below command.
pacman -S dhcpcd
Create a hostname file for network connectivity in /etc/hostname. For example, the below commands create a “debug point” hostname.
echo debugpoint > /etc/hostname
Enter below lines in the /etc/hosts file. You can change the “debug point” to your own hostname.
127.0.0.1 localhost ::1 localhost 127.0.0.1 debugpoint
Make sure to enable the dhcp for internet connectivity by running below command.
systemctl enable dhcpcd
Generate root password
You need to create a root password to use the system. To do that use the below command and enter the first time password.
passwd
Create GRUB, boot loader
This is an important step. If you are using Arch in dual boot, not planning for dual boot it is recommended that you install the grub boot loader. Run below commands in sequence to install grub, os-prober, and configure grub. Remember to change the “1” or “2” below with your device number.
pacman -S grub os-prober grub-install /dev/sdX grub-mkconfig -o /boot/grub/grub.cfg
Reboot and login
All necessary steps are complete. You can type below exit command to go back to LIVE session. Then followed by reboot.
exit
reboot
If all goes well, you should see the Arch Linux grub menu and able to login into the terminal.
Remember, this installation process did not install any desktop environment. This is basic Arch Linux image with latest Kernel. To install desktop environment such as GNOME, Xfce, LXQt you need to run additional steps.
For example – if you want to install LXQt desktop – you can run the below command to install basic LXQt packages with desktop.
sudo pacman -S --needed lxqt xdg-utils sddm libpulse libstatgrab libsysstat lm_sensors network-manager-applet oxygen-icons featherpad smplayer pavucontrol-qt xscreensaver
I hope this guide helps you to install Arch Linux in a most easy eay. Drop me a comment below if you are stuck or in trouble.