Arch Linux Manual Installation Guide

DISCLAIMER: Don't blindly follow the commands provided in this guide, the reader is strongly encouraged to go learn about all the discussed topics outside of this guide. There will be links provided where they are needed. This guide is useful for learning some things, but it doesn't cover nearly enough knowledge that is expected from an individual in this environment.
TIPS FOR CLI (Command Line Interface)
• You can use CTRL + L to clear your terminal screen
• You can use CTRL + C to stop / terminate a command
• You can use the up and down arrow to iterate over your previously ran commands

1 PRE-INSTALLATION

If you have a bootable arch USB with the latest version you can skip this step

1.1 Acquire an installation image

Visit the Download page and acquire the ISO file from a global link or a mirror server near you (scroll down)

1.2 Verify the signature

If you have a working linux environment you can use the Instructions on Checksum

If you have windows you will need to open Powershell or Command Prompt as administrator and cd into the directory where the .iso file is downloaded.

> cd C:\Users\<your-user-name>\Downloads

Then generate the SHA256 checksum and compare it to the one in the sha256sums.txt file located at Checksum

> certUtil -hashfile <your-filename> SHA256

1.3 Creating a bootable USB

Using a tool like Rufus and your iso file you will need to make a bootable USB for arch. As the Device select your USB drive, for the Boot selection select your arch .iso file that you installed.

You can set Partition scheme to GPT if you have newer hardware or your disk is over 2 TB. In the rare use case that both of those are false you will need to set the partition scheme to MBR.

1.4 Boot onto the USB

Restart your computer and enter your BIOS which is usually achieved by clicking the F2 or DEL key during the post phase. In your BIOS you will have to turn off secure boot and fast boot. Then you will have to set your USB to the highest priority as the boot device. After that save and exit, and you will be logged in on the USB environment as the root user.

1.5 Set the console keyboard layout and font

Available layouts can be listed with:

# localectl list-keymaps

Setting the keyboard layout, for example US:

# loadkeys us

Console fonts are located in /usr/share/kbd/consolefonts/ and for example, to use larger fonts suitable for HiDPI screens, run:

# setfont ter-132b

1.6 Connect to the internet

It is recommended for you to be using ethernet during your installation, also it is a lot easier that way since ethernet works out of the box. You can check your internet connection by running:

# ping archlinux.org

If you are unable to connect through ethernet and need to use Wi-Fi then look into the instructions for iwctl

1.7 Updating the system clock

To ensure the system clock is synchronized, run:

# timedatectl set-ntp true

1.8 Partitioning the disks

Now is the time to look into swap partitions, hibernation and LVM.

In short having a swap partition allows your computer to use disk space when the ram is filled up. Hibernation makes your computer stay in the same state after it being shut down and booted back up again. Using LVM and having a partition for your root and home with both of them being physical volumes, allows you to dynamically resize your root and home volumes and use LVM snapshots.

Find the name of the drive where you want to install arch using this command

# lsblk

Use a partitioning tool like fdisk to modify partition tables. Enter your targeted drive with:

fdisk /dev/<your-drive-name>
make sure you select the correct drive with fdisk, doing the steps provided next we will be wiping all your partitions and your data on the drive will be lost.

Now that we are in fdisk you can view your current partition table like this

# p

Wipe your current partition tables to start from scratch:

# g

If you will be using an EFI partition on a separate drive you can skip this step but make sure that there is enough space for all the operating systems and that they are compatible and able to exist on the same partition in the first place. If you want your linux installation to have its own EFI partition (recommended) you can create it now by doing:

# n
Press [ENTER] to select the default option
Press [ENTER] to select the default option
# +1G

Type Y if it asks you to remove the signature if something was on that disk beforehand.

Now we will be creating the boot partition, which will contain everything needed for your operating system to boot. You can create it now by doing:

# n
Press [ENTER] to select the default option
Press [ENTER] to select the default option
# +1G

Type Y if it asks you to remove the signature if something was on that disk beforehand

Optional

If you want a swap partition you can create it now. The size of your swap partition depends on your ram size and if you want hibernation or not. For more information look up the topic by yourself, for example if you have 16 GB of ram and want hibernation then you will make your swap size 24 GB like this:

# n
Press [ENTER] to select the default option
Press [ENTER] to select the default option
# +24G

Type Y if it asks you to remove the signature if something was on that disk beforehand

After creating all your other partitions, now we will make the root partition with the rest of the space on your drive like this:

# n
Press [ENTER] to select the default option
Press [ENTER] to select the default option
Press [ENTER] to select the default option

Type Y if it asks you to remove the signature if something was on that disk beforehand

Now without exiting the fdisk tool we will set the correct types for your partitions.

If you have an EFI partition, set its type to 1 (EFI System) like this:

# t
# <the number of your EFI partition>
# 1

For your boot partition, set its type to 20 (Linux filesystem) like this:

# t
# <the number of your boot partition>
# 20

If you have a swap partition, set its type to 19 (Linux swap) like this:

# t
# <the number of your swap partition>
# 19

For your root partition, if you will be using LVM then set its type to 44 (Linux LVM), if you won't then set its type to 20 (Linux filesystem), for example this would be if you are using LVM:

# t
# <the number of your root partition>
# 44

If any of the number provided are not matching the correct type then you can always type L at the third line to list all the types.

When you are done with all the steps above you can write the changes like this:

# w

1.9 Format the partitions

If you are using an EFI partition already created by another operating system you will want to skip this step, don't reformat that partition.

If you have created a separate EFI partition with the instructions provided above then format it to FAT32 like this:

# mkfs.fat -F32 /dev/<your-efi-partition-name>

For your boot partition to format it to ext4 run this:

# mkfs.ext4 /dev/<your-boot-partition-name>

If you have made a swap partition run this:

# mkswap /dev/<your-swap-partition-name>
# swapon /dev/<your-swap-partition-name>

If you will not be using LVM for your root partition then just format it to ext4 like this:

# mkfs.ext4 /dev/<your-root-partition-name>

If you will be using LVM this is how you set up your root/home partition. Firstly we have to create a physical volume (PV):

# pvcreate /dev/<your-root-partition-name>

Now we are going to create a volume group with the name volgroup0

# vgcreate volgroup0 /dev/<your-root-partition-name>

Now to create your root and home logical volumes, you have to decide what size they will be. You will have to leave some disk space free if you want to use LVM snapshots. This is for example how you create a root and home volume with their names being lv_root and lv_home and their respective sizes being 100GB and 600 GB:

# lvcreate -L 100GB volgroup0 -n lv_root
# lvcreate -L 600GB volgroup0 -n lv_home

If when creating the volumes you get a message saying it found some signatures and if you want to override them, then you can override them and check if the volumes and everything was created successfully and if the mount was successful to make sure everything was set up correct.

To check if the volumes are created successfully run:

# modprobe dm_mod

Now when running this command you should see that it found the volgroup0 we created:

# vgscan

And run this to activate the logical volumes root and home:

# vgchange -ay

And finally to format both of our volumes to ext4 run this:

# mkfs.ext4 /dev/volgroup0/lv_root
# mkfs.ext4 /dev/volgroup0/lv_home

1.10 Mount the file systems

First we have to mount the base and then the subdirectories which is why we are starting with mounting root.

If you are not using LVM and have a whole partition for your root then mount it like this:

# mount /dev/<your-root-partition-name> /mnt

If you are using LVM and followed the instruction above with the exact names I provided then run this:

# mount /dev/volgroup0/lv_root /mnt

Now we are going to be mounting boot before our EFI since EFI will be in a subdirectory of boot. To create the subdirectory for boot and mount it run this:

# mkdir /mnt/boot
# mount /dev/<your-boot-partition-name> /mnt/boot

Now it doesn't matter if you have created a separate EFI partition for your arch or if you are using an already created EFI partition of another operating system, in either way you will now have to create the efi subdirectory and mount the partition like this:

# mkdir /mnt/boot/efi
# mount /dev/<your-efi-partition-name> /mnt/boot/efi

If you are not using LVM you can just later create a folder for home if you want.

If you are using LVM and followed the naming of the volumes in the instructions I have provided above this is how you make the directory and mount your home volume:

# mkdir /mnt/home
# mount /dev/volgroup0/lv_home /mnt/home

2 INSTALLATION

2.1 Select the mirrors

If your downloads can't be completed (Operation too slow. Less than 1 byte/s in the last 10 seconds), but you think your internet speed is good then you might be connected to mirror servers far away from you, to fix that update/install reflector:

# pacman -Sy reflector

And make the mirrors use servers in or near your country, for Germany for example run this:

# sudo reflector --protocol https,http --country 'Germany' --latest 10 --sort rate --download-timeout 20 --save /etc/pacman.d/mirrorlist

If that also doesn't work then you can edit your mirror list and manually type in a known fast server near you like this:

# sudo nano /etc/pacman.d/mirrorlist

Then at the top of the list of servers paste in a line like this for example:

Server = https://mirror.chaoticum.net/arch/$repo/os/$arch

2.2 Install essential packages

Now we will use pacstrap to install some basic packages that you need. You are free to look into what each of these packages does and provides:

# pacstrap /mnt base linux linux-firmware efibootmgr

3 CONFIGURE THE SYSTEM

3.1 Fstab

We need to generate a fstab file which contains the drives and partition linux is loading and where to mount them. Run this command to generate the fstab file:

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

To check if the UUID is being used in the fstab file, which is recommended, run this command:

# cat /mnt/etc/fstab

If you are using swap then now you need to find the UUID of your swap partition which you can do by running:

# blkid /dev/<your-swap-partition-name>

Then you have to edit your file located at /etc/fstab and insert a line like this:

UUID=<your-uuid> none swap defaults 0 0

Test if your swap partition is working if there are no errors after running this:

# sudo swapoff -a
# sudo swapon -a

3.2 Chroot

Now we are basically getting out of the USB and the commands after this are going to work as if we are booted into our installation on our drive. Now run this command:

# arch-chroot /mnt /bin/bash

3.3 Installing some basic packages

Next we are going to install some basic packages, some of these are optional for example you don't need lvm2 if you are not using LVM. It is now expected for you to go look at packages that you specifically need here will just be provided what I recommend:

# pacman -S networkmanager grub dosfstools lvm2 mtools sudo linux-headers linux-lts linux-lts-headers base-devel nano

If you have installed networkmanager then to make it start after booting you can run this:

# systemctl enable NetworkManager

3.4 GPU drivers and hardware decoding

If you have an NVIDIA GPU, then to get drivers and hardware decoding, run this:

# pacman -S nvidia nvidia-utils nvidia-lts

If you have an Intel or AMD gpu, then to get drivers, run this:

# pacman -S mesa

For hardware encoding it's different for Intel and AMD.

For Intel broadwell chipset and newer, run this:

# pacman -S intel-media-driver

For AMD, run this:

# pacman -S libva-mesa-driver

3.5 GRUB

There are many Boot loader's, but here I will show you how to use GRUB for your Boot loader.

If you already didn't in the step's provided above, install grub using pacman like this:

# pacman -S grub

To configure grub so it knows what to boot run this:

# grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck

If you want hibernation now you will have to use your UUID which you can find by running:

# blkid /dev/<your-swap-partition-name>

Now open the file located at /etc/default/grub, with nano for example run this:

# sudo nano /etc/default/grub

And you have to find the line that contains GRUB_CMDLINE_LINUX and make it look like this:

GRUB_CMDLINE_LINUX="resume=UUID=<your-uuid>"

To generate your grub config files run:

# grub-mkconfig -o /boot/grub/grub.cfg

You should see some Found messages and done at the end, if not then you probably forgot to pacstrap your kernel.

3.6 Root password

To set the password for the root run this:

# passwd

To create a new user (recommended) and password run this:

# useradd -m -G wheel -s /bin/bash neo
# passwd neo

Now to give this user sudo privileges you will have to uncomment the line in visudo that looks like this:

#%wheel ALL=(ALL) ALL

To enter that file using nano for example just run this:

# EDITOR=nano visudo

3.7 Localization

We have to uncomment the language for our system which we want to use. For example if you want the US english language, enter the file located at /etc/locale.gen, find en_US and uncomment both the UTF and ISO line.

If you want to enter that file using nano, run this:

# nano /etc/locale.gen

To generate the locales run this:

# locale-gen

We have to put our language in the locale.conf which doesn't exist yet. If you want to make the file and edit it using nano you can do:

# nano /etc/locale.conf

And type this in:

LANG=en_US.UTF-8

3.8 Setting hostname

To assign a consistent and identifiable name to your system, create the hostname file like this:

# nano /etc/hostname

And type in arch for example

3.9 Time zone

To set our time zone to the correct location, you can type this command then press [TAB] to look at the available region names:

# ln -sf /usr/share/zoneinfo/

Then type in that region name that you see and press [TAB] again to look at the available cities and select the correct one, for America for example:

# ln -sf /usr/share/zoneinfo/America/

Now that you have your region and city name you have to connect it, for example for New York it will look like this:

# ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

3.10 Initramfs

Usually this step is not required because mkinitcpio was run on installation of the kernel package with pacstrap. But if you are using LVM or hibernation for example you will have to modify the mkinitcpio.conf file and recreate the initramfs, to enter the file with nano do:

# nano /etc/mkinitcpio.conf

Now scroll down and find the uncommented HOOKS line.

If you are using LVM you will have to add lvm2 after block and for hibernation add resume after block. So your HOOKS line will look something like this for example:

HOOKS=(base udev autodetect modconf keyboard keymap block lvm2 resume filesystems fsck)

Now we have to regenerate the mkinitcpio, to do that run this:

# mkinitcpio -P linux
# mkinitcpio -P linux-lts

Make sure when running both of these that you see lvm2 and resume in the output to make sure it was successful.

4 REBOOT

First exit out of the chroot environment:

# exit

lthough unmounting will be done automatically with just rebooting it is recommended to unmount everything manually. Unmount root and boot:

# umount -a

Now you can reboot:

# reboot

5 Post-installtion

Now after rebooting if you are using swap check if it's active like this:

# swapon --show

If you want hibernation, now it's time to check if it has been set up properly by running this:

# cat /proc/cmdline

In the output you should see resume=UUID=<your-swap-uuid>, if you don't see it then you will need to edit /etc/default/grub again and make sure it's added correctly under GRUB_CMDLINE_LINUX.

If that is all good finally to test hibernation try running this:

# sudo systemctl hibernate

Your system should shut down, turn it back on and check if hibernation is working and if it put you back where you left. If it's not active then probably The /etc/fstab entry is incorrect (e.g., wrong device or UUID)

If everything is working now you can do:

# pacman -S fastfetch
# fastfetch

Check out General recommendations for system management directions and post-installation tutorials (like creating unprivileged user accounts, setting up a graphical user interface, sound or a touchpad).

For a list of applications that may be of interest, see List of applications.

Congratulations, you are using arch btw. Now you can install your desktop environments of choice and configure your arch-box exactly how you want it, good luck.