Arch Linux Installation Guide
Good morning, good afternoon or good evening, wherever you are reading this from. These installation instructions form the foundation of the Arch system that I use on my own machine. While it's important to always consult the official Arch wiki, my intention here is to provide a walkthrough on setting up your own system with the following stack:
- btrfs: A feature-rich, copy-on-write filesystem for Linux.
- encryption: LUKS disk encryption based on the dm-crypt kernel module.
- zram-generator: RAM compression for memory savings.
- timeshift: A system restore tool for Linux.
- COSMIC Alpha: A new desktop environment by System76.
My intention is to keep this guide up-to-date, and any feedback is more than welcome.
Let's get started!
Step 1: Creating a Bootable Arch Media Device
Here we will follow the Arch wiki:
i. Acquire an installation image here.
ii. Verify the signature on the downloaded ISO image (section 1.2 of the installation guide).
iii. Write your ISO to a USB (check out this guide).
iv. Insert the USB into your target device and boot into it.
Step 2: Setting Up Our System with the Arch ISO
- Create a password for the ISO root user with
passwd; and, - Ensure
sshdis running:systemctl status sshd(start withsystemctl start sshdif not).
i. Set the console keyboard layout (US by default):
- list available keymaps with
localectl list-keymaps; and, - load your keymap with
loadkeys <your-keymap>.
ii. Verify the UEFI boot mode:
iii. Connect to the internet:
- use
iwctlfor WiFi; and, - confirm your connection with
ping -c 2 archlinux.org.
iv. Set the timezone:
v. Partition your disk:
- list partitions with
lsblk; and, - open your target disk with
gdiskorfdiskto delete existing partitions and create two new ones.
The official Arch guide suggests a swap partition. This guide uses zram instead, which compresses data in RAM and avoids SSD wear. zram is only active when RAM is at or near capacity.
| Partition | Size | Type |
|---|---|---|
/dev/nvme0n1p1 | 1GB | EFI System |
/dev/nvme0n1p2 | Remaining space | Linux filesystem |
vi. Format your main partition:
# set up LUKS encryption
# format as btrfs
vii. Create btrfs subvolumes:
@ and @home as subvolume names. Do not rename them.
viii. Mount subvolumes:
ix. Format and mount the EFI partition:
x. Install base packages:
xi. Generate the filesystem table:
- Verify with
cat /mnt/etc/fstabthat all subvolumes and boot entries are present and correct before continuing.
xii. Change root into the new system:
You are now working within your new Arch system (i.e. not from the ISO) and you will now see that your prompt starts with #. Great work so far!
Step 3: Working Within Our New System
We are now working within our Arch system, chrooted in from the ISO. Let's continue with a few steps that we need to repeat (such as setting our root password, timezone, keymaps and language).
sudo).i. Configure the timezone and hardware clock:
In nvim /etc/locale.gen, uncomment your locale (e.g. en_US.UTF-8), write and exit, then run:
ii. Configure the hostname:
iii. Set the root password:
iv. Create a user (replace rad with your preferred username):
v. Set the mirrorlist:
vi. Install core packages:
vii. Install CPU microcode:
- Intel:
pacman -S intel-ucode - AMD:
pacman -S amd-ucode
viii. Install a desktop environment and display manager:
ix. Install other useful packages:
x. Configure mkinitcpio for LUKS + btrfs:
In nvim /etc/mkinitcpio.conf, update MODULES and HOOKS:
MODULES=(btrfs)
HOOKS=(base udev autodetect modconf kms keyboard keymap block encrypt filesystems)
udev-based — for a systemd-based initramfs replace encrypt with sd-encrypt. fsck is removed as btrfs uses btrfsck externally. Add usbhid and atkbd to MODULES if you need an external keyboard available at the LUKS prompt.Regenerate the initramfs:
xi. Configure GRUB:
Get the UUID of your LUKS partition and append it to the grub defaults file for reference:
Edit /etc/default/grub and set the following - replacing <uuid> with the value appended at the bottom of the file, then delete that line:
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet zswap.enabled=0 cryptdevice=UUID=<uuid>:main root=/dev/mapper/main"
Generate the GRUB config:
xii. Enable services:
xiii. Reboot:
Step 4: Tweaking Our New Arch System
When you boot up you will be presented with the GRUB bootloader menu. Once you have selected Arch Linux and entered your encryption password, ly will greet you. Log in with the user you created earlier.
i. Install paru:
ii. Install zram-generator:
zram compresses data and stores it in RAM, resulting in less SSD wear. zswap uses a compressed in-RAM cache in front of a disk-based swap partition. This guide uses zram. If you regularly exceed your RAM ceiling, zswap is preferable.
Create /etc/systemd/zram-generator.conf:
Then reboot.
iii. Install timeshift:
ExecStart=/usr/bin/grub-btrfsd --syslog /.snapshots
with:
ExecStart=/usr/bin/grub-btrfsd --syslog -t
Optional Further Steps
i. Install power-profiles-daemon:
tlp, although for my use case tlp does not work with COSMIC's power applet.
ii. Install auto-cpufreq:
iii. Install brave-browser:
That's all folks!