Arch Linux is a minimalist rolling-release distribution: a basic skeleton is installed, everything else is up to taste. Installing manually (without an installer) is part of the philosophy: afterwards you understand the system down to the last file.
Preparation#
- Image — the latest ISO from archlinux.org
- Writing to USB —
ddor Rufus/Ventoy - Booting from USB — in UEFI mode (the motherboard's boot menu)
# Write the image to the stick (careful with of= — everything on the partition is wiped)
dd if=archlinux-x86_64.iso of=/dev/sdX bs=4M status=progress
Disk partitioning#
A typical UEFI scheme: ESP on /boot + root on the rest:
# Disks and mount points
lsblk
# GPT table
parted /dev/sda mklabel gpt
# ESP on /boot and the root partition
parted /dev/sda mkpart ESP fat32 1MiB 513MiB
parted /dev/sda set 1 esp on
parted /dev/sda mkpart primary 513MiB 100%
# File systems
mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
Mounting — before installing anything:
mount /dev/sda2 /mnt
mount --mkdir /dev/sda1 /mnt/boot
Networking on the ISO comes up by itself (Ethernet). Wi-Fi:
iwctl→station wlan0 scan/station wlan0 connect <SSID>.
Base system#
# Time sync check (UTC on the ISO)
timedatectl
# Keys and repository lists are fresh: update the keyring right away
pacman -Sy archlinux-keyring
# Install the skeleton into /mnt
pacstrap -K /mnt base base-devel linux linux-firmware amd-ucode
# fstab by UUID
genfstab -U /mnt > /mnt/etc/fstab
# Move into the new system
arch-chroot /mnt
amd-ucode— microcode for AMD CPUs; for Intel installintel-ucode. Proprietary Wi-Fi/audio firmware — the separatelinux-firmwarepackage already includes the main set.
System configuration#
# Time zone and hardware clock
ln -sf /usr/share/zoneinfo/Europe/Minsk /etc/localtime
hwclock --systohc
# Locales
echo "ru_RU.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
echo "LANG=ru_RU.UTF-8" > /etc/locale.conf
# Host name
echo "archlinux" > /etc/hostname
/etc/hosts — a hostname entry so services don't complain about resolving:
cat > /etc/hosts <<'EOF'
127.0.0.1 localhost
127.0.1.1 archlinux
::1 localhost
EOF
Root password:
passwd
Boot loader#
A UEFI layout — GRUB is installed into the ESP:
pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
BIOS mode (legacy): the same
grub-install /dev/sda, but then the ESP is not needed. If another OS sits nearby: theos-proberpackage and the lineGRUB_DISABLE_OS_PROBER=falsein/etc/default/grubbeforegrub-mkconfig.
A user#
Working as root is a bad habit; create a regular user with sudo:
useradd -m -G wheel -s /bin/bash admin
passwd admin
pacman -S sudo
sudo reads the
/etc/sudoers.d/directory — no need to edit the vendor sudoers:echo "%wheel ALL=(ALL:ALL) ALL" > /etc/sudoers.d/10-wheel chmod 440 /etc/sudoers.d/10-wheel
Desktop environment#
# Xorg
pacman -S xorg-server xorg-xinit xorg-apps
# The i3 tiling manager + a display manager
pacman -S i3-wm i3lock i3status
pacman -S lightdm lightdm-gtk-greeter
systemctl enable lightdm
Not an i3 fan: the full-blown option is
pacman -S plasma sddm(KDE Plasma) orpacman -S gnome gdm. The tiling stack (i3 + status) is an order of magnitude lighter.
Reboot and first steps#
exit # leave the chroot
reboot # with the stick pulled out
# Now inside your own system: update everything and install the usual packages
pacman -Syu
pacman -S git curl neovim
pacman and AUR tricks#
# Search and info
pacman -Ss nginx # search the repositories
pacman -Qi nginx # info about an installed package
pacman -Ql nginx # the package's file list
pacman -Qo /usr/bin/nginx # who owns a file
# Explicitly installed packages — a backup of the system's composition
pacman -Qe | awk '{print $1}' > pkglist.txt
pacman -S --needed - < pkglist.txt # restore on a new machine
# The package cache eats a lot: keep 2 versions of each package
pacman -S pacman-contrib
paccache -rk2
# Orphans — packages no explicitly installed one depends on
pacman -Rns $(pacman -Qdtq)
# Fresh fast mirrors into the mirrorlist
pacman -S reflector
reflector --country BY,PL --sort rate --latest 10 --save /etc/pacman.d/mirrorlist
Rolling release = update regularly, not once every six months:
pacman -Syuonce a week or two. A problematic frequently-updating package (e.g. the kernel) can be frozen withIgnorePkg = linuxin/etc/pacman.conf— at your own risk.
AUR is the community repository with "everything imaginable"; packages are
installed via a helper (paru or yay): paru -S <package-name>. The helper
pulls the PKGBUILD, builds the package and registers it in the pacman
database. Security rule: read the PKGBUILD before building and never run the
helper as root.