The content of this document is a personal guide developed for installing Arch Linux. While it is recommended to refer to the Official Installation Guide, you are free to utilize any information provided here in a manner that suits your needs.
Before proceeding with the installation of Arch Linux, it is important to follow a series of preliminary steps to ensure a smooth and successful installation process.
The Arch Linux installation images do not include built-in support for Secure Boot. However, you can manually set up Secure Boot after completing the installation if desired.
To configure the console keyboard layout and font, (e.g., us-acentos and ter-132b), use the following commands:
#!/bin/bash
loadkeys us-acentos # to list keymaps use: `localectl list-keymaps`
setfont ter-132b # Console fonts are located in: `/usr/share/kbd/consolefonts/`To ensure the system clock is accurate use timedatectl command in Linux:
#!/bin/bash
timedatectl set-ntp onBy utilizing LVM (Logical Volume Manager) within a single LUKS (Linux Unified Key Setup) encrypted partition, you can achieve enhanced partitioning flexibility. This approach allows you to dynamically manage and resize logical volumes within the encrypted container, providing greater control over your storage allocation. With LVM, you can create multiple logical volumes, such as for the root filesystem, home directory, and other data partitions, all securely housed within the LUKS encryption. This setup enables easier management and resizing of partitions without compromising the overall security provided by LUKS encryption.
Prior to encrypting the partition or entire device, it is recommended to create a temporary encrypted container to wipe all data still in the disk. You can consider changing the cipher used from the standard aes-cbc to aes-xts, as it may provide improved performance. It's advisable to verify the performance comparison using the cryptsetup benchmark command.
#!/bin/bash
cryptsetup open --type plain -d /dev/urandom /dev/<block-device> to_be_wipedWipe the container with zeros. A use of if=/dev/urandom is not required as the encryption cipher is used for randomness.
#!/bin/bash
dd if=/dev/zero of=/dev/mapper/to_be_wiped status=progressFinally, close the temporary container:
#!/bin/bash
cryptsetup close to_be_wipedUse fdisk or to modify partition tables. Create a partition to be mounted at /boot with a size of 1 GiB and another partition (Linux LVM) which will later contain the encrypted container.
#!/bin/bash
fdisk /dev/sdaCreate the LUKS encrypted container at the designated partition. Enter the chosen password twice.
#!/bin/bash
cryptsetup luksFormat /dev/sda2Open the container and the decrypted container will be available at /dev/mapper/lvm:
#!/bin/bash
cryptsetup open /dev/sda2 lvmCreate a physical volume on top of the opened LUKS container:
#!/bin/bash
pvcreate /dev/mapper/lvmCreate a volume group (e.g., vg0) and add the previously created physical volume to it:
#!/bin/bash
vgcreate vg0 /dev/mapper/lvmCreate all your logical volumes on the volume group:
#!/bin/bash
lvcreate -L 8G vg0 -n swap
lvcreate -L 160G vg0 -n root
lvcreate -l 100%FREE vg0 -n home
# leave at least 1 GiB free space in the volume group to allow using e2scrub,
# snapshots, or other metadata operations
lvreduce -L -1G vg0/homeWhen using BLAST, the 8 GiB swap logical volume acts as fallback swap. BLAST configures zram as the primary compressed swap device with zram-generator:
[zram0]
zram-size = min(ram / 2, 16384)
compression-algorithm = zstd
swap-priority = 100On a system with 32 GiB of RAM, this creates a 16 GiB zram swap device with higher priority than the disk swap.
Format your file systems on each logical volume:
#!/bin/bash
mkfs.ext4 -L ROOT /dev/vg0/root
mkfs.ext4 -L HOME /dev/vg0/home
mkswap -L SWAP /dev/vg0/swapMount your file systems:
#!/bin/bash
mount /dev/vg0/root /mnt
mount --mkdir /dev/vg0/home /mnt/home
swapon /dev/vg0/swapCreate a file system on the partition intended for /boot and mount the partition to /mnt/boot:
#!/bin/bash
mkfs.fat -n BOOT-EFI -F 32 /dev/sda1
mount --mkdir /dev/sda1 /mnt/bootThe following section provides guidance on installing Arch Linux. It covers the necessary steps and instructions to successfully install the operating system on your system.
To set up a network connection in the live environment, go through the following steps:
- (Wireless/WWAN): Make sure the card is not blocked with rfkill.
- Authenticate to the wireless network using iwctl.
- Plug in the cable.
Use reflector to automatically update /etc/pacman.d/mirrorlist:
#!/bin/bash
reflector --country COUNTRY,Use pacstrap to install the base package, Linux kernel, firmware for common hardware and other packages. If you encrypted your device or partition, make sure to also install lvm2. Install the CPU microcode package that matches your processor: intel-ucode for Intel or amd-ucode for AMD.
#!/bin/bash
pacstrap -K /mnt base base-devel linux linux-firmware linux-firmware-qlogic linux-firmware-marvell sof-firmware vim git openssh lvm2 intel-ucodeReplace intel-ucode with amd-ucode on AMD systems.
Generate an fstab file (use -U or -L to define by UUID or labels, respectively):
#!/bin/bash
genfstab -L /mnt >> /mnt/etc/fstabChange root into the new system:
#!/bin/bash
arch-chroot /mntMake sure the lvm2 package is installed and add the keyboard, encrypt and lvm2 hooks to mkinitcpio.conf.
#!/bin/bash
EDITOR /etc/mkinitcpio.confHOOKS=(base `udev` autodetect modconf kms `keyboard` `keymap` `consolefont` block `encrypt` `lvm2` filesystems fsck)Regenerate initramfs after saving the changes.
#!/bin/bash
mkinitcpio -p linux # Or linux-ltsIn order to unlock the encrypted root partition at boot, the following kernel parameter needs to be set on the bootloader cryptdevice=UUID=DEVICE_UUID:lvm:
PS: If you'll be using BLAST, skip to Post-Installation setup.
Install it:
bootctl install
mkinitcpio -p linux
systemctl enable systemd-boot-update.serviceCreate the loader configuration:
#!/bin/bash
$ cat /boot/loader/loader.conf
default arch.conf
timeout 1
console-mode max
editor noUse /intel-ucode.img on Intel systems or /amd-ucode.img on AMD systems.
#!/bin/bash
$ cat /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options cryptdevice=UUID=e8bdb9ea-134f-47aa-9c4f-459a4a60acaa:lvm root=UUID=c12ea209-1f90-4d69-946f-766deef7bfe1 rw zswap.enabled=0
$ cat /boot/loader/entries/arch-fallback.conf
title Arch Linux (fallback initramfs)
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux-fallback.img
options cryptdevice=UUID=e8bdb9ea-134f-47aa-9c4f-459a4a60acaa:lvm root=UUID=c12ea209-1f90-4d69-946f-766deef7bfe1 rw zswap.enabled=0Use BLAST to automatically configure Arch with my dotfiles, Niri, packages, and system settings. Or follow the Official Installation Guide#Configure the system.