Arch Linux Installation Guide

I once wrote a guide on installing Arch Linux, but that article had some issues and is now outdated. So, I decided to rewrite a more comprehensive and systematic guide that I hope will be helpful to all readers. While I've been using GNU/Linux for years and Arch Linux no longer fully meets my needs for simplicity and freedom, I still believe it's one of the best distros to recommend to beginners.

Before diving into the installation guide, let me first explain why Arch Linux doesn't meet my current requirements. If you choose GNU/Linux for greater freedom, you should consider the distributions recommended by the Free Software Foundation listed here, as Arch Linux doesn't fully align with those standards. Another reason is that Arch Linux uses systemd as its init. If you ever want more control over your init system, switching from systemd comes with a learning curve. It's worth noting that systemd is quite controversial in the GNU/Linux community. While I find systemd to be bloated, I have to admit that its simplicity in many scenarios makes it easier for beginners. If you're curious about systemd's issues, this site provides an in-depth discussion. Ultimately, the choice is yours.

Table of Contents

Why Choose Arch Linux?

So, what makes Arch Linux stand out? In my opinion, its greatest strength lies in its extensive and detailed Wiki pages. When you first start with GNU/Linux, you're bound to run into many issues, and most of them can be resolved by checking the ArchWiki. For example, if you face any problems while installing Arch Linux, you can usually find the solution in the ArchWiki. For those up for a challenge, you can follow the official Installation Guide directly.

The most significant factors influencing a beginner's choice of distro are the packages it supports and its package manager, and these are precisely where Arch Linux excels. Over the years, Arch Linux has developed a vast repository of packages, offering a wide variety of software. Before installation, you can search the official site to see if the package you need is supported. Even if it's not in the official repositories, you'll likely find it in the Arch User Repository (AUR). Additionally, Arch Linux follows a rolling release model, meaning users typically receive updates as soon as they're available, aligning well with how most people use their computers. While some may worry that rolling releases could lead to instability, in my experience, this is rarely the case.

The package manager for Arch Linux, pacman, stands out when compared to its competitors (e.g., apt, yum, etc.). pacman is streamlined, avoiding unnecessary features, resulting in faster performance and a smoother experience. The only downside might be that its command flags can feel counterintuitive at first, but remembering the common ones isn't difficult. pacman's strengths have garnered appreciation from more developers over time, contributing to the growth of the Arch Linux community.

Another key advantage of Arch Linux is that it balances high customizability with ease of use. This is evident in two aspects: First, the system's structure is simple. Arch Linux is lightweight, and most of what you install is up to you, so you won't have to deal with unnecessary pre-installed software, and you'll be more aware of what's on your system. Second, the installation process is simpler than you might have heard. While it's true that Arch Linux lacks a GUI installer and requires you to use the CLI, getting comfortable with the command line is a fundamental skill for GNU/Linux users, so why not dive in from the start? If you're still hesitant, you can install Arch Linux using a GUI by using another Arch-based distro like Manjaro. You can then follow the guide through a GUI, which might be more beginner-friendly.

So, why Arch Linux? There are many other distros out there. RedHat showed that free software could be profitable; Debian made GNU/Linux more accessible; Ubuntu expanded GNU/Linux's commercial potential and introduced an app store that made it easier for regular users to adopt. These predecessors made significant contributions, and even if I'm not fond of all of them, they undeniably pushed GNU/Linux forward and introduced more people to the concept of software freedom. These contributions should be remembered, but Arch Linux marks a new era: It offers a clean, pure system with a vibrant and user-friendly experience, making it a great choice for beginners and regular GNU/Linux users alike.

What to Keep in Mind When Installing Arch Linux?

Following this guide or the official installation guide should be straightforward without major issues. If you encounter problems, it's likely due to typos or mistakes during input, so it's essential to be attentive while following the steps. It's even more beneficial if you take the time to understand what each step does and grasp the underlying logic. Moreover, once you fully understand the purpose of each step, there's no need to manually enter the same commands every time you reinstall the system. Instead, you should write a script for future use.

There's also the unfortunate scenario where your hardware isn't yet supported by Linux. In such cases, you'll have to wait for updates from experts. Generally, it takes about six months to a year after the release of mainstream hardware for stable Linux support to be available. For beginners, I recommend installing on mainstream hardware that's not too new to avoid unnecessary issues. The easiest way to test hardware compatibility is by running a live USB of another Arch Linux-based distro (like Manjaro) or even an unrelated distro. This allows you to check if your screen, keyboard, speakers, and other components work smoothly before committing to the installation.

It's important to remember that many of the compatibility issues with GNU/Linux are the result of restrictions imposed by large companies or organizations with resource and market advantages. Most GNU/Linux developers contribute their time and knowledge voluntarily, so when you encounter problems, make sure to double-check and think through possible solutions. If you still can't resolve the issue and need to seek help from the community, be as detailed as possible in describing the problem. Always show appreciation to those who selflessly contribute and assist others.

Additionally, using a GUI installer from an Arch-based distro's live USB can be a handy workaround, but it's not foolproof, so you'll need to assess whether it's the right choice for you.

1. Pre-installation Preparation

The hardware you'll need for installation is as follows:

Once the hardware is ready, you can move on to preparing the software.

1.1 Download and Verify the Installation Image

First, visit the official download page to get the latest installation image. I recommend using BitTorrent. After downloading, verify the PGP signature, MD5, and SHA1 checksums. Let's assume the image file is named archlinux-version-x86_64.iso; use the following commands:

$ gpg --keyserver-options auto-key-retrieve --verify archlinux-version-x86_64.iso.sig
$ md5sum archlinux-version-x86_64.iso
$ sha1sum archlinux-version-x86_64.iso

1.2 Create a USB Installation Medium

Next, you'll create a bootable USB drive. If you're using a GNU/Linux system, and your USB device is represented as /dev/sdx, you can use dd:

$ dd bs=4M if=path/to/archlinux-version-x86_64.iso of=/dev/sdx conv=fsync oflag=direct status=progress

Alternatively, you can use cat, for example:

$ cat path/to/archlinux-version-x86_64.iso > /dev/sdx

1.3 Boot from the Installation Medium

Once the bootable USB is ready, plug it into the computer you want to install Arch Linux on. Keep in mind that modern computers usually have Secure Boot enabled by default, thanks to Microsoft (side note: Secure Boot doesn't contribute much to security and mainly serves to reinforce Microsoft's dominance in the OS market. You can read more about the criticism here). To boot from the USB, you'll need to disable Secure Boot via the BIOS or boot menu. The key to access these settings varies, but it's usually one of these: F1, F2, F10, Delete, or Esc.

1.4 Set the Keyboard Layout

To view all available keyboard layouts, use the following command:

$ ls /usr/share/kbd/keymaps/**/*.map.gz

For example, to set the US keyboard layout:

$ loadkeys us

1.5 Adjust Screen Brightness

If the screen brightness is too high, you can lower it manually. The exact command may vary depending on your hardware. For Intel devices, you can try:

$ echo 100 | sudo tee /sys/class/backlight/intel_backlight/brightness

1.6 Check the Boot Mode

To check your boot mode, run the following command:

$ ls /sys/firmware/efi/efivars

If the command returns output, you're in UEFI mode. If there's an error, you're likely in BIOS mode. This guide assumes UEFI mode since it's more common today. If you're in BIOS mode, you won't need an EFI partition or related software, so be sure to consult the official documentation for the appropriate steps.

1.7 Verify Internet Connection

Since this guide assumes a wired connection, all you need to do is ensure you're connected to the internet. Use ping to check:

$ ping archlinux.org

If you need to use Wi-Fi for the installation, refer to the official guide's network configuration section for setup instructions.

1.8 Update the System Clock

To sync the system clock, run:

$ timedatectl set-ntp true

You can check more status details with timedatectl status.

1.9 Configure Disk Partitions

1.9.1 Partitioning Basics

Once the system is booted, your disk will automatically be assigned as a block device. You can list all visible devices using lsblk, with names typically like /dev/sda, /dev/nvme0n1, or /dev/mmcblk0, while others can be ignored.

Use the following command to see partition information (such as the UUID needed later):

$ lsblk -f

You'll need to decide whether to use GPT or MBR as your partition table. This guide won't go into the details; you can research more on your own. Generally speaking, for most modern computers, GPT is the default choice, while MBR is for older devices. If you're dual-booting with another system, things get more complicated, so make sure you've done your homework before proceeding. These scenarios are outside the scope of this guide.

So, how do you partition the disk? Let's use UEFI + GPT as an example. You'll need an "EFI System Partition" and a "Linux Root Partition." If your disk is /dev/nvme0n1, the commands are as follows:

$ parted /dev/nvme0n1 -s mklabel gpt # create GPT

$ parted /dev/nvme0n1 -s mkpart EFI_System fat32 1MiB 513MiB # create EFI system partition
$ parted /dev/nvme0n1 -s set 1 esp on

$ parted /dev/nvme0n1 -s mkpart Arch_GNU/Linux ext4 513MiB 100% # create Linux root partition

parted is often used in installation scripts. If it feels too complex, you can opt for tools like gdisk or cgdisk, which are more user-friendly. Now, if you run lsblk, you should see the two partitions you created:

nvme0n1
├─nvme0n1p1
└─nvme0n1p2

Many guides recommend creating a separate "home partition" and "swap partition." While this can be useful for some, it's not necessary for everyone, so set them up only if needed. On the other hand, many guides skip over disk encryption and LVM, which are more important in real-world usage for securing your data and making partition adjustments easier.

1.9.2 LUKS and LVM

For detailed knowledge on LUKS and LVM, feel free to research further.

For this part, I'll be following the steps in the official documentation here. In short, we'll fully encrypt the "Linux root partition" with LUKS and then place an LVM inside.

First, encrypt /dev/nvme0n1p2 (I recommend checking this guide to choose the highest security options):

$ cryptsetup --batch-mode --verify-passphrase --verbose --cipher serpent-xts-plain64 --key-size 512 --hash whirlpool --use-random luksFormat /dev/nvme0n1p2

Once encryption is complete, unlock the encrypted container using the password you set:

$ cryptsetup open --type luks /dev/nvme0n1p2 lvm

Next, create a physical volume:

$ pvcreate /dev/mapper/lvm

You can verify it with:

$ pvdisplay

Then create a volume group:

$ vgcreate archlinux /dev/mapper/lvm

You can check it with:

$ vgdisplay

Finally, create a logical volume that occupies all available space:

$ lvcreate -l 100%FREE archlinux -n root

You can view the logical volume details with:

$ lvdisplay

After setting up all partitions, you should have a structure similar to this:

nvme0n1
├─nvme0n1p1
└─nvme0n1p2
  └─archlinux
    └─archlinux-root

1.9.3 Format the Partitions

Now you just need to format each partition:

The "Linux root partition" is typically formatted as Ext4:

$ mkfs.ext4 /dev/mapper/archlinux-root

The "EFI system partition" should be formatted as FAT32:

$ mkfs.fat -F32 /dev/nvme0n1p1

1.10 Mount the Filesystem

Next, mount both the "Linux root partition" and the "EFI system partition":

$ mount /dev/mapper/archlinux-root /mnt

$ mkdir /mnt/boot
$ mount /dev/nvme0n1p1 /mnt/boot

This completes the pre-installation steps, which are usually the most time-consuming part. Now, we can move on to the main installation.

2. Installation and Configuration

2.1 Choose a Mirror

All packages in Arch Linux are downloaded through mirror servers. The Live-USB typically selects the fastest mirror automatically, but you can also manually configure this by editing /etc/pacman.d/mirrorlist. You can check the status of mirrors here or generate a customized mirrorlist here. For installation, I recommend using the default mirrorlist and tweaking it later if necessary.

2.2 Install the Base Packages

First, install the essential packages:

$ pacstrap /mnt base base-devel linux-hardened linux-firmware

Here, I chose linux-hardened for enhanced security. For more information on the different kernel options in Arch Linux, refer to this guide.

Next, install the packages related to booting. Since we're using UEFI, we need efibootmgr:

$ pacstrap /mnt grub efibootmgr

Since we're using LUKS and LVM, we also need these packages:

$ pacstrap /mnt cryptsetup lvm2

Lastly, install some common utilities like network management tools, text editors, and documentation:

$ pacstrap /mnt networkmanager
$ pacstrap /mnt vim
$ pacstrap /mnt man-db
$ pacstrap /mnt tmux
$ pacstrap /mnt git
$ pacstrap /mnt bash-completion

2.3 Generate the fstab File

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

2.4 chroot

This step essentially moves you into the newly installed system. From here on, all further steps are performed in this environment:

$ arch-chroot /mnt

2.5 Set the Time Zone

You can browse available time zones under /usr/share/zoneinfo. For example, to set the time zone to Central Time (US):

$ ln -sf /usr/share/zoneinfo/US/Central /etc/localtime

For more details on time configuration, refer to the official guide's time zone section.

2.6 Localization

First, open /etc/locale.gen, find the language you want, and uncomment it (e.g., en_US.UTF-8 UTF-8). Then, generate the locale:

$ locale-gen

Next, edit the /etc/locale.conf file:

LANG=en_US.UTF-8
LC_COLLATE=C

For more localization settings, check the official guide's localization section.

2.7 Network Configuration

Start by entering your hostname in /etc/hostname, which essentially names your device.

Next, enable network management. In this guide, we're using NetworkManager:

$ systemctl enable NetworkManager

2.8 Initramfs

Since we're using LUKS and LVM, you'll need to edit /etc/mkinitcpio.conf to generate a new initramfs. In the HOOKS line, add encrypt and lvm2 before filesystems, for example:

HOOKS="... encrypt lvm2 ... filesystems ..."

After making the changes, generate the new initramfs:

$ mkinitcpio -p linux-hardened

2.9 Boot Loader

There are many boot loaders to choose from, but we'll go with the widely-used GRUB. First, edit /etc/default/grub and add cryptdevice=UUID=<UUID>:archlinux to GRUB_CMDLINE_LINUX (replace <UUID> with the UUID of your "Linux root partition," which is /dev/nvme0n1p2), for example:

GRUB_CMDLINE_LINUX="cryptdevice=UUID=e282e4bf-3717-4060-954a-52bebfc8d2a1:archlinux"

Then, install and configure GRUB:

$ grub-install --efi-directory=/boot --removable
$ grub-mkconfig -o /boot/grub/grub.cfg

The --removable option is optional. It's useful for avoiding additional configuration when migrating storage devices and can prevent some potential issues. For more information, refer to the GRUB section in the official guide.

2.10 Root Password

You can set the root password directly using passwd, but I recommend creating a user with sudo privileges and locking the root account.

First, create a new user and set a password (replace <USERNAME> with your preferred username):

$ useradd -m <USERNAME>
$ passwd <USERNAME>

Next, run visudo and add a line similar to the one for root, but with your new username (again, replace <USERNAME> with your chosen username):

<USERNAME> ALL=(ALL) ALL

Additionally, based on the official sudo documentation, if you plan to use software that relies on polkit (e.g., GNOME), you should add the user to the wheel group:

Tip: When creating new administrators, it is often desirable to enable sudo access for the wheel group and add the user to it, since by default Polkit treats the members of the wheel group as administrators. If the user is not a member of wheel, software using Polkit may ask to authenticate using the root password instead of the user password.

You can add the user to the wheel group with:

$ gpasswd -a <USERNAME> wheel

Finally, lock the root password:

$ passwd -l root

2.11 Reboot the System

This concludes the base installation and configuration. You now have a minimal Arch Linux system. Of course, this setup is bare-bones and may not meet all your daily needs, so before diving into further customization, let's reboot the computer:

$ umount /mnt/{boot,}
$ reboot

3. Post-installation Tweaks

After rebooting, you should be able to log into your new system! Once logged in, check your network status and update the system:

$ sudo pacman -Syu

If you plan to use Wi-Fi, you can configure it with nmtui, or you can wait until you've set up a graphical interface (GUI) to connect.

Now you can install your preferred graphical environment. I suggest GNOME, which is both user-friendly and aesthetically pleasing. Installing GNOME is straightforward: while you can install the entire gnome package, this includes a lot of unnecessary software. To keep things lighter, I recommend installing just the following packages:

$ sudo pacman -S gnome-shell gnome-terminal gnome-control-center gnome-tweaks nautilus

After installation, you can start GNOME with:

$ gnome-shell --wayland

If you want a graphical login screen, install and enable gdm:

$ sudo pacman -S gdm
$ sudo systemctl enable gdm.service

After rebooting, you should see a graphical login screen.

There are also some optional packages that can enhance your GNOME experience:

$ sudo pacman -S gnome-shell-extensions gnome-backgrounds gnome-keyring

Audio Control

Many GNU/Linux distributions now use pipewire for managing multimedia, and this is the default when installing GNOME. In rare cases, you might need to install alsa-utils to use ALSA's alsamixer, but usually, you just need to install the Pipewire replacements for ALSA, PulseAudio, JACK, etc., such as:

$ sudo pacman -S pipewire-alsa pipewire-jack

Touchpad Settings

By default, GNOME doesn't enable tap-to-click for touchpads. You can enable it by going to Settings -> Mouse & Touchpad and turning on Tap to Click.

There are many other settings you can adjust according to your preferences.

Enable Dark Theme Mode

With the release of GNOME 42 (March 2022), commonly used applications are gradually transitioning to the GTK4 and libadwaita combo, so enabling Dark Theme is as simple as going to Settings -> Appearance -> Style and selecting Dark. For older apps still using earlier versions, you can try the following workaround.

Usually, you just need to install and select your preferred dark theme. For example, to use the Adwaita-dark theme, first install gnome-themes-extra, then select Adwaita-dark under Tweaks -> Appearance -> Themes -> Applications. If you need to manually configure it, here's an approach based on my previous experience:

Recently (June 2018), I noticed that the "Global Dark Theme" option in Gnome Tweak Tool (now renamed to "Tweaks") disappeared. After some research, I found the reason behind the missing option and how to bring it back. As usual, I'll share the sources:

In short, the Tweak Tool developer found the feature incomplete and believed there were enough alternative methods available, so it was removed (you can find more details in the links above). Fortunately, we can still manually enable Dark Theme mode by editing the configuration file (the following steps are directly translated from the original answer).

Step 1: Open the configuration file:

$ gedit ~/.config/gtk-3.0/settings.ini

Step 2: Copy and paste this into the file:

[Settings]
gtk-application-prefer-dark-theme=1

This enables GTK3's Dark Theme mode. Of course, manual configuration can lead to issues, so I recommend using ready-made themes. Many themes, such as Numix (discussed below), Adapta, Arc, etc., offer dark variants, which you can easily install and apply.

Install Third-party Icons

GNOME's default appearance is already polished, but some users prefer more unified icon styles, like Numix, WhiteSur, or Nordzy. I'll demonstrate how to install third-party icons by installing the Numix Square icon set.

Numix Square icons pair well with GNOME, but unfortunately, they don't have an official package, so we'll need to use AUR. First, find the AUR package numix-square-icon-theme and notice that one of its dependencies is numix-icon-theme-git, which is also in AUR. Therefore, you should install numix-icon-theme-git first, followed by numix-square-icon-theme. Here's how (replace <package_file> with the actual package name generated by makepkg):

$ git clone https://aur.archlinux.org/numix-icon-theme-git.git
$ cd numix-icon-theme-git
$ makepkg
$ pacman -U <package_file>

Repeat the same steps for numix-square-icon-theme. After installation, you can select the icons through Tweaks.

Install Source Code Pro Font

This font is ideal for coding:

$ sudo pacman -S adobe-source-code-pro-fonts

You can also explore other fonts that suit your preferences since comfort is key when coding.

Install IBus for Chinese Input

Refer to:

Chinese Support and Fonts Installation

For more options, refer to the first link.

I recommend using wqy-zenhei for everyday use. If you're interested in Classical Chinese or character research, you might need ttf-hanazono, which currently has the most extensive character coverage.

IBus Installation

Start by installing the core software:

$ sudo pacman -S ibus

Next, install your preferred input method:

$ sudo pacman -S ibus-libpinyin
$ sudo pacman -S ibus-rime

After installation, initialize it:

$ ibus-setup

Since GNOME uses IBus by default, you can enable the input method directly through its settings. Go to Settings -> Keyboard -> Input Sources and add the desired input language. If it doesn't work, try rebooting the system.

Recommended Applications

Conclusion

People use GNU/Linux for different reasons—some for freedom, some for work. The same goes for Arch Linux; everyone has their own motivations. As long as you keep learning, exploring, and maintaining a curious mind, I believe Arch Linux can provide you with a rewarding experience. I'll end with three famous pieces of advice from the "sudo warning":

  1. Respect the privacy of others.
  2. Think before you type.
  3. With great power comes great responsibility.