Arch Linux
A x86-64 general-purpose Linux distribution that proves the latest stable version of most software by following a rolling release model.
Documentation: https://wiki.archlinux.org/title/Main_page
Repository: https://gitlab.archlinux.org/archlinux
Package Managers
Pacman
sudo pacman -Syu # update everything
sudo pacman -S <package> # install a package
sudo pacman -Ss <search-term> # search from remote packages
sudo pacman -Q # list all install packages
sudo pacman -Qs <search-term> # search from installed packages
sudo pacman -Qe # list expecitly installed packages
sudo pacman -R <package> # remove package
sudo pacman -Rns <package> # remove package and extra config/depenencies
# for searching, replace s with i in the command to get more information
Paru
- when downloading AUR packages, use
<package>-binfor a precompiled version (faster), or use<packge>to build it yourself (configurable).
# all pacman command work, just replace 'sudo pacman' with 'paru'
paru # update everything
paru <package> # search and install
paru -Sua # update AUR packages only
paru -Qua # print available updates
Flatpak
# alternative app store. containerizes and resticts apps
sudo pacman -S flatpak
# additional protection tool
flathub flatpak install flathub com.github.tchx84.Flatseal
flatpak run com.github.tchx84.Flatseal
Build Package Manually
# manually build package (reference)
# https://www.youtube.com/watch?v=tCDy54Zc2Cw
# first time steps
vim /etc/makekpkg.conf
# uncomment MAKEFLATS line and set value to cpu threads + 1
# ex. 20 threads cpu: MAKEFLAGS='-j21'
mkdir -p ~/downloads/packages
# read PKGBUILD files before running makepkg
# check dependencies, conflicts, and commands at the bottom
# --- from source code --- #
# download
cd ~/downloads/packages
git clone https://aur.archlinux.org/paru.git
# build
cd paru
makepkg -si
# update
cd ~/downloads/packages
cd paru
git pull
makepkg -si
# --- from tar.zst --- #
# download
cd ~/downloads/packages
wget https://github.com/Morganamilo/paru/releases/download/v2.0.4/paru-v2.0.4-x86_64.tar.zst
# build
sudo pacman -U paru-v2.0.4-x86_64.tar.zst
Guides:
- https://gist.github.com/mjkstra/96ce7a5689d753e7a6bdd92cdc169bae
- https://gist.github.com/dante-robinson/fdc55726991d3f17e0dbef1701d343ef
- https://gist.github.com/yovko/512326b904d120f3280c163abfbcb787
Install
-
Download Arch ISO
-
Mount Arch ISO onto a USB with either option below (Ventoy is easier).
-
Disable secure boot in BIOS.
-
Boot into USB with Arch ISO.
-
Increase font size.
# medium
setfont ter-928n
# large
setfont ter-132b
- Connect to a WiFi network (skip for Ethernet).
# connect to network
iwctl --passphrase <password> station <device> connect <ssid>
If WiFi device and SSID are unknown use the following.
# enter network configuration
iwctl
# list avalible devices, use the correct device name for next steps as <device> ex. wlan0
device list
# connect to a network
station <device> scan
station <device> get-networks
station <device> connect <ssid>
# exit iwctl
exit
- Test network connection.
ping -c 5 ping.archlinux.org
- Set timezone.
# list timezones
timedatectl list-timezones
# type / to start searching
# set timezone, <timezone> ex. America/Toronto
timedatectl set-timezone <timezone>
# verify
timedatectl
- (optional) SSH into machine.
# set temporary passwd
passwd
systemctl start sshd
# note ip address
ip addr
Connect from a remote machine with ssh root@<lan-ip>.
-
Partition the disks.
- Run
cfdisk. - Select GPT as label type.
- Identify desired OS drive and delete any partitions of needed (select Write after changes).
- Select Free Space, then select New to create the following partitions:
- 4G - EFI/Boot
- Remaining - Root filesystem
- Select the boot partition, then select Type and set to EFI System.
- Select Write, type
yes, then select Quit.
- Run
-
Identify created partitions.
lsblk -f
- Format boot partition.
# <boot-partition> ex. nvme0n1p1
mkfs.fat -F 32 -n boot /dev/<boot-partition>
- Setup one of the following filesystems.
# <root-partition> ex. nvme0n1p2, <partition-label> ex. nvme-os
mkfs.btrfs -L <partition-label> /dev/<root-partition>
# create subvolumes
mount /dev/<root-partition> /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@log
btrfs subvolume create /mnt/@cache
umount /mnt
# mount subvolumes
mount --mkdir -o compress=zstd,noatime,subvol=@ /dev/<root-partition> /mnt
mount --mkdir -o compress=zstd,noatime,subvol=@home /dev/<root-partition> /mnt/home
mount --mkdir -o compress=zstd,noatime,subvol=@log /dev/<root-partition> /mnt/var/log
mount --mkdir -o compress=zstd,noatime,subvol=@cache /dev/<root-partition> /mnt/var/cache
# mount boot partition
mount --mkdir /dev/<boot-partition> /mnt/boot
# <root-partition> ex. nvme0n1p2, <partition-label> ex. nvme-os
mkfs.ext4 -L <partition-label> /dev/<root-partition>
mount --mkdir /dev/<root-partition> /mnt
mount --mkdir /dev/<boot-partition> /mnt/boot
- Install Linux and base packages.
# base linux linux-firmware linux-headers standard system packages
# intel-ucode or amd-ucode cpu
# base-devel package build tools
# network manager network
# helix or vim editor
# btrfs-progs (if needed) btrfs user utilites
# limine efibootmgr bootloader
# man-db man-pages manuals
# git curl wget rsync zip unzip basic network and file tools
pacstrap /mnt base linux linux-firmware linux-headers intel-ucode base-devel networkmanager helix btrfs-progs limine efibootmgr man-db man-pages git curl wget rsync zip unzip
# fetch the disk mounting points
genfstab -U /mnt >> /mnt/etc/fstab
# verify that it matches step 10
cat /mnt/etc/fstab
# move to system
arch-chroot /mnt
- Setup timezone and locale.
# set timezone and sync hardware clock, <region>/<city> ex. America/Toronto
ln -sf /usr/share/zoneinfo/<region>/<city> /etc/localtime
hwclock --systohc
# set language, search for correct UTF-8 locale inside /etc/locale.gen if using another
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "KEYMAP=us" > /etc/vconsole.conf
- Setup Hostname and User.
# set hostname ex. <hostname> jimbo
echo "<hostname>" > /etc/hostname
# create host file entries, add following lines
echo "127.0.1.1 <hostname> <hostname>.local" >> /etc/hosts
# set root password
passwd
# add new user with sudo permissions ex. <user>: bimbo
useradd -mG wheel <user>
passwd <user>
# uncomment line saying 'allow members of group wheel to execute any command'
EDITOR=vim visido
- Setup Limeline bootloader.
mkinitcpio -P
mkdir -p /boot/EFI/limine
cp /usr/share/limine/BOOTX64.EFI /boot/EFI/limine/
# create bootloader entry in NVRAM, <boot-disk> ex. nvme0n1, <boot-partition-num> ex. 1
efibootmgr --create --disk /dev/<boot-disk> --part <boot-partition-num> --label "Arch Linux Limine Bootloader" --loader '\EFI\limine\BOOTX64.EFI' --unicode
# add UUID and machine id to limine config file, delete it later
blkid -o value -s UUID /dev/<root-partition> >> /boot/limine.conf
cat /etc/machine-id >> /boot/limine.conf
Edit /boot/limine.conf:
- use first line as
<uuid>. - use second line as
<machine-id>.
timeout: 5
default_entry: 2
comment: machine-id=<machine-id>
/+Arch Linux
//Linux
protocol: linux
path: boot():/vmlinuz-linux
module_path: boot():/initramfs-linux.img
cmdline: root=UUID=<uuid> rw rootflags=subvol=@ quiet splash
//Snapshots
- Finish Up.
# enable network manager
systemctl enable NetworkManager
ping -c 5 ping.archlinux.org
# exit and reboot
exit
umount -R /mnt
reboot
- Login to created user and enable time sync.
timedatectl set-ntp true
Post-Install
Network
- Connect to WiFi.
nmcli device wifi list # list networks
nmcli device wifi connect <ssid> password <password> # connect to network
- (optional) Use correct WiFi regulations for potentially better speed.
sudo pacman -S wireless-regdb
# uncomment one country code line in `/etc/conf.d/wireless-regdom`
Package Managers
- Update Mirrors.
sudo pacman -S reflector
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
sudo reflector --verbose --latest 10 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
-
Edit these lines in
/etc/pacman.conf.- Uncomment
color. - Change
ParellelDownloadsto 20. - Add
ILoveCandy. - Uncomment
[multilib]and following line.
- Uncomment
-
Update System.
sudo pacman -Syu
- Install Paru.
sudo pacman -S --needed rustup base-devel git && rustup default stable && git clone https://aur.archlinux.org/paru.git && cd paru && makepkg -si && cd .. && rm -rf paru
- Uncomment
BottomUpfrom/etc/paru.conf. - Install CachyOS packages https://wiki.cachyos.org/features/optimized_repos/.
curl https://mirror.cachyos.org/cachyos-repo.tar.xz -o cachyos-repo.tar.xz
tar xvf cachyos-repo.tar.xz && cd cachyos-repo
sudo ./cachyos-repo.sh
SSH
sudo pacman -S openssh
sudo systemctl enable --now sshd
See more in SSH to configure keys and hardening.
Firewall
sudo pacman -S ufw
sudo systemctl enable --now ufw
# allow ssh and enable
sudo ufw limit ssh
sudo ufw enable
Snapper and Limine
- Install requirements.
# snapper better btrfs snapshot utility
# snap-pac auto-generate snapshots for pacman
# btrfs-assistant gui for btrfs
# limine-snapper-sync auto-generate snapshot boot entries
# limine-mkinitcpio-hook auto-regenerate bootloader
sudo pacman -S snapper snap-pac btrfs-assistant
paru -S limine-snapper-sync limine-mkinitcpio-hook
-
Edit snapper default template
/usr/share/snapper/config-templates/default.- Set
NUMBER_MIN_AGEto 1800. - Set
TIMELINE_CLEANUP_AGEto 1800. - Set
EMPTY_PRE_POST_MIN_AGEto 1800. - Set Timeline limits:
- Hourly: 12
- Daily: 7
- all others: 0
- Set
-
Create snapper configs.
sudo snapper -c root create-config /
sudo snapper -c home create-config /home
-
Edit limine snapper sync config
/etc/limine-snapper-sync.conf.- Set
EXCLUDE_SNAPSHOT_TYPESto"pre, post". - Set
MAX_SNAPSHOT_ENTRIESto 21. - Set
SNAPSHOT_FORMAT_CHOICEto 8.
- Set
Edit /etc/default/limine:
ESP_PATH="/boot"
KERNEL_CMDLINE[default]+="quiet nowatchdog splash rw rootflags=subvol=/@ root=UUID=<uuid>"
BOOT_ORDER="*, *lts, *fallback, Snapshots"
Remove the original non-autogenerated entry from boot/limine.conf.
Swap
sudo pacman -S zram-generator
echo -e "[zram0]\nzram-size = ram" | sudo tee /etc/systemd/zram-generator.conf
systemctl daemon-reload
systemctl start systemd-zram-setup@zram0
Audio
# sof-firmware firmware for some soundcards
# pipwire and others audio utils
# wiremix TUI for audio controls
sudo pacman -S sof-firmware pipewire wireplumber alsa-utils pipewire-alsa pipewire-pulse pipewire-jack wiremix
systemctl --user --now enable pipewire pipewire-pulse wireplumber
Bluetooth
sudo pacman -S bluez bluez-utils
auso systemctl enable --now bluetooth
GPU Drivers
NVIDIA
- Install drivers.
sudo pacman -S nvidia-open nvidia-settings nvidia-utils lib32-nvidia-utils libva-nvidia-driver
- Add modules to
/etc/mkinitcpio.conf.
MODULES=(... nvidia nvidia_modeset nvidia_uvm nvidia_drm)
- Regenerate initramfs.
sudo mkinitcpio -P
Splash Screen
- Install plymouth.
sudo pacman -S plymouth
- Add plymouth hook after systemd to
/etc/mkinitcpio.conf.
MODULES=(.. systemd plymouth ...)
- Regenerate initramfs.
sudo mkinitcpio -P
- Set theme.
paru -S plymouth-theme-lone-git
sudo plymouth-set-default-theme -R lone
Find more themes: https://github.com/adi1090x/plymouth-themes.
XDG
sudo pacman -S xdg-user-dirs
Modify user directories ~/.config/user-dirs.dirs
XDG_DESKTOP_DIR="$HOME/.local/Desktop"
XDG_DOCUMENTS_DIR="$HOME/Storage"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_MUSIC_DIR="$HOME/"
XDG_PICTURES_DIR="$HOME/"
XDG_PROJECTS_DIR="$HOME/Projects"
XDG_PUBLICSHARE_DIR="$HOME/"
XDG_TEMPLATES_DIR="$HOME/"
XDG_VIDEOS_DIR="$HOME/"
Fonts
sudo pacman -S noto-fonts noto-fonts-emoji ttf-iosevka-nerd
Desktop Environment
Hyperland (WM)
# hyprland and other hyprland
# kitty terminal emulator
# nautilus file manger
# waybar pacman-contrib status bar
# swaync notifications
# hyprlock lockscreen
# hypridle auto lock
# hyprshot screenshot
# hyprsunset blue light filter
# awww wallpaper
# nwg-look gtk-theming
# gnome-keyring seahorse authentication
# vicinae launcher
sudo pacman -S hyprland xdg-desktop-portal-hyprland xdg-desktop-portal-gtk hyprpolkitagent kitty nautilus waybar pacmand-contrib swaync hyprlock hypridle hyprshot hyprsunset awww nwg-look gnome-keyring seahorse
paru -S vicinae-bin
Greeter
sudo pacman -S greetd greetd-tuigreet
sudo systemctl enable greetd
Edit /etc/greetd/config.toml:``
- Change
[default_session]command to"tuigreet --cmd start-hyprland". - For autologin, add following lines, replace
<user>.
[initial_session]
command = "start-hyprland"
user = "jay"
Final Config
[terminal]
vt = 1
[default_session]
command = "tuigreet --cmd start-hyprland"
user = "greeter"
[initial_session]
command = "start-hyprland"
user = "jay"
Gaming
# steam
# mangohud detailed fps and system overlay
# protonup-qt-bin proton version manager
sudo pacman -S steam mangohud protonup-qt-bin
- Install Proton GE with protonup.
- Enable compatibility and use Proton GE in steam.
- Set launch arguments below for each game.
- LD_PRELOAD=“” - fixes stuttering in game.
- other are for HDR.
LD_PRELOAD=“” PROTON_ENABLE_HDR=1 PROTON_ENABLE_WAYLAND=1 %command%
Gamescope
LD_PRELOAD=“” gamescope -w 3440 -h 1440 --fullscreen -r 165 --hdr-enabled --hdr-debug-force-output -- env ENABLE_GAMESCOPE_WSI=1 DXVK_HDR=1 %command%