Notes to myself on how to install Arch Linux.
Instructions below mostly from the Arch Linux Installation Guide.
Tested on Dell XPS13 (9360).
Prepare a bootable USB stick with the Arch image on it:
- download the latest Arch Linux ISO image and its signature from the Arch Linux Downloads page
- verify the image integrity:
gpg --keyserver-options auto-key-retrieve --verify archlinux-version-x86_64.iso.sig
- format a USB stick (FAT format, MBR partition table) or use something like ventoy
- formatted stick: copy the ISO image to the stick:
cp path/to/archlinux.iso /dev/disk/by-id/usb-xxxx
- ventoy: copy the ISO image to the stick:
cp path/to/archlinux.iso path/to/usb/stick
- reboot the computer, enter the BIOS, and disable 'safe boot' (if on Linux with systemd: run
systemctl reboot --firmware-setup
should present you with the boot menu directly) - reboot and select Arch Linux in the boot menu (Dell XPS13: press F12 to get the boot menu)
Note: in case of SQUASHFS errors during installation, it probably means that the USB device is not good so try another one.
The default is us
but for e.g. a uk
layout:
-
list the available layouts:
localectl list-keymaps
orls /usr/share/kbd/keymaps/**/*.map.gz
-
load the uk layout:
loadkeys uk
Load a more relevant font: setfont eurlatgr
Run
add /etc/iwd/main.conf with the following for DHCP:
[network]
EnableNetworkConfiguration=true
ip link to check the network interface is listed and up
iwctl to get an interactive prompt; then device list; turn on if necessary with device set-property Powered on (same with adapter if necessary); scan with station scan; list available networks with station get-networks; connect with station connect
ping -4 archlinux.org to verify connection okwifi-menu
, or refer to Network configuration or Wireless network configuration if that doesn't work.
timedatectl set-ntp true
Check the disk with lsblk
or fdisk -l
and take a note of the device name (/dev/nvme0n1
on the Dell XPS13)
-
Use the GPT disklabel:
parted -a optimal /dev/nvme0n1 mklabel gpt
-
Create a small boot partition:
parted -a optimal -- /dev/nvme0n1 mkpart ESP fat32 1MiB 513MiB set 1 boot on
-
Create a system partition using the rest of the disk:
parted -a optimal -- /dev/nvme0n1 mkpart ext4 513MiB 100%
Persistent block device naming for fstab is achieved by using UUID of the disk.
Use LVM on LUKS.
-
Create the encrypted container on the system partition (choose a good passphrase):
cryptsetup luksFormat /dev/nvme0n1p2
-
Open the container (name it 'luks'):
cryptsetup open /dev/nvme0n1p2 luks
-
Create a Physical Volume on top of the opened LUKS container:
pvcreate /dev/mapper/luks
-
Create a Volume Group and add the Physical Volume to it (name it
main
):vgcreate main /dev/mapper/luks
-
Create Logical Volumes on that Volume Group (50GiB for
/
and 100GiB for/home
, no swap YOLO):lvcreate -L50g main -n root
lvcreate -L100g main --name home
See https://wiki.archlinux.org/index.php/Ext4#Enabling_metadata_checksums and maybe http://www.askapache.com/optimize/super-speed-secrets/
modprobe crc32c_intel
mkfs.ext4 -O metadata_csum,64bit /dev/mapper/main-root
mkfs.ext4 -O metadata_csum,64bit /dev/mapper/main-home
-
mount
/
:mount -o defaults,journal_checksum /dev/mapper/main-root /mnt
-
create mountpoints for
/boot
and/home
:mkdir /mnt/{boot,home}
-
mount
/boot
:mount -o defaults,journal_checksum /dev/nvme0n1p1 /mnt/boot
-
mount
/home
:mount -o defaults,journal_checksum /dev/mapper/main-home /mnt/home
Install the base and base-devel package groups as well as some packages for wireless network configuration, Intel micro-code updates and git:
pacstrap /mnt base base-devel dialog dhcpcd wpa_actiond wpa_supplicant intel-ucode git
pacstrap /mnt base base-devel linux linux-firmware intel-ucode iwd lvm2
sway foot waybar wofi vim brave
Create the fstab
file:
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt
Set the timezone:
ln -fs /usr/share/zoneinfo/Europe/London /etc/localtime
Set the hardware clock (from the system clock but keep it UTC):
hwclock --systohc --utc
Uncomment required localisations in /etc/locale.gen
and regenerate them with locale-gen
.
Set the LANG
variable in /etc/locale.conf
e.g. LANG=en_GB.UTF-8
Make console keyboard mappings and font changes permanent /etc/vconsole.conf
:
FONT=eurlatgr
KEYMAP=us
-
Create the hostname file:
echo <hostname> > /etc/hostname
-
Add a matching entry to
/etc/hosts
:echo 127.0.1.1 <hostname>.localdomain <hostname> >> /etc/hosts
-
Configure wireless with
wifi-menu
. -
Configure wireless to start at boot and automatically connect to known networks:
systemctl enable netctl-auto@<interface_name>.service
(use tab completion to figure out the interface name).
Edit /etc/mkinitcpio.conf
with:
MODULES="EXT4"
HOOKS="autodetect systemd block sd-vconsole sd-encrypt sd-lvm2 fsck keyboard"
Run mkinitcpio -p linux
to generate the initramfs image as /boot/initramfs-linux.img
(see mkinitcpio#hooks)
Setup systemd-boot:
bootctl --path=/boot install
Create a bootloader entry:
UUID=$(cryptsetup luksUUID /dev/nvmen0n1p2)
cat <<EOF>/boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options luks.uuid=$UUID luks.name=$UUID=luks root=/dev/mapper/main-root rw
EOF
Point the bootloader to the default entry (see Basic Configuration):
cat <<EOF>/boot/loader/loader.conf
default arch
editor 0
EOF
Set the root password with passwd
Add a regular user:
useradd -m -g users -G wheel -s /bin/bash franck
passwd franck
Run visudo
and add the following to have my user in the sudoers file :
# options
Defaults editor=/usr/bin/vim, !env_editor
Defaults insults
# full access
franck ALL=(ALL) ALL
# last rule as a safety guard
franck ALL=/usr/sbin/visudo
To add a red blinking prompt for root:
First, copy some skeleton files:
cp /etc/skel/.bash_profile /etc/skel/.bashrc /root
And then edit /root/.bashrc
and set PS1
to:
PS1="\e[1m\e[91m\e[5m[\u@\h]\$\e[m\e(b "
exit
reboot
Add the following repo to /etc/pacman.conf
for easy installation of vivaldi
:
[herecura]
Server = https://repo.herecura.be/herecura/x86_64
ensure that the following options are set:
HoldPkg = pacman glibc
Architecture = auto
Color
CheckSpace
VerbosePkgLists
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
and upgrade the system with sudo pacman -Syu
in order to be able to use it.
add tuning instructions e.g. build in tmpfs (https://wiki.archlinux.org/index.php/Makepkg#Improving_compile_times)
Install the following package groups:
i3 xorg xorg-apps xorg-drivers
Install the packages in packages.lst
with pacman and pacaur.
- systemctl enable --now systemd-timesyncd.service# simple SNTP daemon
- systemctl enable --now docker.service
- cp /etc/iptables/empty.rules /etc/iptables/iptables.rules &&
.. systemctl enable --now iptables.service # safety first (and see Simple Statefull Firewall for configuration)
Clone all the config files from github/kifbv/dotfiles and install them with stow
Plus:
Also see https://wiki.archlinux.org/index.php/Sysctl and https://wiki.archlinux.org/index.php/Improving_performance Fix the layout to be the same as Macbook UK (i.e. use us layout but remap the |\ key next to shift-left to ~`) Relocate files to tmpfs (+ other tips in https://wiki.archlinux.org/index.php/Improving_performance)
Installation guide Improving performance Keyboard shortcuts Keyboard configuration in Xorg Map scancodes to keycodes Extra keyboard keys in Xorg Xbindkeys LVM Mkinitcpio Disk encryption Ext4 Wireless Network Configuration