Arch Linux Installation
This is a step by step installation of my own Arch Linux configuration.
Overview
Section titled “Overview”The current installation is using the following options:
- Boot & Firmware: UEFI
- Bootloader: systemd-boot
- Encryption: LUKS
- Filesystem: Btrfs
- Kernels:
linuxandlinux-lts - Shell: Fish
- Terminal Emulator: Kitty
- Desktop Environment: KDE Choose one of the two
- Window Manager: Hyprland Choose one of the two
- Display Manager: sddm
- File Manager: lf (TUI) + Dolphin (GUI)
- AUR Helper: Yay
- Network Manager: NetworkManager
- Audio System: Pipewire
- Desktop Notifications: Mako Hyprland
- Status Bar: Waybar Hyprland
- Application Launcher: Vicinae
- Text Editor: NeoVim (TUI) + VSCode (GUI)
- Browser: Firefox
Setup SSH optional
Section titled “Setup SSH ”To make the whole installation easier you can remotely connect (via SSH) to the system after setting up network (Ethernet or Wi-fi). Only need to enable the sshd service and setup a password.
systemctl start sshdpasswdSet keyboard layout optional
Section titled “Set keyboard layout ”# List all available keymapslocalectl list-keymaps# Replace with your desired keyboard layoutloadkeys pt-latin1Wi-fi setup
Section titled “Wi-fi setup”iwctl# Generally named wlan0 use "device list" to list all options[iwd]# station NAME scan[iwd]# station NAME get-networks# Replace with your network name[iwd]# station NAME connect SSID[iwd]# exitping ping.archlinux.org# Verify system clock is synchronised once internet connection is establishedtimedatectlSetting up your partitions
Section titled “Setting up your partitions”Before setting up any encryption or partitions, I like to wipe everything and fill it with random bytes (this will take a while depending on your drive size).
dd if=/dev/urandom of=/dev/DEVICE_NAME bs=1M status=progressNow to set up the partitions. For now, I’m just using two partitions:
- Boot partition: 1GB size (EFI System)
- Root partition: Remaining space (Linux File System)
I do not have any swap partition for now as my current drive is small, so I rather trade performance for more space (I’ll use zram instead).
| Mount Point | Partition | Partition Type | Suggested size |
|---|---|---|---|
| /boot | /dev/efi_partition | EFI System | At least 1GiB |
| / | /dev/root_partition | Linux File System | Remaining space |
fdisk /dev/DEVICE_NAME# Create GPT partition tableg# Boot partitionn<use default><use default>+1Gt# `uefi` or generally `1` for EFI System, but double check the list of types1# Root partitionn<use default><use default><use default># Save partition tablewThe partitions in lsblk should look something like:
NAME TYPE MOUNTPOINT SIZEDEVICE_NAME disk ...├─DEVICE_NAME1 part 1G└─DEVICE_NAME2 part ...LUKS Setup
Section titled “LUKS Setup”This section covers encrypting the root partition with LUKS encryption.
modprobe dm-cryptmodprobe dm-modcryptsetup -v luksFormat -s 512 -h sha512 /dev/root_partition# Enter passphrase and do not forget it, or your data will be inaccessibleFile System Setup
Section titled “File System Setup”We’ll setup a Btrfs system with the following subvolumes:
| Subvolume | Mountpoint |
|---|---|
| @ | / |
| @home | /home |
| @var_log | /var/log |
| @pkg | /var/cache/pacman/pkg |
| @snapshots | /.snapshots |
# Skip this command if you're not using encryption# Replace /dev/mapper/root by /dev/root_partitioncryptsetup open /dev/root_partition root# Create Btrfs subvolumesmkfs.btrfs -L root /dev/mapper/rootmkdir -p /mnt/arch_btrfsmount -o compress=zstd /dev/mapper/root /mnt/arch_btrfsbtrfs subvolume create -p /mnt/arch_btrfs/@btrfs subvolume create -p /mnt/arch_btrfs/@homebtrfs subvolume create -p /mnt/arch_btrfs/@var_logbtrfs subvolume create -p /mnt/arch_btrfs/@pkgbtrfs subvolume create -p /mnt/arch_btrfs/@snapshotsumount /mnt/arch_btrfs
# Mount the subvolumesmount -o compress=zstd,subvol=@ /dev/mapper/root /mntmount -o compress=zstd,subvol=@home --mkdir /dev/mapper/root /mnt/homemount -o compress=zstd,subvol=@var_log --mkdir /dev/mapper/root /mnt/var/logmount -o compress=zstd,subvol=@pkg --mkdir /dev/mapper/root /mnt/var/cache/pacman/pkg
# Format boot partition and mountmkfs.fat -F 32 /dev/efi_partition"mount -o fmask=0077,dmask=0077 --mkdir /dev/efi_partition /mnt/bootThe partitions in lsblk should look something like:
NAME TYPE MOUNTPOINTSDEVICE_NAME disk├─efi_partition part /mnt/boot└─root_partition part └─root crypt /mnt/var/cache/pacman/pkg /mnt/var/log /mnt/home /mntIf not using LUKS encryption, the root_partition will map directly to the subvolumes without the intermediary root.
Setup Mirrors
Section titled “Setup Mirrors”reflector --save /etc/pacman.d/mirrorlist --latest 5 --protocol https --country Portugal,Netherlands,Germany --sort rateInstall essential packages
Section titled “Install essential packages”pacman -Sy# Remove zram-generator if using swap partitionpacstrap -K /mnt --needed base base-devel linux linux-headers linux-lts linux-lts-headers linux-firmware btrfs-progs snapper networkmanager efibootmgr neovim zram-generatorConfigure snapper
Section titled “Configure snapper”arch-chroot -S /mnt snapper --no-dbus -c root create-config /arch-chroot -S /mnt snapper --no-dbus -c home create-config /home# Delete automatically created subvolumes by snapperbtrfs subvolume delete /mnt/home/.snapshotsbtrfs subvolume delete /mnt/.snapshots# Replace /dev/mapper/root by your /dev/root_partition if not using encryptionmount -o compress=zstd,subvol=@snapshots --mkdir /dev/mapper/root /mnt/.snapshotschmod 750 /mnt/.snapshotsgenfstab -U /mnt >> /mnt/etc/fstabConfiguring the System
Section titled “Configuring the System”Change root to the new system:
arch-chroot /mntEnabling snapper services
Section titled “Enabling snapper services”systemctl enable snapper-timeline.servicesystemctl enable snapper-cleanup.serviceEnable decryption on boot
Section titled “Enable decryption on boot”Add sd-encrypt to HOOKS in /etc/mkinitcpio.conf.
HOOKS=(base systemd autodetect microcode modconf kms keyboard keymap sd-vconsole block sd-encrypt filesystems fsck)Timezone
Section titled “Timezone”You can search the available timezones by using ls /usr/share/zoneinfo and then ls /usr/share/zoneinfo/Region when you choose your region.
ln -sf /usr/share/zoneinfo/Region/City /etc/localtimehwclock --systohcAdd the NTP pools to your etc/systemd/timesyncd.conf:
#NTP= #FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org FallbackNTP=0.pool.ntp.org 1.pool.ntp.orgsystemctl enable systemd-timesyncd.serviceLocalisation
Section titled “Localisation”Uncomment wanted locales in /etc/locale.gen.
#en_GB.UTF-8 UTF-8 #ja_JP.UTF-8 UTF-8 #pt_PT.UTF-8 UTF-8 en_GB.UTF-8 UTF-8 ja_JP.UTF-8 UTF-8 pt_PT.UTF-8 UTF-8locale-genCreate /etc/locale.conf and set your language preferences.
LANG=en_GB.UTF-8LANGUAGE=en_GBLC_CTYPE=en_GB.UTF-8LC_NUMERIC=en_GB.UTF-8LC_TIME=pt_PT.UTF-8LC_COLLATE=C.UTF-8LC_MONETARY=pt_PT.UTF-8LC_MESSAGES=en_GB.UTF-8LC_PAPER=en_GB.UTF-8LC_NAME=en_GB.UTF-8LC_ADDRESS=pt_PT.UTF-8LC_TELEPHONE=pt_PT.UTF-8LC_MEASUREMENT=pt_PT.UTF-8LC_IDENTIFICATION=en_GB.UTF-8Create /etc/vconsole.conf and set your console keyboard layout.
KEYMAP=pt-latin1Networking
Section titled “Networking”Set your hostname in /etc/hostname.
myhostnamesystemctl enable NetworkManager.serviceRegenerate initramfs
Section titled “Regenerate initramfs”mkinitcpio -PSet root password
Section titled “Set root password”passwdBootloader Setup
Section titled “Bootloader Setup”This is the setup for systemd-boot bootloader, if you want to use other bootloader like GRUB, read the appropriate wiki page.
bootctl install# Get UUID of `root_partition" and put it on our future entryblkid /dev/root_partition >> /boot/loader/entries/arch.conf# Duplicate entry for LTS kernel (can do it later after configuring normal kernel)cp /boot/loader/entries/arch.conf /boot/loader/entries/arch-lts.confEdit the bootloader configuration in /boot/loader/loader.conf.
default @savedtimeout 5console-mode maxCreate entries for each kernel in /boot/loader/entries/.
title Arch Linuxlinux /vmlinuz-linuxinitrd initramfs-linux.imgoptions rd.luks.name=DEVICE-UUID=root root=/dev/mapper/root rootflags=subvol=@title Arch Linux (LTS)linux /vmlinuz-linux-ltsinitrd initramfs-linux-lts.imgoptions rd.luks.name=DEVICE-UUID=root root=/dev/mapper/root rootflags=subvol=@pacman -S --needed fishUser Configuration
Section titled “User Configuration”useradd -m -G wheel -s /usr/bin/fish USERNAMEpasswd USERNAMEexport EDITOR=nvimvisudoThe last command is used to configure our sudo users. Uncomment one of the lines whether you want sudo to be used with or without password.
#%wheel ALL=(ALL:ALL) ALL %wheel ALL=(ALL:ALL) ALL# or #%wheel ALL=(ALL:ALL) NOPASSWD: ALL %wheel ALL=(ALL:ALL) NOPASSWD: ALLPkgstats
Section titled “Pkgstats”Once installed (it is enabled on install), this will send your installed packages, the architecture and the mirror you’re using to Arch Linux developers. This information is anonymous and can’t be used to identify the user, and is only used to help the developers prioritise their efforts.
pacman -S --needed pkgstatsGPU Setup optional
Section titled “GPU Setup ”This setup depends on your card. Always better to check the Arch Wiki for this, especially with NVIDIA cards.
NVIDIA
Section titled “NVIDIA”This is always changing with NVIDIA drivers, so check compatibility in the wiki.
pacman -S --needed nvidia-open-dkms nvidia-utilsI haven’t used an AMD GPU yet, as my desktop with one is still running Windows. Check the wiki for how to install AMD drivers.
Terminal
Section titled “Terminal”pacman -S --needed kittyKDE DE
Section titled “KDE ”If qt6-multimedia-ffmpeg pipewire-jack noto-fonts aren’t specified, the installation will ask you to choose between these and other options.
pacman -S --needed plasma-meta ark plasma-workspace qt6-multimedia-ffmpeg pipewire-jack noto-fontsHyprland WM
Section titled “Hyprland ”pacman -S --needed hyprlandRebooting to our system
Section titled “Rebooting to our system”exitsyncumount -R /mntreboot nowPost-install Configuration
Section titled “Post-install Configuration”Enable zram
Section titled “Enable zram”Add the zram configuration to /etc/systemd/zram-generator.conf.
[zram0]systemctl start /dev/zram0Wi-Fi Configuration
Section titled “Wi-Fi Configuration”nmcli device wifi listnmcli device wifi connect SSID_OR_BSSID password PASSWORDnmcli connection showping ping.archlinux.orgAUR Helper
Section titled “AUR Helper”mkdir tools # optionalsudo pacman -S --needed git base-develcd toolsgit clone https://aur.archlinux.org/yay.gitcd yay && makepkg -siReflector
Section titled “Reflector”Periodically update mirrorlist with reflector.
yay -S --needed reflectorConfigure the settings in /etc/xdg/reflector/reflector.conf.
--save /etc/pacman.d/mirrorlist
--protocol https
# --country France,Germany --country Portugal,Netherlands,Germany
--latest 5
--sort age --sort ratesudo systemctl enable reflector.timeryay -S --needed opensshDisplay Manager
Section titled “Display Manager”yay -S --needed sddmsudo systemctl enable sddm.servicePipewire
Section titled “Pipewire”yay -S --needed pipewire wireplumberFile Manager
Section titled “File Manager”yay -S --needed lf dolphinBrowser
Section titled “Browser”yay -S --needed firefoxyay -S --needed noto-fonts noto-fonts-cjk noto-fonts-emoji ttf-noto-nerdBluetooth
Section titled “Bluetooth”yay -S --needed bluez bluez-utilssudo systemctl enable bluetooth.service# Start nowsudo systemctl start bluetooth.serviceVSCode
Section titled “VSCode”yay -S --needed visual-studio-code-binFastfetch
Section titled “Fastfetch”yay -S --needed fastfetchyay -S --needed miseyay -S --needed python-pipxHyprland Configuration
Section titled “Hyprland Configuration”XDG Desktop Portal
Section titled “XDG Desktop Portal”yay -S --needed xdg-desktop-portal-hyprlandAuth Agent
Section titled “Auth Agent”yay -S --needed hyprpolkitagentDesktop Notifications
Section titled “Desktop Notifications”yay -S --needed libnotify makoStatus Bar
Section titled “Status Bar”yay -S --needed pipewire-jack waybar