# Modern Arch linux installation guide # Table of contents - [Introduction](#introduction) - [Preliminary Steps](#preliminary-steps) - [Main installation](#main-installation) - [Disk partitioning](#disk-partitioning) - [Disk formatting](#disk-formatting) - [Disk mounting](#disk-mounting) - [Packages installation](#packages-installation) - [Fstab](#fstab) - [Context switch to our new system](#context-switch-to-our-new-system) - [Set up the time zone](#set-up-the-time-zone) - [Set up the language and tty keyboard map](#set-up-the-language-and-tty-keyboard-map) - [Hostname and Host configuration](#hostname-and-host-configuration) - [Root and users](#root-and-users) - [Grub configuration](#grub-configuration) - [Unmount everything and reboot](#unmount-everything-and-reboot) - [Automatic snapshot boot entries update](#automatic-snapshot-boot-entries-update) - [Virtual machine \[Optional\]](#virtual-machine-optional) - [Aur helper and additional packages installation \[Optional\]](#aur-helper-and-additional-packages-installation-optional) - [Finalization](#finalization) - [Video drivers](#video-drivers) - [Amd](#amd) - [32 Bit support](#32-bit-support) - [Nvidia](#nvidia) - [Intel](#intel) - [Setting up a graphical environment](#setting-up-a-graphical-environment) - [Option 1: KDE Plasma](#option-1-kde-plasma) - [Option 2: Hyprland \[WIP\]](#option-2-hyprland-wip) - [Adding a display manager](#adding-a-display-manager) - [Gaming](#gaming) - [Gaming clients](#gaming-clients) - [Windows compatibility layers](#windows-compatibility-layers) - [Generic optimizations](#generic-optimizations) - [Overclocking and monitoring](#overclocking-and-monitoring) - [Tips and tricks](#tips-and-tricks) - [Things to add \[WIP\]](#things-to-add-wip) # Introduction In this guide I'll show how to install **Arch Linux** with **BTRFS** on an **UEFI system**. I'll comment each step to make it understandable. Apart from the basic terminal installation I'll add steps to install video drivers, a desktop environment and to configure arch for gaming.
The goal of this guide is to help new users interface with Arch Linux by summarizing the main installation processes and grouping up further configuration choices as well as providing a **modern, minimilastic and personal** touch to it, which consists in "design" choices. Because of this reasons, when possible I've added external references if one wants to dive more into the details.
I **won't** prepare the system for **secure boot** because the procedure of custom key enrollment in the BIOS is dangerous and can lead to a bricked system, read the warnings [here](https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#Creating_and_enrolling_keys). If you are wondering why not using the default OEM keys in the BIOS, it's because they will make secure boot useless by being most likely not enough secure, as the arch wiki [states](https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#Implementing_Secure_Boot).
I **won't** encrypt the system because I don't need it. Also note that encryption always adds a little bit of overhead and that the boot would become inevitably **slower to varying degrees**, depending on your configuration. However it may be important in other scenarios, so if you really wanna go this way I recommend reading [the wiki page in this regards](https://wiki.archlinux.org/title/Dm-crypt) and **must** perform the documented steps **IMMEDIATELY AFTER** [disk partitioning](#disk-partitioning)
I'll **skip** the Arch ISO download, gpg signature check and installation media preparation.
I'll use a **wired** connection, so no wireless configuration steps will be shown. If you want to connect to wifi, you can either launch `wifi-menu` from the terminal which is a **TGUI** or use [`iwctl`](https://wiki.archlinux.org/title/Iwd#iwctl).
# Preliminary steps First set up your keyboard layout ```Zsh # List all the available keyboard maps and filter them through grep, in this case i am looking for an italian keyboard, which usually starts with "it", for english filter with "en" ls /usr/share/kbd/keymaps/**/*.map.gz | grep it # If you prefer you can scroll the whole list like this ls /usr/share/kbd/keymaps/**/*.map.gz | less # Or like this localectl list-keymaps # Now get the name without the path and the extension ( localectl returns just the name ) and load the layout. In my case it is simply "it" loadkeys it ```
Check that we are in UEFI mode ```Zsh # If this command prints 64 or 32 then you are in UEFI cat /sys/firmware/efi/fw_platform_size ```
Check the internet connection ```Zsh ping -c 5 archlinux.org ```
Check the system clock just in case ```Zsh # Check if ntp is active and if the time is right timedatectl ```
# Main installation ## Disk partitioning I will make 2 partitions: | Number | Type | Size | | --- | --- | --- | | 1 | EFI | 512 Mb | | 2 | Linux Filesystem | 99.5Gb \(all of the remaining space \) |
```Zsh # Check the drive name. Mine is /dev/nvme0n1 # If you have an hdd is something like sdax fdisk -l # Invoke fdisk to partition fdisk /dev/nvme0n1 # Now press the following commands, when i write ENTER press enter g ENTER n ENTER ENTER ENTER +512M ENTER t ENTER ENTER 1 ENTER n ENTER ENTER ENTER # If you don't want to use all the space then select the size by writing +XG ( eg: to make a 10GB partition +10G ) p ENTER # Now check if you got the partitions right # If so write the changes w ENTER # If not you can quit without saving and redo from the beginning q ENTER ```
## Disk formatting As a file system I've chosen to use **BTRFS** which has evolved quite a lot during the years. It has a set of incredible functionalities but is most known for its **Copy on Write** feature which enables it to make system snapshots in a blink of a an eye and to save a lot of disk space, which can be even saved to a greater extent by eanbling **compression**. Also it enables the creation of **subvolumes** which can be individually snapshotted. Learn more [here](https://wiki.archlinux.org/title/Btrfs) ```Zsh # Find the efi partition with fdisk -l or lsblk. For me it's /dev/nvme0n1p1 and format it. mkfs.fat -F 32 /dev/nvme0n1p1 # Find the root partition. For me it's /dev/nvme0n1p2 and format it. I will use BTRFS. mkfs.btrfs /dev/nvme0n1p2 # Mount the root fs to make it accessible mount /dev/nvme0n1p2 /mnt ```
## Disk mounting ```Zsh # Create the subvolumes, in my case I choose to make a subvolume for / and one for /home. Subvolumes are identified by prepending @ btrfs subvolume create /mnt/@ btrfs subvolume create /mnt/@home # The list of subvolumes will be increased in a later release of this guide, upon proper testing. # Current plans are to add the following subvolumes: @log @cache @tmp. This way they they won't be included when snapshotting the root subvolume ( ie: @ ) # Unmount the root fs umount /mnt ```
For this guide I'll compress the btrfs subvolumes with **Zstd**, which has proven to be [a good algorithm among the choices](https://www.phoronix.com/review/btrfs-zstd-compress) ```Zsh # Mount the root and home subvolume. If you don't want compression just remove the compress option. mount -o compress=zstd,subvol=@ /dev/nvme0n1p2 /mnt mkdir -p /mnt/home mount -o compress=zstd,subvol=@home /dev/nvme0n1p2 /mnt/home ```
Now we have to mount the efi partition. In general there are 2 main mountpoints to use: `/efi` or `/boot` but in this configuration i am **forced** to use `/efi`, because by choosing `/boot` we could experience a **system crash** when trying to restore `@` _\( the root subvolume \)_ to a previous state after kernel updates. This happens because `/boot` files such as the kernel won't reside on `@` but on the efi partition and hence they can't be saved when snapshotting `@`. Also this choice grants separation of concerns and also is good if one wants to encrypt `/boot`, since you can't encrypt efi files. Learn more [here](https://wiki.archlinux.org/title/EFI_system_partition#Typical_mount_points) ```Zsh mkdir -p /mnt/efi mount /dev/nvme0n1p1 /mnt/efi ```
## Packages installation ```Zsh # This will install some packages to "bootstrap" methaphorically our system. Feel free to add the ones you want # "base, linux, linux-firmware" are needed # "base-devel" base development packages # "git" to install the git vcs # "btrfs-progs" are user-space utilities for file system management ( needed to harness the potential of btrfs ) # "grub" the bootloader # "efibootmgr" needed to install grub # "grub-btrfs" adds btrfs support for the grub bootloader and enables the user to directly boot from snapshots # "inotify-tools" used by grub btrfsd deamon to automatically spot new snapshots and update grub entries # "timeshift" a GUI app to easily create,plan and restore snapshots using BTRFS capabilities # "amd-ucode" microcode updates for the cpu. If you have an intel one use "intel-ucode" # "vim" my goto editor, if unfamiliar use nano # "networkmanager" to manage Internet connections both wired and wireless ( it also has an applet package network-manager-applet ) # "pipewire pipewire-alsa pipewire-pulse pipewire-jack" for the new audio framework replacing pulse and jack. You should be prompted to choose a session manager, I'll choose Wireplumber. # "reflector" to manage mirrors for pacman # "zsh" my favourite shell # "zsh-completions" for zsh additional completions # "zsh-autosuggestions" very useful, it helps writing commands [ Needs configuration in .zshrc ] # "openssh" to use ssh and manage keys # "man" for manual pages # "sudo" to run commands as other users pacstrap -K /mnt base base-devel linux linux-firmware git btrfs-progs grub efibootmgr grub-btrfs inotify-tools timeshift vim networkmanager pipewire pipewire-alsa pipewire-pulse pipewire-jack reflector zsh zsh-completions zsh-autosuggestions openssh man sudo ```
## Fstab ```Zsh # Fetch the disk mounting points as they are now ( we mounted everything before ) and generate instructions to let the system know how to mount the various disks automatically genfstab -U /mnt >> /mnt/etc/fstab # Check if fstab is fine cat /mnt/etc/fstab ```
## Context switch to our new system ```Zsh # To access our new system we chroot into it arch-chroot /mnt ```
## Set up the time zone ```Zsh # In our new system we have to set up the local time zone, find your one in /usr/share/zoneinfo mine is /usr/share/zoneinfo/Europe/Rome and create a symbolic link to /etc/localtime ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime # Now sync the time to the hardware clock hwclock --systohc ```
## Set up the language and tty keyboard map Edit `/etc/locale.gen` and uncomment the entries for your locales, this will "**enable**" \( **NOT ACTIVATE** \) the language but also formats for time, date, currency and other country related settings. In my case I will uncomment _\( ie: remove the # \)_ `en_US.UTF-8 UTF-8` and `it_IT.UTF-8 UTF-8` because I use English as a "display" language and Italian for date, time and other formats. ```Zsh # To edit I will use vim, feel free to use nano instead. vim /etc/locale.gen # Now generate the locales locale-gen ```
Create the configuration file `/etc/locale.conf` and set the locale to the desired one, by setting the `LANG` variable accordingly. In my case I'll write `LANG=it_IT.UTF-8` to apply Italian settings to everything and then override only the display language to English by setting `LC_MESSAGES=en_US.UTF-8`. _\( if you want formats and language to stay the same **DON'T** set `LC_MESSAGES` \)_. More on this [here](https://wiki.archlinux.org/title/Locale#Variables) ```Zsh touch /etc/locale.conf vim /etc/locale.conf ```
Now to make the current keyboard layout permanent for tty sessions , create `/etc/vconsole.conf` and write `KEYMAP=your_key_map` substituting the keymap with the one previously set [here](#preliminary-steps). In my case `KEYMAP=it` ```Zsh vim /etc/vconsole.conf ```
## Hostname and Host configuration ```Zsh # Create /etc/hostname then choose and write the name of your pc in the first line. In my case I'll use Arch touch /etc/hostname vim /etc/hostname # Create the /etc/hosts file. This is very important because it will resolve the listed hostnames locally and not over the Internet. touch /etc/hosts ``` Write the following ip, hostname pairs inside /etc/hosts, replacing Arch with **YOUR** hostname: ``` 127.0.0.1 localhost ::1 localhost 127.0.1.1 Arch ``` ```Zsh # Edit the file with the information above vim /etc/hosts ```
## Root and users ```Zsh # Set up the root password passwd # Add a new user, in my case mjkstra. # -m creates the home dir automatically # -G adds the user to an initial group, in this case is wheel, the administration group. useradd -mG wheel mjkstra passwd mjkstra # Uncomment the wheel group to allow execution of any command( ie: remove the # from the wheel line ). if you want to use nano then write EDITOR=nano instead. EDITOR=vim visudo ```
## Grub configuration Now I'll [deploy grub](https://wiki.archlinux.org/title/GRUB#Installation) ```Zsh grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB ```
Generate the grub configuration ( it will include the microcode installed with pacstrap earlier ) ```Zsh grub-mkconfig -o /boot/grub/grub.cfg ```
## Unmount everything and reboot ```Zsh # Enable newtork manager before rebooting otherwise, you won't be able to connect systemctl enable NetworkManager # Exit from chroot exit # Unmount everything to check if the drive is busy umount -R /mnt # Reboot the system and unplug the installation media reboot # Enable and start the time synchronization service timedatectl set-ntp true ```
## Automatic snapshot boot entries update Edit **`grub-btrfsd`** service to enable **automatic grub entries update** each time a snapshot is created. Because I will use timeshift i am going to replace `ExecStart=...` with `ExecStart=/usr/bin/grub-btrfsd --syslog --timeshift-auto`. If you don't use timeshift or prefer to manually update the entries then lookup [here](https://github.com/Antynea/grub-btrfs) ```Zsh sudo systemctl edit --full grub-btrfsd # Enable grub-btrfsd service to run on boot sudo systemctl enable grub-btrfsd ```
## Virtual machine \[Optional\] Follow these steps if you are running Arch on a Virtualbox VM. ```Zsh # Install the guest utils pacman -S virtualbox-guest-utils # Enable this service to automatically load the kernel modules systemctl enable vboxservice.service ``` > Note: the utils will only work after a reboot is performed. > Warning: the utils seems to only work in a graphical environment.
## Aur helper and additional packages installation \[Optional\] To gain access to the arch user repository we need an aur helper, I will choose yay which also works as a pacman wrapper \( which means you can use yay instead of pacman. Cool, right ? \). Yay has a CLI, but if you later want to have an aur helper with a GUI, I advise installing [`pamac`](https://gitlab.manjaro.org/applications/pamac), which is the default on Manjaro. To learn more about yay read [here](https://github.com/Jguer/yay#yay) > Note: you can't execute makepkg as root, so you need to log in your main account. For me it's mjkstra ```Zsh # Install yay pacman -S --needed git base-devel && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si # Install "timeshift-autosnap", a configurable pacman hook which automatically makes snapshots before pacman upgrades. yay -S timeshift-autosnap ``` > Learn more about timeshift autosnap [here](https://gitlab.com/gobonja/timeshift-autosnap)
## Finalization ```Zsh # To complete the main/basic installation reboot the system reboot ``` > After these steps you **should** be able to boot on your newly installed Arch Linux, if so congrats ! > The basic installation is complete and you could stop here, but if you want to to have a graphical session, you can continue reading the guide.
# Video drivers In order to have the smoothest experience on a graphical environment, **Gaming included**, we first need to install video drivers. To help you choose which one you want or need, read [this section](https://wiki.archlinux.org/title/Xorg#Driver_installation) of the arch wiki. > Note: skip this section if you are on a Virtual Machine
## Amd For this guide I'll install the [**AMDGPU** driver](https://wiki.archlinux.org/title/AMDGPU) which is the open source one and the recommended, but be aware that this works starting from the **GCN 3** architecture, which means that cards **before** RX 400 series are not supported. _\( FYI I have an RX 5700 XT \)_ ```Zsh # What are we installing ? # mesa: DRI driver for 3D acceleration # xf86-video-amdgpu: DDX driver for 2D acceleration in Xorg # vulkan-radeon: vulkan support # libva-mesa-driver: VA-API h/w video decoding support # mesa-vdpau: VDPAU h/w accelerated video decoding support sudo pacman -S mesa xf86-video-amdgpu vulkan-radeon libva-mesa-driver mesa-vdpau ``` ### 32 Bit support *IF* you want add **32-bit** support, we need to enable the `multilib` repository on pacman: edit `/etc/pacman.conf` and uncomment the `[multilib]` section _\( ie: remove the hashtag from each line of the section. Should be 2 lines \)_. Now we can install the additional packages. ```Zsh # Refresh and upgrade the system yay # Install 32bit support for mesa, vulkan, VA-API and VDPAU pacman -S lib32-mesa lib32-vulkan-radeon lib32-libva-mesa-driver lib32-mesa-vdpau ```
## Nvidia In summary if you have an Nvidia card you have 2 options: 1. [**Nouveau** open source driver](https://wiki.archlinux.org/title/Nouveau) 2. [**NVIDIA** proprietary driver](https://wiki.archlinux.org/title/NVIDIA) I won't explain further because I don't have an Nvidia card and the process for such cards is tricky unlike for AMD or Intel cards. Moreover for reason said before, I can't even test it.
## Intel Installation looks almost identical to the AMD one, but every time a package contains the `radeon` word substitute it with `intel`. However this does not stand for [h/w accelerated decoding](https://wiki.archlinux.org/title/Hardware_video_acceleration), and to be fair I would recommend reading [the wiki](https://wiki.archlinux.org/title/Intel_graphics#Installation) before doing anything.
# Setting up a graphical environment I'll provide 2 options: 1. **KDE-plasma** 2. **Hyprland** On top of that I'll add a **display manager**, which you can omit if you don't like ( if so, you have additional configuration steps to perform ).
## Option 1: KDE-plasma **KDE Plasma** is a very popular DE which comes bundled in many distributions. It supports both the older more stable **Xorg** and the newer **Wayland** protocols. It's **user friendly** and also it's used on the Steam Deck, which makes it great for **gaming**. I'll provide the steps for a minimal installation and add some basic packages. ```Zsh # Install the plasma desktop environment, the audio and network applets, task manager, screen configurator, global shortcuts, power manager, some useful basic addons, configuration for GTK application theming and other package of personal interest pacman -S plasma-desktop plasma-pa plasma-nm plasma-systemmonitor kscreen khotkeys powerdevil kdeplasma-addons kde-gtk-config breeze-gtk alacritty dolphin firefox kate okular mpv gimp ``` Now don't reboot your system yet. If you want a display manager, which is generally recommended, head to the [related section](#adding-a-display-manager) in this guide and proceed from there otherwise you'll have to [manually configure](https://wiki.archlinux.org/title/KDE#From_the_console) and launch the graphical environment each time \(which I would advise to avoid\).
## Option 2: Hyprland [WIP] > Note: this section needs configuration and is basically empty, I don't know when and if I will expand it but at least you have a starting point, which is the wiki, the master tutorial and some packages to start with
**Hyprland** is a **tiling WM** that sticks to the wayland protocol. It looks incredible and it's one of the best Wayland WMs right now. It's based on **wlroots** the famous library used by Sway, the most mature Wayland WM there is. I don't know if I would recommend this to beginners because it's a different experience from Windows/Ubuntu/PopOs and distros like that. Moreover it requires you to read the [wiki](https://wiki.hyprland.org/) for configuration but it also features a [master tutorial](https://wiki.hyprland.org/Getting-Started/Master-Tutorial), which serves as a great starting point. The good part is that even if it seems discouraging, it's actually an easy read because it is written beautifully, sometimes even better than the Arch wiki ! ```Zsh # Install hyprland from tagged releases and other utils: # swaylock: the lockscreen # wofi: the wayland version of rofi, an application launcher, extremely configurable # waybar: a status bar for wayland wm's # dolphin: a powerful file manager from KDE applications # alacritty: a beautiful and minimal terminal application, super configurable pacman -S --needed hyprland swaylock wofi waybar dolphin alacritty # wlogout: a logout/shutdown menu yay -S wlogout ```
# Adding a display manager **Display managers** are useful when you have multiple DE or WMs and want to choose where to boot from in a GUI fashion, also they take care of the launch process. I'll show the installation process of **SDDM**, which is highly customizable and compatible. > Note: hyprland does not support any display manager, however SDDM is reported to work flawlessly from the [wiki](https://wiki.hyprland.org/Getting-Started/Master-Tutorial/#launching-hyprland) ```Zsh # Install SDDM sudo pacman -S sddm # Enable SDDM service to make it start on boot sudo systemctl enable sddm # If using KDE I suggest installing this to control the SDDM configuration from the KDE settings App pacman -S --needed sddm-kcm # Now it's time to reboot the system reboot ```
# Gaming Gaming on linux has become a very fluid experience, so I'll give some tips on how to setup your arch distro for gaming. Let's break down what is needed to game: 1. **Gaming client** ( eg: Steam, Lutris, Bottles, etc..) 2. **Windows compatibility layers** ( eg: Proton, Wine, DXVK, VKD3D ) Optionally we can have: 1. **Generic optimization** ( eg: gamemode ) 2. **Overclocking and monitoring software** ( eg: CoreCtrl, Mangohud ) 3. **Custom kernels**
## Gaming clients I'll install **Steam** and to access games from other launchers I'll use **Bottles**, which should be installed through **flatpak**. ```Zsh # Install steam and flatpak pacman -S steam flatpak # Install bottles through flatpak flatpak install flathub com.usebottles.bottles ```
## Windows compatibility layers Proton is the compatibility layer developed by Valve, which includes **DXVK**( DirectX 9-10-11 to Vulkan), **VKD3D** ( DirectX 12 to Vulkan ) and a custom version of **Wine**. It is embedded in Steam and can be enabled directly in Steam settings. A custom version of proton, **Proton GE** exists and can be used as an alternative if something is broken or doesn't perform as expected. Can be either downloaded manually, like explained [here](https://github.com/GloriousEggroll/proton-ge-custom#installation) or through yay as below. ```Zsh # Installation through yay yay -S proton-ge-custom-bin ``` > Tips: To have a more fluid shader compilation when using steam, enable from its settings **shader precaching** and **background processing of vulkan shaders**
## Generic optimizations We can use gamemode to gain extra performance. To enable it read [here](https://github.com/FeralInteractive/gamemode#requesting-gamemode) ```Zsh # Install gamemode pacman -S gamemode ```
## Overclocking and monitoring To live monitor your in-game performance, you can use **mangohud**. To enable it read [here](https://github.com/flightlessmango/MangoHud#normal-usage) ```Zsh # Install mangohud pacman -S mangohud ``` To overclock your system, i suggest installing [**corectrl**](https://gitlab.com/corectrl/corectrl) if you have an AMD Gpu or [**TuxClocker**](https://github.com/Lurkki14/tuxclocker) for NVIDIA.
### Tips and tricks > Tip: On KDE disabling mouse acceleration is simple, just go to the settings via the GUI and on the mouse section enable the flat acceleration profile. If not using KDE then read [here](https://wiki.archlinux.org/title/Mouse_acceleration) > Tip: To enable freesync or Gsync you can read [here](https://wiki.archlinux.org/title/Variable_refresh_rate), depending on your session \( Wayland or Xorg \) and your gfx provider \( Nvidia, AMD, Intel \) the steps may differ. On a KDE wayland session, you can directly enable it from the monitor settings under the name of **adaptive sync** > About custom kernels: To be fair I don't recommend changing the kernel to a custom one, for many reasons: > 1. You have to manually update it and recompile it each time unless you use a precompiled kernel from pacman or aur such as `linux-zen` > 2. Performance gain is little to none and sometimes it may results in losses with other scenarios > 3. In my opinion changing to a custom kernel should be considered only if you experience problems or for the sake of science
# Things to add [WIP] 1. Additional pacman configuration \( paccache, colors, download packages simultaneously \) 2. Reflector configuration