Arch Linux Installation

Pre-installation (live environment)

  1. Boot the live environment

    Aquire an installation media, verify signature, prepare installation medium and boot the live environment as per the offical Installation Guide.

  2. Set keyboard layout
    loadkeys dk
  3. Verify EFI boot mode
    ls /sys/firmware/efi/efivars

    If the directory does not exist, you need to find a way to reboot into EFI boot mode

  4. Update system clock
    timedatectl set-ntp true
  5. Partition the disks
    gdisk /dev/sda

    Example: /dev/sda1 EFI partition 260 MiB, /dev/sda2 linux partition remaining space

  6. Format EFI partition
    mkfs.fat -F32 /dev/sda1

    IMPORTANT: Refer to the wiki if you are dual booting, formatting your EFI partition will most likely make Windows unbootable

  7. Format root partition
    mkfs.btrfs /dev/sda2
  8. Mount root file system
    mount /dev/sda2 /mnt
  9. Create EFI mount point
    mkdir /mnt/boot
  10. Mount EFI file system
    mount /dev/sda1 /mnt/boot

Installation

  1. Sort download mirrors
    reflector --verbose --latest 5 --sort rate --save /etc/pacman.d/mirrorlist
  2. Install base packages
    pacstrap /mnt base base-devel linux linux-firmware amd-ucode vim nvidia

Configuration

  1. Generate fstab file
    genfstab -U /mnt >> /mnt/etc/fstab
  2. Copy default network config
    cp /etc/systemd/network/* /mnt/etc/systemd/network/
  3. Change root into new system
    arch-chroot /mnt
  4. Set root password
    passwd
  5. Set default editor
    echo 'EDITOR=vim' >> /etc/environment

Localization

  1. Set the time zone
    ln -sf /usr/share/zoneinfo/UTC /etc/localtime
  2. Write software UTC time to hardware
    hwclock --systohc
  3. Uncomment locales to generate
    vim /etc/locale.gen
    en_DK.UTF-8 UTF-8
    en_US.UTF-8 UTF-8
  4. Generate locales
    locale-gen
  5. Set LANG
    echo 'LANG=en_DK.UTF-8' > /etc/locale.conf
  6. Persist keymap
    echo 'KEYMAP=dk' > /etc/vconsole.conf

Networking

  1. Set hostname
    echo 'ballz' > /etc/hostname
  2. Configure hosts file
    vim /etc/hosts
    127.0.0.1	localhost
    ::1		localhost
  3. Use systemd DNS stub file
    ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
  4. Enable systemd network services
    systemctl enable systemd-networkd systemd-resolved

Initial ramdisks

  1. Configure mkinitcpio
    vim /etc/mkinitcpio.conf
    HOOKS=(systemd autodetect modconf block filesystems keyboard fsck)
  2. Regenereate initramfs images
    mkinitcpio --allpresets

Bootloader

  1. Install bootloader
    bootctl install
  2. Configure bootloader
    vim /boot/loader/loader.conf
    console-mode max
    timeout 3
  3. Add boot entry
    vim /boot/loader/entries/arch.conf
    title Arch (linux)
    linux /vmlinuz-linux
    initrd /amd-ucode.img
    initrd /initramfs-linux.img
    options root=/dev/sda2
  4. Add fallback entry
    vim /boot/loader/entries/arch-fallback.conf
    title Arch (linux-fallback)
    linux /vmlinuz-linux
    initrd /amd-ucode.img
    initrd /initramfs-linux-fallback.img
    options root=/dev/sda2

Reboot into new system

  1. Leave chroot
    exit
  2. Unmount and reboot
    umount --recursive /mnt && reboot

Userspace setup

  1. Enable systemd-homed
    systemctl enable systemd-homed
  2. Create regular user
    homectl create zach --member-of=wheel

    The `wheel` group is for sudo

  3. Enable sudo for wheel group
    visudo

    Uncomment '%wheel ALL=(ALL) ALL' the above to allow members of group `wheel` to execute any command (after entering root password)

  4. Change to regular user
    su zach

Install aurman

  1. curl -L -O https://aur.archlinux.org/cgit/aur.git/snapshot/aurman.tar.gz
  2. Import GnuPG key
    gpg --recv-keys 465022E743D71E39
  3. Unpack
    tar -xvf aurman.tar.gz
  4. cd aurman
  5. Compile and install
    makepkg -si

Install important AUR packages

  1. aurman -Syu systemd-boot-pacman-hook

    IMPORTANT: the bootctl update hook is needed to ensure microcode updates

Install all the good shit

  1. sudo pacman -Syu xorg docker openssh termite ...