How to install Arch Linux 💻

Update 2024-08-20: this is an old post. I expect that many things have changed in these years and I would advice to go to the official Arch Linux webpage to install it from scratch.

I gathered here all the steps that I took to install Arch Linux on my desktop computer. The main purpose of this post is to have a personal reference to look for in the future, but it might be useful for someone else as well.

I assume that you are in the installation environment, logged in the first virtual console as the root user, and presented with a Zsh shell prompt. If not, follow the first steps described here.

Enable internet access through iwctl for Wi-Fi or an Ethernet cable.

timedatectl set-ntp true
fdisk /dev/nvme0n1
mkfs.ext4 /dev/nvme0n1p2
mkfs.fat -F 32 /dev/nvme0n1p1
mkswap /dev/nvme0n1p3
swapon /dev/nvme0n1p3
mount /dev/nvmen0p1p2 /mnt
mkdir /mnt/boot
mount /dev/nvmen0p1p1 /mnt/boot
pacstrap /mnt base linux linux-firmware vim iwd dhcpcd networkmanager iproute2
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime
hwclock --systohc

Edit /etc/locale.gen uncommenting “en_US.UTF-8 UTF-8”

locale-gen

Generate: /etc/locale.conf with “LANG=en_US.UTF-8”

echo "LANG=en_US.UTF-8" > /etc/locale.conf

Generate: /etc/hostname with <your-hostname>

echo <your-hostname> > /etc/hostname

Edit /etc/hosts with 127.0.0.1 stuff

mkinitcpio -P
systemctl enable --now dhcpcd
systemctl enable --now NetworkManager
passwd
pacman -S grub
pacman -S efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --removable

In the new system run:

launch this: systemctl enable --now dhcpcd.service
launch this: systemctl enable --now NetworkManager.service
connect with iwctl

Add a new user <user-name>

pacman -S sudo
install zsh
useradd -m <user-name> --shell /bin/zsh
passwd <user-name>
visudo /etc/sudoers (add the following line: "<user-name> ALL=(ALL) ALL")
su <user-name>
pacman -S xorg
pacman -S gnome
systemctl start gdm.service
systemctl enable gdm.service
exit

I didn’t install the following, but Arch Wiki suggests to do so:

pacman -S intel-ucode

Edit /etc/mkinitcpio.conf with “MODULES=“hid-logitech-hidpp” Recreate the initrd for the kernel with

mkinitcpio -p linux-lts

Some interesting packages to install

Here, there is a list of packages that I found useful to have, from entertaining stuff like cmatrix, cowsay, lolcat, terminal-parrot, to specific packages that I needed in my case such as intel-ucode. I wouldn’t suggest to install all the following packages blindly.

pacman -S \
    cmatrix \
    cowsay \
    lolcat \
    terminal-parrot \
    rxvt-unicode \
    youtube-dl \
    base \
    e2fsprogs \
    git \
    htop \
    intel-ucode \
    iproute2 \
    iw \
    iwd \
    less \
    man-db \
    man-pages \
    openssh \
    python \
    sudo \
    textinfo \
    tmux \
    vim \
    zsh

EFISTUB

EFISTUB allows “EFI firmware to load the kernel as an EFI executable”. Despite my motherboard should be able to support EFI firmware, I couldn’t find a way to make it works. Given that I spent plenty of time trying to figure out what was the problem, I want to put here the commands that should have worked for future experimentations:

!/bin/sh
blkid -p -o value -s PART_ENTRY_UUID /dev/nvme0n1p2  PARTUUID  # for root parition
efibootmgr --disk /dev/nvme0n1 --part 1 --create --label "Arch Linux" --loader '/vmlinuz-linux-lts' --unicode 'root=PARTUUID=<insert-PARTUUID-here> rw initrd=\initramfs-linux-lts.img' --verbose