Arch Linux installation cheat sheet

Preparation link

Creating a USB install stick from Windows link

  1. Download the Arch ISO
  2. Download and run Rufus
  3. Select GPT from the Partition scheme drop-down menu
  4. Change the Volume label to ARCH_YYYYMM where YYYYMM is the release year & month of the Arch ISO
  5. Click START and select DD Image mode

Note: when selecting the USB stick in the motherboard boot menu, make sure to select the entry that starts with "UEFI:" to boot in UEFI mode.

Installation (starting from successful Arch ISO boot) link

1. Environment check and setup link

Check that you're in UEFI mode by making sure there's output when you run:

ls /sys/firmware/efi/efivars  

Check internet connection:

ping google.com

Update system clock:

timedatectl set-ntp true

2. Setup system partitions link

Check if you've got old swap partitions with lsblk, if you do, delete them:

swapoff -a
lvremove ubuntu-vg/swap_1

Setup partition table with cgdisk (uses ncurses, should be self-explanatory):

cgdisk /dev/nvme0n1

Use partition layout:

Mount pointPartitionPartition Type CodeSuggested size
/bootEFI system partitionef00550MiB
Noneswap820032GiB
/root8300remaining

Format EFI partition:

mkfs.fat -F32 /dev/nvme0n1p1

Setup swap partition:

mkswap /dev/nvme0n1p2
swapon /dev/nvme0n1p2

Format root partition:

mkfs.ext4 /dev/nvme0n1p3

Mount root partition:

mount /dev/nvme0n1p3 /mnt

Mount EFI partition (use /boot because it's better):

mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot

3. Configure the system link

Install base packages directly into root partition:

pacstrap /mnt base linux linux-firmware

Generate fstab file into root partition:

genfstab -U /mnt >> /mnt/etc/fstab

Change root into root partition:

arch-chroot /mnt

Configure time and locale:

ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
hwclock --systohc
echo en_US.UTF-8 UTF-8 >> /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf

Set root password:

passwd

4. Configure network link

Configure hostname:

echo josharch > /etc/hostname
echo 127.0.0.1	localhost >> /etc/hosts
echo ::1		localhost >> /etc/hosts
echo 127.0.1.1	josharch.localdomain	josharch >> /etc/hosts

Print out the name of your ethernet adapter (it should start with enp):

ip link

Create a file /etc/systemd/network/20-wired.network that looks like this:

[Match]
Name=enp0s31f6

[Network]
Address=192.168.86.88/24
Gateway=192.168.86.1

Start systemd-resolved so you have access to /run/systemd/resolve/...:

systemctl start systemd-resolved

Redirect /etc/resolv.conf to systemd-resolved:

ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

Modify the file /etc/systemd/resolved.conf to look like this:

[Resolve]
DNS=8.8.8.8
FallbackDNS=8.8.4.4

Enable systemd-networkd and systemd-resolved:

systemctl enable systemd-networkd
systemctl enable systemd-resolved

5. Configure boot loader link

Regenerate initramfs:

mkinitcpio -p linux

Install systemd-boot:

bootctl --path=/boot install

Create a file /boot/loader/loader.conf that looks like this:

default arch.conf
timeout 5
console-mode max
editor no

Modify the file /boot/loader/entries/arch.conf to look like this:

title	Arch Linux
linux	/vmlinuz-linux
initrd	/intel-ucode.img
initrd	/initramfs-linux.img

Then append the last options line to /boot/loader/entries/arch.conf (you might have to exit out of the arch-chroot to do this properly):

echo options root=UUID=$(lsblk -no UUID /dev/nvme0n1p3) rootfstype=ext4 rw

Install microcode package for intel CPUs:

pacman -S intel-ucode

Re-run mkinitcpio -p linux

6. Setup your new user link

Reboot into your new system and login as root.

Create & configure your user account:

useradd -m josh
passwd josh
usermod -aG sys,ftp,log,games,adm,wheel,uucp,users,systemd-journal,rfkill,http josh

Install sudo:

pacman -S sudo

Open the sudo config (run visudo) and modify the "User privilege specification" section to look like this:

##
## User privilege specification
##
root ALL=(ALL) ALL
josh ALL=(ALL) ALL

Find and uncomment the MAKEFLAGS line to specify some extra concurrency:

MAKEFLAGS="-j6"

Login to your new user!

7. Configure AUR package management link

Use paru: https://github.com/Morganamilo/paru

8. Install the GNOME Desktop Environment link

Install the gnome packages:

sudo pacman -S gnome gnome-tweaks

Configure GNOME to start on boot:

sudo systemctl enable gdm

Start GNOME immediately:

sudo systemctl start gdm

Enable automatic login for user by adding these lines to /etc/gdm/custom.conf:

[daemon]
AutomaticLogin=<username>
AutomaticLoginEnable=True

Remove evolution (GNOME's email client):

sudo pacman -Rcsnd evolution

Install the Gnome Shell Integration extension for Chrome and the native connector package:

sudo pacman -S chrome-gnome-shell

Install the Dash to Panel shell extension.

Install the tactile extension.

Install the notification banner reloaded extension

9. Install Sublime Text & Sublime Merge link

Just follow instructions on the websites:

10. Install Steam link

Uncomment multilib section in /etc/pacman.conf:

[multilib]
Include = /etc/pacman.d/mirrorlist

Install Steam and dependencies (when asked which provider for lib32-libgl, pick lib32-libglvnd):

sudo pacman -S steam lib32-nvidia-utils lib32-libgpg-error

Launch "Steam (Runtime)".

11. Install useful stuff link

12. Setup periodic TRIM execution link

systemctl enable fstrim.timer

Details about TRIM: https://wiki.archlinux.org/title/Solid_state_drive

13a. Serve media directory via NFS link

Install NFS:

sudo pacman -S nfs-utils

Create an NFS directory to mount your media directory into:

sudo mkdir -p /srv/nfs/media

Append this section to your /etc/fstab:

# NFS bind-mount of /media
/media /srv/nfs/media none bind 0 0

Apply your fstab:

sudo mount -a

Modify the NFS config file /etc/exports to look like this:

/srv/nfs        192.168.86.0/24(rw,sync,crossmnt,fsid=0)
/srv/nfs/media  192.168.86.0/24(rw,sync)

Apply the NFS config:

sudo exportfs -rav

Start NFS server:

sudo systemctl start nfs-server

Configure NFS server to start on boot:

sudo systemctl enable nfs-server

13b. Serve media directory via Samba link

Install Samba:

sudo pacman -S samba

Set a Samba-specific password for your existing Linux user:

sudo smbpasswd -a josh

Create a Samba directory to mount your media directory into:

sudo mkdir -p /srv/samba/media

Append this section to your /etc/fstab:

# Samba bind-mount of /media
/media /srv/samba/media none bind 0 0

Apply your fstab:

sudo mount -a

Create a file /etc/samba/smb.conf that looks like this:

[global]
	workgroup = joshiba
	server string = Samba %v on (%L)
	hosts allow = 192.168.86. 127. localhost
	load printers = no
	printing = bsd
	printcap name = /dev/null
	disable spoolss = yes
	show add printer wizard = no

[media]
	comment = Media drive
	path = /srv/samba/media
	public = yes
	writable = no
	printable = no
	write list = josh

Verify Samba config file by checking output of command:

testparm

Start Samba server:

sudo systemctl start smb

Configure Samba server to start on boot:

sudo systemctl enable smb

[X11 only] Bind mouse buttons to workspace navigation shortcuts link

Install xbindkeys, xorg-xev and wmctrl:

sudo pacman -S xbindkeys xorg-xev wmctrl

Generate default xbindkeys config in your home directory:

xbindkeys --defaults > ~/.xbindkeysrc

Add the following section to ~/.xbindkeysrc, customizing as needed (run xev in the terminal to find key codes and button codes, learn more):

"wmctrl -s $(($(wmctrl -d | grep '*' | cut -d ' ' -f1) + 1))"
  b:8

"wmctrl -s $(($(wmctrl -d | grep '*' | cut -d ' ' -f1) - 1))"
  b:9

"(DESKTOP_INDEX=$(($(wmctrl -d | grep '*' | cut -d ' ' -f1) + 1)); wmctrl -r :ACTIVE: -t $DESKTOP_INDEX && wmctrl -s $DESKTOP_INDEX)"
  Control + b:8

"(DESKTOP_INDEX=$(($(wmctrl -d | grep '*' | cut -d ' ' -f1) - 1)); wmctrl -r :ACTIVE: -t $DESKTOP_INDEX && wmctrl -s $DESKTOP_INDEX)"
  Control + b:9

Make sure to comment-out the commands under # Examples of commands: (because the example commands override Ctrl + F to open xterm):

# Examples of commands:

#"xbindkeys_show" 
#  control+shift + q

# set directly keycode (here control + f with my keyboard)
#"xterm"
#  c:41 + m:0x4

# specify a mouse button
#"xterm"
#  control + b:2

Create a systemd user service file ~/.config/systemd/user/xbindkeys.service to look like this:

[Unit]
Description=XBindKeys
PartOf=gnome-session.target

[Service]
ExecStart=/usr/bin/xbindkeys -n
KillMode=process

[Install]
WantedBy=gnome-session.target

Start and enable the new xbindkeys service:

systemctl --user start xbindkeys
systemctl --user enable xbindkeys

Wayland-only: Support screen sharing on X11 apps like Discord using XWayland Video Bridge link

Install xwaylandvideobridge-git from the AUR, making sure you also install kwidgetsaddons which is required (as of writing, the AUR pkgbuild doesn't specify it as a dependency):

paru -S kwidgetsaddons xwaylandvideobridge-git

Create a systemd user service file ~/.config/systemd/user/xwaylandvideobridge.service to look like this:

[Unit]
Description=XWayland Video Bridge
PartOf=graphical-session.target
After=graphical-session.target

[Service]
Environment="QT_QPA_PLATFORM=wayland"
ExecStart=/usr/bin/xwaylandvideobridge
KillMode=process

[Install]
WantedBy=graphical-session.target

Start and enable the new xwaylandvideobridge service:

systemctl --user start xwaylandvideobridge
systemctl --user enable xwaylandvideobridge

Create a virtual PulseAudio output device for streaming link

TODO: use PipeWire instead https://www.reddit.com/r/linux_gaming/comments/lfxbik/tutorial_how_to_share_audio_on_discord_or_any/

Create a virtual output device called Virtual_Sink:

pacmd load-module module-null-sink sink_name=Virtual_Sink sink_properties=device.description=Virtual_Sink

Copy the Virtual_Sink's audio to your real/physical output device (eg. headphones or speakers):

pacmd load-module module-loopback source="Virtual_Sink.monitor" sink="<output device>"

You can find your real/physical output device's sink name by listing PulseAudio sinks:

pacmd list-sinks | grep name

Pacat alternative:

pacmd load-module module-null-sink sink_name=Virtual_Headphones sink_properties=device.description=Virtual_Headphones

pacmd load-module module-null-sink sink_name=Virtual_Mic sink_properties=device.description=Virtual_Mic

pacat -r --latency-msec=1 -d Virtual_Headphones.monitor | pacat -p --latency-msec=1 -d alsa_output.usb-Schiit_Audio_Schiit_Hel-00.analog-stereo

pacat -r --latency-msec=1 -d alsa_input.usb-Schiit_Audio_Schiit_Hel-00.analog-stereo | pacat -p --latency-msec=1 -d Virtual_Mic

pacat -r --latency-msec=1 -d Virtual_Headphones.monitor | pacat -p --latency-msec=1 -d Virtual_Mic

Creating VMs with virt-manager link

Install virt-manager and dependencies:

sudo pacman -S virt-manager ebtables dnsmasq

Start libvirtd:

systemctl start libvirtd

SSH client config link

Use controlmaster to reuse connections in new sessions:

Host *
  controlmaster auto
  controlpath /tmp/ssh-%r@%h:%p