Skip to the content.

How to install Arch Linux

These instructions were written by me, following the Arch Wiki, to install Arch in a VM &/or real machine. These instructions include both the installation process and the post-install process, as well as some additions

NOTE: the editor used in this guide is vim.

I suggest also checking out the arch wiki. If you haven’t already, download the Arch ISO.

If you want to see the RAW Markdown instructions (this file) in a terminal, run curl -L https://git.io/Archlinux.

Alternatively, you can also format the file so that it won’t have a lot of the Markdown specific syntax:

Table of contents

See also How to manage packages on Arch Linux

If you use a VM:

NOTE: this will use MBR, meaning you’ll use BIOS, not UEFI! If you want to use UEFI, follow these instructions: https://www.virtualbox.org/manual/ch03.html#efi

If you use a real machine

If you already have a machine running Linux, you can use dd to flash the ISO to your usb/dvd. For example, if you usb drive is /dev/sdc (check with lsblk), run the following command:

dd if=archiso.iso of=/dev/sdc status=progress bs=512M

Likewise, if you DVD slot is /dev/sd0, run the following command:

dd if=archiso.iso of=/dev/sd0 status=progress bs=512M

After starting the VM/Computer, choose “Arch Linux” from the bootloader (GRUB), then hit [ENTER]

Set the keyboard layout

To find out available keyboard layouts, run: ls /usr/share/kbd/keymaps/**/*.map.gz

Once you find your keyboard layout, run: loadkeys <keyboard-layout>: For example, I ran loadkeys it because my keyboard has an italian keyboard layout.

Verify the boot mode

Run this command: ls /sys/firmware/efi/efivars.

If the command shows the directory without error, then the system is booted in UEFI mode. If the directory does not exist, the system may be booted in BIOS (or CSM) mode.

If the system did not boot in the mode you desired, refer to your motherboard’s manual, or check your BIOS/UEFI settings; look for an option under “Boot” called “Prefer boot mode”, it should be set to UEFI.

1) Connect to the internet

Let’s connect using iwctl:

  1. Run iwctl
  2. In the iwctl prompt, type device list
  3. Then, scan for available networks: station [DEVICE] scan ([DEVICE] is the Wi-Fi card, like wlp3s0)
  4. Get a list of the Wi-Fi networks: station [DEVICE] get-networks
  5. Connect to a network: station [DEVICE] connect [SSID] ([SSID] is the name of the Wi-Fi network)

If a passphrase is required, you will be prompted to enter it.

Alternatively, you can supply it as a command line argument: iwctl --passphrase "[WIFI PASSWORD]" station [DEVICE] connect [SSID]

If, for some reason, iwctl fails, run these two commands:

(If the wireless network interface isn’t wlan0, use the one you have)

wpa_passphrase "My Network" "My passphrase" > wpa.conf
wpa_supplicant -i wlan0 -c wpa.conf

2) Partition the disk

Disk partitioning will be different if you use MBR or GPT:

NOTE: If you already have partitions (from Window$ or another Operating System), we need to delete them and convert the partition table to MBR/GPT.

First of all, remove all pre-existing file systems from SATA HDD/SSD: wipefs -a /dev/sda (If you use an NVMe drive, it is going to be called something like /dev/nvme0n1, check available disks with fdisk -l)

To make sure your changes to the partitions are synced with the Kernel, run partprobe.

Swap

Say you have a 250GB HDD and 4GB RAM. If you are going to be using your system as a Desktop, not compiling anything huge (for example, Firefox), I recommended that you reserve at least 4GB for swap space. If you have a lot of RAM (say, 32GB), 4GB will do just fine. However, if you have ~8GB RAM and you look forward to compiling big stuff (even infrequently), I recommend having a swap partition of at least 2 + (2 * RAM). In this case, we’ll set a swap partition size of 8GB.

If you want to use other filesystems instead of Ext4, please see https://wiki.archlinux.org/index.php/File_systems#Types_of_file_systems

Your partition table should look like this (sizes may vary):

MBR:

Device Partition Type Partition Size
/dev/sda1 Ext4 242G
/dev/sda2 Linux Swap 8G

GPT:

Device Partition Type Partition Size
/dev/sda1 EFI System 512M
/dev/sda2 Ext4 241G
/dev/sda3 Linux Swap 8G

3) Create the file system

4) Mount the partitions

The partitions should be mounted like this (check with lsblk):

MBR:

Partition to mount Mountpoint
/dev/sda1 /mnt
/dev/sda2 [SWAP]

GPT:

Partition to mount Mountpoint
/dev/sda1 /mnt/boot/efi
/dev/sda2 /mnt
/dev/sda3 [SWAP]

5) Installation: modifying the mirror list

6) Install essential packages

7) Configuring the system: Fstab

8) Configuring the system: Chroot

9) Localization

I will be using the Italian time; to see available timezones, run ls /usr/share/zoneinfo and select accordingly.

Here after KEYMAP you need to type your keyboard’s layout, you chose this before when you ran loadkeys <code>. I chose it because I use a keyboard with an Italian keyboard layout, meaning I wrote KEYMAP=it. See more here: https://jlk.fjfi.cvut.cz/arch/manpages/man/vconsole.conf.5

After you’re done, save and quit.

10) Network Configuration: hostname

11) Network Configuration: hosts

# IPv4
127.0.0.1	localhost
127.0.1.1	<your hostname>.localdomain <your hostname>

# IPv6
::1		localhost

Where <your hostname> is the hostname you chose in /etc/hostname.

11.3) Save the file and exit

12) Set the root password

13) Add a new user:

For example I chose matteo so I will replace <user> with matteo.

14) Install the bootloader

For other bootloaders, see https://wiki.archlinux.org/index.php/Arch_boot_process#Boot_loader

15) Install the network tools

16) Reboot

17) Post-installation

If you don’t want to use Arch graphically, go to section number 20 (install necessary drivers)

18) Install X.Org

19) Install a Desktop Environment

NOTE: Instead of using a Desktop Environment, you can directly install a Window Manager. I use i3. If you would like to use i3, follow this guide I wrote here.

Please choose one of the following Desktop Environments:

After installing Xorg, a Desktop Environment and its dependencies, enable the Display Manager (DM)

NOTE: If a Display Manager does not load, please refer to this page

20) Install necessary drivers

(NOTE: other video drivers can be found in the xorg-drivers group)

21) Install audio sound system

sudo pacman -S pulseaudio pulseaudio-alsa alsa-utils

You might also want to install some codecs (audio, image & video):

sudo pacman -S flac faac wavpack libmad opus libvorbis openjpeg libwebp x265 libde265 x264 libmpeg2 libvpx

Additions

The sections below contain various optional additions:

22) Enable touchpad tap to click

Since we installed xf86-input-libinput in section 20, we need to tweak the configuration.

23) Pacman easter egg

Each time you will install a new package you will see a little pacman in the progress bar. The relevant /etc/pacman.conf should look like this:

# Misc options
#UseSysLog
Color
#TotalDownload
CheckSpace
#VerbosePkgLists
ILoveCandy

24) Command-not-found

On Ubuntu there’s a package called command-not-found: its job is to tell the user the name of package to install in order to run a specific command. On Arch Linux, we can use pkgfile.

source /usr/share/doc/pkgfile/command-not-found.bash

25) Automatically enter a directory

If you enter only the name of a directory (for example, /etc), cd into it.

shopt -s autocd


How to manage packages

How to manage packages on Arch Linux:

For other commands, see https://wiki.archlinux.org/index.php/Pacman/Rosetta


Now you installed Arch Linux, enjoy!

You can improve these instructions by creating a new pull request, or by creating a new issue.