This easy yet comprehensive tutorial details how to install Arch Linux on your computer.
By Swapnil Bhartiya, CIO
Arch Linux is one of my favorite Linux-based desktop OSes. I have written at length why I use Arch Linux. If you want an OS that gives you complete control over your computing, Arch Linux is the one.
However, installing Arch Linux can be a daunting task. That’s why I wrote this tutorial. My goal is to present the installation process in a manner that is easy to understand and follow. You might also want to read the official Arch Linux Wiki for more in-depth information on Arch Linux.
This tutorial is for a single-boot Arch Linux installation on BIOS with MBR (master boot record). The installation will wipe all data from your hard drive, so please make a backup. I suggest using a dedicated SSD to install Arch Linux on your system, so that your data and OS are on separate physical storage devices. SSDs are much faster than traditional hard drives, and you can get a decent SSD for under $50.
If your wireless card needs extra drivers, you should use an Ethernet cable for the installation process.
Create USB of Arch Linux
First, download the latest iso of Arch Linux from the official site. You can use the “dd” utility if you are running macOS or Linux. Windows users can use rufus to create bootable a USB drive of Arch Linux.
Once you have the bootable drive ready, go to the BIOS settings of the target system and set it to use BIOS instead of UEFI, then plug in the USB and boot from it. You will boot into the command line interface or Arch Linux and see the following screen:
If you are using an Ethernet cable, skip the wireless configuration section and ping Google to check connectivity. If you plan to use wireless then run an “ip link” command to see if your wireless chip is detected. On my system the Ethernet displayed as “enp0s5,” and the wireless displayed as “wlp58s0.”
Let’s connect to the network using the wifi-menu tool (use the name of your wireless device in the command below):
That will open a dialogue box where you can use the arrow keys to select the network you want to connect to. Skip the step where you can name the profile and then enter the password for the network in the next dialog box.
Next, you should ping Google to check if it’s connected. If you are connected, you will get a positive output:
ping -c 3 www.google.com
Prepare the hard drive
There are many tools for partitioning, but I am using the “parted” tool for this tutorial. Run the “lsblk“ command to find the name of the storage devices. In my case its “/dev/sda.” Now open the “parted” tool:
Next, create an MBR partition table:
(parted) mklable msdos
And then create partitions:
(parted) mkpart primary ext4 1MiB 30GiB
(parted) set 1 boot on
(parted) mkpart primary linux-swap 30GiB 38GiB
The first step creates a root partition of 30GB, the second step sets the boot flag on this partition, and the third step creates swap partition of 8GB.
I won’t be creating a separate home partition, it will be created within root. Since I will also be installing more than one desktop environments on this system, I am allocating 30GB to root. You can choose as much space as you want for root. Make sure to use the endpoint of step one as the start point in step three. Once the partitioning is finished, exit the “parted” tool by typing “quit.”
Now check the newly created partitions with “lsblk” command, to make sure everything is as expected:
sda 259:0 0 477G 0 disk
--sda1 259:1 0 30G 0 part /└--ada2 259:2 0 8G 0 part [SWAP]
Here “sda1” is root and “sda2” is swap. Now we will format these partitions. I am using the “ext4” file system for root.
# mkfs.ext4 /dev/sda1
Then format the swap partition:
# mkswap /dev/sda2
# swapon /dev/sda2
Now mount the root partition:
# mount /dev/sda1 /mnt
Before we start installation, let’s choose the closest mirror for the repositories for the fastest download speed. Open the “mirrorlist” file with Nano editor:
# nano /etc/pacman.d/mirrorlist
Use arrow keys to highlight the URL of the desired mirror. Use Alt+6 to copy it and then paste it at the top of the list with Ctrl+U. Then save the file with Ctrl+o and close it with ‘Ctrl+x’.
Now we install the base packages:
# pacstrap -i /mnt base base-devel
Once all packages are installed, we will generate the “fstab” file. This is the file that stores info about the mounted storage devices (the command should be run only once):
# genfstab -U /mnt > /mnt/etc/fstab
Now “Chroot” into the newly installed system to configure it:
# arch-chroot /mnt /bin/bash
Setting up the boot-loader
There are many boot-loaders for Arch Linux, but I am using “syslinux” instead of grub as it gave me a lot of trouble on the Dell XPS 13. Next, install syslinux:
# pacman -S syslinux
And then run the following command to create entries for the boot menu:
# syslinux-install_update -i -a -m
We need to edit the syslinux config file to use the correct root partition:
# nano boot/syslinux/syslinux.cfg
Scroll down to find the section that lists entries for arch and archfallback. Replace “sda2” with the root partition of your system. After making those changes, my entries look like these.
Set the language and time zone
We have to now select the default language of the system. I am using US English. Run the following command:
# nano /etc/locale.gen
You will see a very long list of languages. Just uncomment the one that you need. I uncommented “en_US.UTF-8.” Save and close the file and then run the following commands, one by one:
Now create the root password by running the following command:
Once root password is generated, let’s create a user for our system.
# useradd -m -G wheel,users -s /bin/bash swapnil
Then create password for this user:
# passwd swapnil
Install Gnome and complete installation
Technically we have Arch Linux installed, but we still need some work. It’s time to choose the desired desktop environment. I will be installing Gnome as it’s easy to use and works great on HiDPI displays:
# pacman -S gnome gnome-extra
Now we need to install networking tools so you can manage network from GUI:
Our installation is complete, but we need to get out of the chroot environment:
Now unmount the root partition:
# umount -R /mnt
Restart your machine so you can boot into your brand new Arch Linux system:
Remove the USB drive when the system shuts down so that it can boot into the newly installed Arch Linux. If everything went well, you will see the Gnome boot screen. Congratulations, you are now an Arch Linux user. Welcome to the club!
If you have any questions, ask them in the comment section below.