Arch Install


This is my guide on how to install Arch Linux!
Something’s missing? here is Arch Linux Wiki installation guide.


Start by load keyboard layout and update repo mirrors

1.1 Load keyboard layout

1
2
ls /usr/share/kbd/keymaps/**/*.map.gz #list all layouts
loadkeys sv-latin1

1.2 Update mirrorlist according to country

1
reflector -c Sweden -a 12 --sort rate --save /etc/pacman.d/mirrorlist



2.1 List disks

1
lsblk

2.2 Use cgdisk to format and partion

1
cgdisk /dev/sda # <-- your disk

Partion table

  • efi (around 512M)
  • swap (optional)
  • root
  • home (optional)

2.3 Make/Mount file system

1
mkfs.fat -F32 /dev/sda1

or

1
mkfs.vfat /dev/sda1

Click if using SWAP
1
2
mkswap /dev/sda2
swapon /dev/sda2

Click if using EXT4

Make EXT4 file system

1
mkfs.ext4 /dev/sda3

EXT4: Mount Mount root to /mnt

1
mount /dev/sda3 /mnt

Mount EFI

1
mount --mkdir /dev/sda1 /mnt/boot

Click if using BTRFS
1
mkfs.btrfs /dev/sda3

BTRFS: Mount Mount root to /mnt

1
mount /dev/sda3 /mnt

Change directory to /mnt

1
cd /mnt

Create subvolumes for btrfs

1
2
3
btrfs subvolume create @ 
btrfs subvolume create @home
btrfs subvolume create @var

Go back and unmount

1
2
cd
umount /mnt

Mount root with options

1
mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@ /dev/sda3 /mnt

Make directories

1
mkdir -p /mnt/{boot,home,var}

Mount home and var

1
2
mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@home /dev/sda3 /mnt/home
mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@ /dev/sda3 /mnt/var

Mount EFI

1
mount /dev/sda1 /mnt/boot



3.1 Install base system files and linux kernel

Only Base

1
pacstrap /mnt base linux linux-firmware

LTS Long term support kernel

1
pacstrap /mnt base linux-lts linux-firmware

(EXT4) Base plus essentials

1
pacstrap /mnt base linux linux-firmware intel-ucode neovim git

(BTRFS) Base plus essentials*

1
pacstrap /mnt base linux linux-firmware intel-ucode neovim git btrfs-progs

Motherboard drivers

  • intel-ucode
  • amd-ucode



4.1 Generate file system boot table with UUID

1
2
genfstab -U /mnt >> /mnt/etc/fstab
cat /mnt/etc/fstab #confirm



5.1 Enter your base install

1
arch-chroot /mnt

5.2 Set time zone

1
ln -sf /usr/share/zoneinfo/Europe/Stockholm /etc/localtime

5.3 Sync hardware clock

1
hwclock --systohc

5.4 Set system language

1
2
sed -i '178s/.//' /etc/locale.gen
locale-gen

or

1
2
3
nvim /etc/locale.gen
#Uncomment language of choice then save and exit
locale-gen

5.5 Add system language in locale

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

5.6 Add keyboard layout for tty

1
echo "KEYMAP=sv-latin1" >> /etc/vconsole.conf

5.7 Set hostname

1
echo "arch" >> /etc/hostname

5.8 Add localhost to hosts

1
2
3
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1       localhost" >> /etc/hosts
echo "127.0.1.1 arch.localdomain arch" >> /etc/hosts #change "arch" according to hostname

5.9 Change password for root

1
passwd



6.1 Necessary packages (bootloader, network)

1
pacman -S grub grub-btrfs os-prober efibootmgr networkmanager network-manager-applet dialog wpa_supplicant mtools dosfstools inetutils dnsutils base-devel linux-headers avahi xdg-utils gvfs gvfs-smb nfs-utils acpi acpid acpi_call ntfs-3g

Audio

1
pacman -S alsa-utils pipewire pipewire-alsa pipewire-pulse pipewire-jack sof-firmware

Battery management (laptop)

1
pacman -S tlp

Bluetooth

1
pacman -S bluez bluez-utils

Firewall

1
2
3
pacman -S firewalld
or
pacman -S ufw

Graphic’s

1
2
3
pacman -S xf86-video-amdgpu #amd
pacman -S xf86-video-intel #intel
pacman -S nvidia nvidia-utils nvidia-settings #nvidia

Printer

1
pacman -S cups hplip

Others

1
pacman -S bash-completion flatpak ipset iptables-nft openssh reflector rsync xdg-user-dirs

Virtual Machine

1
pacman -S virt-manager qemu qemu-arch-extra edk2-ovmf bridge-utils dnsmasq nss-mdns vde2 openbsd-netcat iptables-nft ipset



7.1 Configure grub

1
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB #change the directory to /boot/efi if you mounted the EFI partition at /boot/efi

7.2 Make config file

1
grub-mkconfig -o /boot/grub/grub.cfg #write changes to cfg



8.1 Enable services to boot on startup

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
systemctl enable acpid #acpid
systemctl enable avahi-daemon #avahi
systemctl enable bluetooth #bluez
systemctl enable cups.service #cups
systemctl enable firewalld #firewalld
systemctl enable fstrim.timer #fstrim (for ssd)
systemctl enable libvirtd #virt-manager
systemctl enable NetworkManager #networkmanager
systemctl enable reflector.timer #reflector
systemctl enable sshd #openssh
systemctl enable tlp #tlp



9.1 Method 1 Add a user

1
2
3
4
useradd -m Omgzilla # add user named Omgzilla, change username
passwd Omgzilla #change password for Omgzilla
# If installed virtual machine
usermod -aG libvirt Omgzilla # add user Omgzilla to libvirt group

9.1.1 Add user to sudo

1
echo "Omgzilla ALL=(ALL) ALL" >> /etc/sudoers.d/Omgzilla # add user 'Omgzilla' to sudo. change "Omgzilla" to your username

9.1 Method 2 Add new user, user in wheel group

1
2
3
4
5
useradd -mG wheel Omgzilla
passwd Omgzilla
EDITOR=nvim visudo
# add following under root ALL=(ALL) ALL
Omgzilla ALL=(ALL) ALL



10.1 Exit chroot, unmount and reboot

1
2
3
exit
umount -a
reboot




1.1 Sync clock

1
2
sudo timedatectl set-ntp true
sudo hwclock --systohc

1.2 Setup reflector

1
sudo reflector -c Sweden -a 12 --sort rate --save /etc/pacman.d/mirrorlist



2.1 Paru Install paru

1
2
3
git clone https://aur.archlinux.org/paru-bin
cd paru-bin
makepkg -si

2.1 PikAUR Install PikAUR

1
2
3
git clone https://aur.archlinux.org/pikaur.git
cd pikaur/
makepkg -si

3.1 Install zram (if no swap)

1
2
3
paru -S zramd
sudo nvim /etc/default/zramd
sudo systemctl enable --now zramd.service

4.1 Install timeshift

1
paru -S timeshift-bin timeshift-autosnap

5.1 Install a browser

1
2
paru -S brave-bin #brave browser
sudo pacman -S firefox #firefox

6.1 *Install a firewall

1
2
3
4
5
6
#Firewalld
sudo pacman -S firewalld
#UFW
sudo pacman -S ufw
ufw allow SSH
ufw enable

7.1 Install auto-cpufreq (if using laptop, for better battery)

1
2
paru -S auto-cpufreq
sudo systemctl enable --now auto-cpufreq

7.2 Install System76 hybrid graphic switcher (laptop with dual graphic cards)

1
2
3
4
paru -S --noconfirm system76-power
sudo systemctl enable --now system76-power
sudo system76-power graphics integrated
paru -S --noconfirm gnome-shell-extension-system76-power-git

7.3 Install flatpak

1
2
3
sudo pacman -S flatpak
#Example
sudo flatpak install spotify

7.4 Install pacman-contrib

1
sudo pacman -S pacman-contrib

7.5 Install Fonts

1
sudo pacman -S adobe-source-code-pro-fonts adobe-source-han-sans-otc-fonts adobe-source-han-serif-otc-fonts awesome-terminal-fonts bdf-unifont cantarell-fonts dina-font gentium-plus-font gnu-free-fonts inter-font noto-fonts noto-fonts-cjk noto-fonts-emoji tamsyn-font tex-gyre-fonts ttf-anonymous-pro ttf-bitstream-vera ttf-cascadia-code ttf-croscore ttf-dejavu ttf-droid ttf-fantasque-sans-mono ttf-fira-code ttf-fira-mono ttf-font-awesome ttf-hack ttf-ibm-plex ttf-inconsolata ttf-jetbrains-mono ttf-junicode ttf-liberation ttf-linux-libertine ttf-monofur ttf-opensans ttf-roboto ttf-ubuntu-font-family 

7.6 Install arandr for multiple monitors

1
sudo pacman -S arandr

7.7 Install wallpapers

1
sudo pacman -S archlinux-wallpaper

8.1 Create Bridge XML file

1
nvim br10.xml

Copy & paste following

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<network>
  <name>br10</name>
  <forward mode='nat'>
    <nat>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <bridge name='br10' stp='on' delay='0'/>
  <ip address='192.168.30.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.30.50' end='192.168.30.200'/>
    </dhcp>
  </ip>
</network>

Save and exit


8.2 Enable bridged network

1
sudo virsh net-autostart default

Pick a Desktop Environment below

I want to install Gnome

9.1.1 Method 1 Minimal install

1
sudo pacman -S --noconfirm xorg gdm gnome gnome-tweaks

9.1.1 Method 2 Full install

1
sudo pacman -S --noconfirm xorg gdm gnome gnome-extra gnome-tweaks

9.1.2 Arc theme (optional)

1
sudo pacman -S arc-gtk-theme arc-icon-theme

9.1.3 Enable gdm

1
sudo systemctl enable gdm

9.1.4 Reboot

1
sudo reboot
I want to install KDE

9.2.1 Method 1 Minimal install

1
sudo pacman -S --noconfirm xorg sddm plasma

9.2.1 Method 2 Full install

1
sudo pacman -S --noconfirm xorg sddm plasma kde-applications

9.2.2 Materia theme (optional)

1
sudo pacman -S materia-kde papirus-icon-theme 

9.2.3 Enable sddm

1
sudo systemctl enable sddm

9.2.4 Reboot

1
sudo reboot
I want to install BSPWM

9.3.1 Install Base

1
sudo pacman -S bspwm sxhkd

Install Xorg
9.3.2 Method 1 Xorg minimal

1
sudo pacman -S xorg-server xorg-xinit

9.3.2 Method 2 Xorg full

1
sudo pacman -S xorg

Install DM
9.3.3 Method 1 Install Ly DM (optional)*

1
2
paru -S ly
sudo systemctl enable ly

9.3.3 Method 2 LightDM

1
2
3
sudo pacman -S lightdm light-locker
paru -S lightdm-slick-greeter 
paru -S lightdm-settings

9.3.4 Install a launcher

1
2
sudo pacman -S dmenu
sudo pacman -S rofi

9.3.5 Install a file manager

1
2
3
4
sudo pacman -S ranger
sudo pacman -S nautilus
sudo pacman -S thunar
sudo pacman -S nnn

9.3.6 GTK preferences (optional)

1
sudo pacman -S lxappearance

9.3.7 GTK theme and icons

1
sudo pacman -S arc-gtk-theme arc-icon-theme

9.3.8 Notifications

1
sudo pacman -S dunst

9.3.9 Media player controller

1
sudo pacman -S playerctl

9.3.10 Screenshots

1
sudo pacmna -S scrot

9.3.11 Statusbar

1
paru -S polybar

9.3.12 Terminals

1
2
3
sudo pacman -S alacritty
sudo pacman -S kitty
sudo pacman -S rxvt-unicode

9.3.13 Wallpaper tools

1
2
sudo pacman -S feh
sudo pacman -S nitrogen

9.3.14 X compositor

1
sudo pacman -S picom
I want to install DWM

9.4.1 Method 1 Install through script
Step 1. Create script

1
nvim install-dwm.sh

Step 2. Copy and paste code below

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Variables
country=Poland
kbmap=ch
output=Virtual-1
resolution=1920x1080
# Options
aur_helper=true
install_ly=true
gen_xprofile=false
sudo timedatectl set-ntp true
sudo hwclock --systohc
sudo reflector -c $country -a 12 --sort rate --save /etc/pacman.d/mirrorlist
# sudo firewall-cmd --add-port=1025-65535/tcp --permanent
# sudo firewall-cmd --add-port=1025-65535/udp --permanent
# sudo firewall-cmd --reload
# sudo virsh net-autostart default
if [[ $aur_helper = true ]]; then
    cd /tmp
    git clone https://aur.archlinux.org/paru.git
    cd paru/;makepkg -si --noconfirm;cd
fi
# Install packages
sudo pacman -S xorg firefox polkit-gnome nitrogen lxappearance thunar
# Install fonts
sudo pacman -S --noconfirm dina-font tamsyn-font bdf-unifont ttf-bitstream-vera ttf-croscore ttf-dejavu ttf-droid gnu-free-fonts ttf-ibm-plex ttf-liberation ttf-linux-libertine noto-fonts ttf-roboto tex-gyre-fonts ttf-ubuntu-font-family ttf-anonymous-pro ttf-cascadia-code ttf-fantasque-sans-mono ttf-fira-mono ttf-hack ttf-fira-code ttf-inconsolata ttf-jetbrains-mono ttf-monofur adobe-source-code-pro-fonts cantarell-fonts inter-font ttf-opensans gentium-plus-font ttf-junicode adobe-source-han-sans-otc-fonts adobe-source-han-serif-otc-fonts noto-fonts-cjk noto-fonts-emoji
# Pull Git repositories and install
cd /tmp
repos=( "dmenu" "dwm" "dwmstatus" "st" "slock" )
for repo in ${repos[@]}
do
    git clone git://git.suckless.org/$repo
    cd $repo;make;sudo make install;cd ..
done
# XSessions and dwm.desktop
if [[ ! -d /usr/share/xsessions ]]; then
    sudo mkdir /usr/share/xsessions
fi
cat > ./temp << "EOF"
[Desktop Entry]
Encoding=UTF-8
Name=Dwm
Comment=Dynamic window manager
Exec=dwm
Icon=dwm
Type=XSession
EOF
sudo cp ./temp /usr/share/xsessions/dwm.desktop;rm ./temp
# Install ly
if [[ $install_ly = true ]]; then
    git clone https://aur.archlinux.org/ly
    cd ly;makepkg -si
    sudo systemctl enable ly
fi
# .xprofile
if [[ $gen_xprofile = true ]]; then
cat > ~/.xprofile << EOF
setxkbmap $kbmap
nitrogen --restore
xrandr --output $output --mode $resolution
EOF
fi
printf "\e[1;32mDone! you can now reboot.\e[0m\n"

Step 3. Save, change privileges and run

1
2
chmod +x install-dwm.sh
./install-dwm.sh