Technical Notes

Arch Linux Installation Guide

Pre-install

  1. Download an Arch ISO using the official download site
  2. Connect to the internet:

    iwctl station wlan0 get-networks
    iwctl station wlan0 connect "SSID"

Set Up Disks

Partition the Drive

This guide will go over a non-encrypted disk setup.

Use fdisk -l to see which disk to format. Once you have found the disk, let's set it up by using the following command:

fdisk /dev/sda # Replace /dev/sda with your disk!

In fdisk, you can create your partition layout. If you don't know where to start, here's a good reference table from the Arch Wiki:

Mountpoint Partition Partition type Suggested size
/boot /dev/efi_system_partition EFI System Partition 1 GiB
[SWAP] /dev/swap_partition Linux Swap At least 4 GiB
/ /dev/root_partition Linux x86-64 root Remainder of the device

Format the Partitions

Create an ext4 filesystem on the root partition:

mkfs.ext4 /dev/root_partition

Initialize swap, if you made a swap partition:

mkswap /dev/swap_partition

If you created an EFI partition, create a FAT32 filesystem:

mkfs.fat -F 32 /dev/efi_system_partition

Mount the Filesystems

Lastly, before installing the system, mount the filesystems that you just created.

mount /dev/root_partition /mnt
mount --mkdir /dev/efi_system_partition /mnt/boot
swapon /dev/swap_partition

Install the System

Install required packages

Use pacstrap to setup a base system on /mnt:

pacstrap -K /mnt base linux linux-firmware

Note that the pacstrap command DOES NOT contain all of the tools from the live image! We'll get to installing some extra tools in a bit.

Configure the System

Fstab

An fstab file defines how and where filesystems should be mounted on boot. It is located in /etc/fstab on Arch Linux. To generate the fstab file:

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

Chroot

Now that the base system has been installed, we can chroot into it:

arch-chroot /mnt

From here on out, this manual will assume that you are chrooted into the system.

Time

Set the time zone with the below commands:

ln -sf /usr/share/zoneinfo/<REGION>/<CITY> /etc/localtime
hwclock --systohc

Localization

Uncomment en_US.UTF-8 UTF-8 and other necessary locales from /etc/locale.gen. Generate the locales by running:

locale-gen

Next, create the file /etc/locale.conf and set the LANG variable:

LANG=en_US.UTF-8

Network Configuration

Edit the /etc/hostname file to set your hostname.

yourhostname
/etc/hostname

Next, we'll set up a network manager, as one is not installed by default on Arch. Based on personal experience, if you forget to install a network manager, you'll have to re-chroot into the system! I usually use NetworkManager (probably the most popular choice), so I'll show you how to set that up here. Feel free to choose your own, though.

To set up NetworkManager, use pacman to install it then enable it with systemctl.

pacman -S networkmanager
sudo systemctl enable NetworkManager.service

Bootloader

The last "official" step of installation is to install a bootloader. My personal choice is GRUB, but again, feel free to choose your own.

To install GRUB, first install the package with pacman:

pacman -S grub

Then, use the following commands to install GRUB to your EFI partition:

grub-install --target=x86_64-efi --efi-directory=/boot
grub-mkconfig -o /boot/grub/grub.cfg

Root password

To set the root password, run the following command:

passwd <YOUR PASSWORD>

Install Extra Packages

At this point, your base installation is finished and you're now ready to use your system! Before booting into your system, though, I would recommend installing a couple basic utilities such as a text editor and Git. For instance:

pacman -S git vim wget # add whatever packages you want here

To reboot into your new system, simply leave the chroot environment with the exit command, then type the reboot command. Congratulations!

Post-Installation Steps

Now, I'll walk you through some common post-installation steps. From here on out, these steps will assume you're booted into your live system.

Setting Up Your Users

To create your user, then set its password:

useradd -m <USERNAME>
passwd <USERNAME>

After creating your user, it's a good idea to add it to some common groups using usermod, for example:

usermod -aG wheel,networkmanager <USERNAME>

Setting up Sudo

Setting up sudo will give your user the ability to run commands as root. First, install the sudo package:

pacman -S sudo

Then, to configure sudo to grant members of group wheel root access, run the visudo command and uncomment the line:

%wheel      ALL=(ALL:ALL) ALL

Installing a Desktop Environment

Picking a desktop environment is a decision that is entirely up to you, but for the purposes of this example, I'll show you how to install KDE Plasma. However, this process should be relatively the same for any DE you decide to install.

First, install the plasma package:

pacman -S plasma

Then, enable SDDM to run on startup:

systemctl enable sddm.service

Here are the installation guides for some other popular desktop environments:

Conclusion

I hope you found this guide for installing Arch Linux to be helpful. Installing Arch from scratch is, in my opinion, one of the absolute best ways to learn Linux comprehensively.

What's Next???

  • To maintain your Arch system, follow this article from the Arch Wiki.
  • If you ever run into problems after an update, read the Arch News and see if manual intervention is required.
  • In general, the Arch Wiki is going to be your best friend for fixing problems and installing software. Always try to use the Wiki as your first resource.