How to install Arch Linux with i3?

There are already many generic and useful guides on this topic and chances are, most people will likely just recommend you to take a look at the one on the Arch Linux wiki.

I’m meaning for this to be a no fluff version and covering a number of not so obvious but useful things to me personally. Should not really matter too much but note that this installation was carried out on a ThinkPad X220 on a wireless connection.

  1. Download the latest ISO file from Arch Linux
  2. Burn it into a USB drive (or DVD). I’d recommend Etcher
  3. Insert into your target computer and boot into it.
  4. Enable NTP

    timedatectl set-ntp true
    
  5. Identify the drive to install on

    fdisk -l
    
  6. Launch the partition manager on the selected drive

    cfdisk /dev/sdX
    

    X being the letter of the drive you wish to utilise

  7. Select dos label type

  8. Select New and specify the partition size. Ensure to leave enough space to create another partition for your swap space. Typically 2x your RAM.

  9. Select Primary and make it Bootable

  10. Do the same for the remaining space. Create another primary partition but do not make it bootable

  11. Select Type and change it from “83 Linux” to “82 Linux swap / Solaris”

  12. Select Write and type “yes” to execute the changes

  13. Select Quit to continue with the installation process

  14. Create the filesystem and swap space

    mkfs.ext4 /dev/sdX1
    mkswap /dev/sdX2
    
  15. Mount the filesystem and swap space

    mount /dev/sdX1 /mnt
    swapon /dev/sdX2
    
  16. Connect to your wireless network

    wifi-menu
    
  17. Test your internet connection

    ping google.com
    
  18. Install the base system

    pacstrap /mnt base base-devel
    
  19. Generate fstab

    genfstab -U /mnt >> /mnt/etc/fstab
    
  20. chroot into the system

    arch-chroot /mnt
    
  21. Set the timezone and update the hardware clock

    ln -sf /usr/share/zoneinfo/REGION/CITY /etc/localtime
    hwclock --systohc
    
  22. Edit the locale file and uncomment _enUS.UTF-8 UTF-8

    nano /etc/locale.gen
    
  23. Generate locale file

    locale-gen
    
  24. Create locale configuration file

    echo "LANG=en_US.UTF-8" > /etc/locale.conf
    
  25. Create hostname file

    echo "HOSTNAME" > /etc/hostname
    

    HOSTNAME being your desired hostname for your system

  26. Update “/etc/hosts” file

    127.0.0.1   localhost
    ::1     localhost
    127.0.0.1   HOSTNAME
    
  27. Enable dhcpcd and install some essential networking packages

    pacman -S dialog wpa_actiond ifplugd wpa_suppicant sudo zsh
    systemctl enable --now dhcpcd
    
  28. Set the root password

    passwd
    
  29. Create a non-root user for daily usage

    useradd -m -G wheel -s /bin/bash USERNAME
    
  30. Set the USERNAME password

    passwd USERNAME
    
  31. Edit “/etc/sudoers” to uncomment the following line

    # %wheel ALL=(ALL) ALL
    
  32. Generate initramfs

    mkinitcpio -p linux
    
  33. Install bootloader

    pacman -S grub os-prober
    grub-install /dev/sdX
    grub-mkconfig -o /boot/grub/grub.cfg
    
  34. Exit and reboot. Make sure to remove the USB/DVD installation media

    exit
    umount -R /mnt
    reboot
    
  35. Login as root

  36. Set up and configure internet connection

    wifi-menu
    

    Determine the hardware Wi-Fi and ethernet device IDs

    ip addr
    

    It should be something like “wlpXXX” and “enpXXX”

    systemctl enable netctl-auto@wlpXXX
    systemctl enable netctl-ifplugd@enpXXX
    

    The system is now ready to autoconnect to known networks.

  37. Install i3

    pacman -S i3 xorg xorg-xinit
    

    Edit “~/.xinitrc”

    #! /bin/bash
    exec i3
    

    Run i3

    startx
    

    Alternatively, you can run it automatically upon login by adding the following snippet to “/etc/profile”

    # autostart systemd default session on tty1
    if [[ "$(tty)" == '/dev/tty1' ]]; then
        exec startx
    fi
    

    It is probably a good idea to take a look at your i3 config file which can be found at ~/.config/i3/config or ~/.i3/config. There are many ways to customise your very own i3 layout but feel free to check out mine as a reference.

  38. Enable audio

    pacman -S alsa-utils
    alsamixer
    

    Select ‘Master’, press ’M’ and keep pressing the up key to increase the sound level

    Run a speaker test to verify it’s working

    speaker-test -c2
    
  39. Install yay

    git clone https://aur.archlinux.org/yay.git
    cd yay
    makepkg -si
    
  40. That’s it. You now have a functional and usable Arch Linux installation on your system!

    I’d recommend installing the following packages to make your system slightly more useful:

So simple!

18 July 2019

index