If you haven’t installed Arch Linux yet, continue reading. It is recommended to start from scratch since the dotfiles are tightly integrated with how my system is set up. If you know what you are doing, you might want to skip to the manual or automatic customization steps.
I recommend that you read the Arch Linux Wiki’s installation guide instead since it is more updated and accurate than a guide that is maintained by one hobbyist like me. I also recommend reading arch.d3sox.me if you have trouble understanding the wiki.
Pre-Installation
Preparing the Installation Medium
I assume that you know how to boot into the Arch Linux ISO. You can download the ISO from their website, and use Ventoy to boot into your USB Flash Drive.
After this point, I assume that you are now in the live ArchISO system.
Preparing the Console
If you are not using a US keyboard, you might want to change your keyboard layout.
localectl list-keymaps # list available layoutsloadkeys <keymap> # load a keymap. e.g., `de-latin1`
Verifying Internet Connection
Internet connection via Ethernet should be working out of the box. If you are using a wireless connection, perform the following commands:
iwctldevice list# your device name might be different (replace wlan0)station wlan0 scanstation wlan0 get-networks# replace <SSID> with your network name from the previous commandstation wlan0 connect <SSID>exit
If you are having problems turning on your wireless NIC, make sure that it is not being soft-blocked by rfkill.
To make sure that you have an internet connection, ping the Arch Linux website.
ping -c 4 archlinux.org
Setting Up Time and Date
Make sure that the time and date is synchronized.
timedatectl set-ntp true
Check if The System Booted in UEFI
ls /sys/firmware/efi/efivars
If the directory does not exist, you are in BIOS mode. It is most likely that you want to use UEFI, so check the wiki to know how to boot into UEFI mode.
Storage Preparation
Partitioning and Mounting the Disks
List all block devices by running the following command:
fdisk -l
In my case, my main storage device is located at /dev/sda. So we run the following command: (Your device might have a different name)
fdisk /dev/sda
Partition the device following the structure shown in Environment > Disk Partitions. If you have different needs, you can see more examples in the Arch Linux Wiki and d3sox’s guide. After saving the changes made by fdisk, create the filesystems.
mkfs.fat -F32 -n EFI /dev/sda1 # Create a FAT32 filesystem in `/dev/sda1` labeled "EFI"mkfs.ext4 -L BOOT /dev/sda2 # Create an EXT4 filesystem in `/dev/sda2` labeled "BOOT"mkswap -L ZRAM /dev/sdaX # Create a SWAP filesystem in `/dev/sdaX` with label "ZRAM"mkfs.btrfs -L ARCH /dev/sdaY # Create a BTRFS filesystem in `/dev/sdaY` labeled "ARCH"# Mount /mnt to create Btrfs subvolumes.mount --mkdir /dev/sdaY /mnt# Create Btrfs subvolumesbtrfs subvolume create /mnt/@btrfs subvolume create /mnt/@homebtrfs subvolume create /mnt/@var_logbtrfs subvolume create /mnt/@snapshots# Unmount /mntumount /mnt# Mount the partitions in their respective mountpoints.mount --mkdir -o noatime,compress-force=zstd:3,subvol=@ /dev/sdaY /mntmount --mkdir -o noatime,compress-force=zstd:3,subvol=@home /dev/sdaY /mnt/homemount --mkdir -o noatime,compress-force=zstd:3,subvol=@var_log /dev/sdaY /mnt/var/logmount --mkdir -o noatime,compress-force=zstd:3,subvol=@snapshots /dev/sdaY /mnt/.snapshotsmount --mkdir /dev/sda2 /mnt/bootmount --mkdir /dev/sda1 /mnt/boot/efi
Regarding Btrfs Compression
The compression level of zstd may vary, depending on your storage type. For slower devices such as HDDs, it is better to optimize the file size so that the system will spend less time reading and writing. Meanwhile, the added compression/decompression time is (theoretically) slowing down I/O for faster devices.1
Basically, set compress-force=zstd:N…
Within 2-5 if you have a rotating storage device
To 2 if you have a SATA SSD
To 1 if you have an NVMe SSD
Depending on your needs, you can set the compression levels higher if storage space is more important or lower if latency or bandwidth is more important.
pacstrap -K /mnt \ base base-devel linux linux-firmware linux-headers \ iwd networkmanager networkmanager-openvpn \ networkmanager-pptp networkmanager-vpnc \ wireless_tools wpa_supplicant ifplugd \ sysfsutils usbutils btrfs-progs e2fsprogs dosfstools lvm2 \ inetutils dhcping traceroute rsync \ earlyoom nano less which tree sudo reflector \ dialog man-db man-pages openssh \ git git-lfs xdg-utils xdg-user-dirs
Append more package names as needed. For example, my laptop has Broadcom wireless devices so I have to install broadcom-wl as well. This command may take a while to complete.
Generate fstab
Generate an fstab file by running either of the following commands:
genfstab -L /mnt >> /mnt/etc/fstab # Define by labelsgenfstab -U /mnt >> /mnt/etc/fstab # Define by UUIDs
Check the /mnt/etc/fstab file for any errors.
Chroot into Your New Arch Linux System
arch-chroot /mnt
Configure Pacman
nano /etc/pacman.conf
Enable multilib Repository
Uncomment the following lines to make 32-bit libraries available to download.
[multilib]Include = /etc/pacman.d/mirrorlist
Enable Parallel Downloads
Uncomment the following line to enable parallel downloading of files. You can change the value to whatever you like.
ParallelDownloads = 5
Other Stuff
Uncomment/Add the following lines under Misc options:
Color
ILoveCandy
VerbosePkgLists
Post-Configuration
After editing the configuration file, you may now save and close it. Run pacman -Syu to update the repositories.
Add zram
Instead of having a swap partition, we are going to use zram instead.
pacman -S zram-generator
After installation, create/edit /etc/systemd/zram-generator.conf and replace its contents with the following:
If you opted for using ZRAM’s writeback feature, get the partition UUID of your backing device partition (/dev/sdaX) by looking at the results of ls -lAh /dev/disk/by-partuuid, and add the following line in /etc/systemd/zram-generator.conf, under [zram0]:
Now, we need to edit our initial ram disk by running nano /etc/mkinitcpio.conf. Inside the parenthesis of MODULES=(), add the following (separated by a space):
btrfs and ext4, since we are using Btrfs and EXT4 as our filesystems.
amdgpu if you are running the new AMD GPU driver, i915 if Intel, or nvidia nvidia_modeset nvidia_uvm nvidia_drm if you use proprietary NVIDIA drivers.
As an example, my machine has a built-in Intel GPU so I have the following:
MODULES=(btrfs ext4 i915)
If you are running proprietary NVIDIA drivers, remove kms inside HOOKS=().
After editing, we run mkinitcpio -P to process all preset files.
Install Bootloader
In this step, I assume that you are installing on a UEFI system. Otherwise, check d3sox for more information.
GRUB OS Prober
If you want to automatically detect other operating systems, run nano /etc/default/grub and add/uncomment the following line:
If you forgot to perform grub-mkconfig and shut down/reboot the system instead (which I totally did not do while installing Arch), just boot into your live USB again, mount the partitions, and chroot into your system.
Setup Hostname
<YOUR_HOSTNAME> will be the name of your machine. Change it to whatever you like, but following RFC1178 is recommended.
Uncomment the languages that you plan to use in /etc/locale.gen and then generate the locales.
nano /etc/locale.genlocale-genprintf 'LANG=en_US.UTF-8' > /etc/locale.conf # You can change the locale if you wantexport LANG=en_US.UTF-8
Update the Time
# Replace `Region/City` with your region and city.# tab-completion is available.ln -sf /usr/share/zoneinfo/Region/City /etc/localtimehwclock --systohc
Setting Up Users
It is recommended to use strong passwords for your user accounts.
Set Root Password
passwd
Add A Non-Root User Account
A common security practice is that you should not use the root account unless needed and you know that it is safe to run. To create a non-root user, run the commands below and change the parameters to the values you desire.