Archlinux installation
Installation
-
Prepare installation media and boot on it.
-
Installation
-
Partition with parted
-
Start
parted
usingparted /dev/[drive]
. Identify[drive]
to use for installation usinglsblk
. -
Create partitions. First partition is for EFI. Last partition is for Swap. Adapt the middle partition size to your drive (here ~200GB). The swap partition should be at least the size of your RAM.
mklabel gpt mkpart primary 1MiB 500MiB mkpart primary 500MiB 200GB mkpart primary 200GB 100% set 1 boot on
To align partitions with drive sectors, the partition Start should be 2048s or with B unit 1047576, or with MiB unit exactly 1.00.
-
-
Format partitions
mkfs.vfat -F 32 -n ESP /dev/sda1 mkfs.ext4 -L archroot /dev/sda2 tune2fs -m1 /dev/sda2 # 1% reserved space tune2fs -i 6m /dev/sda2 # Check interval (6 months) mkswap -L archswap /dev/sda3
-
Mount partitions
- Main partition (discard option only for SATA SSD; not for NVMe or HDD).
mount -o discard /dev/sda2 /mnt
- EFI system partition (ESP) (see below to install a bootloader).
- Swap
swapon /dev/sda3
- Main partition (discard option only for SATA SSD; not for NVMe or HDD).
-
[Optional] Update Pacman mirror list using reflector with one of these options:
- Fast option: Get top 10 mirrors scored by Archlinux
reflector --save /etc/pacman.d/mirrorlist --country us --score 10
- Accurate option: Get top 10 mirrors scored by download speed from your location
reflector --save /etc/pacman.d/mirrorlist --country us --number 10 --sort rate
List of countries can be obtained using
reflector --list-countries
to change the--country
option. - Fast option: Get top 10 mirrors scored by Archlinux
-
Connect to internet if it wasn’t done during boot
-
Install packages
pacstrap /mnt base base-devel linux linux-firmware nano dosfstools nftables openssh rsync tree man-db
-
Preliminary configuration
Within the new filesystem
-
Chroot. Change root into the new system:
arch-chroot /mnt
-
Hostname
echo "<hostname>" > /etc/hostname
-
Microcode [optional but recommended]
Load microcode for AMD or Intel CPU at boot.
-
Install package
intel-ucode
for Intel oramd-ucode
for AMD -
After rebooting, loaded microcode can be check using
dmesg | grep microcode
or reading/sys/devices/system/cpu/cpu0/microcode/version
-
-
Bootloader: GRUB is recommended
-
GRUB
GRUB is an advanced bootloader. Drivers for most filesystems are included: GRUB can read the kernel and initramfs directly on the system partition where they are installed by Pacman, and doesn’t require them to be copied on the ESP. While it provides an advanced system to generate a configuration file, it can be manually configured simply in the main configuration file
/boot/grub/grub.cfg
.-
Mount ESP on
/efi
and create following directories.mkdir /efi mount /dev/sda1 /efi
-
Install
grub
package -
Install grub
grub-install --target=x86_64-efi --efi-directory=/efi --removable
This will create
/efi/EFI/BOOT/BOOTX64.EFI
and all GRUB config files in/boot/grub
. -
Configure GRUB
- Copy grub.cfg in
/boot/grub
- Copy grub.cfg in
-
CPU microcode: Since mkinitcpio v38, the CPU microcode is packed together with the main initramfs image. In consequence, no configuration of GRUB is needed.
-
Microsoft Windows: GRUB can chainload the Windows bootloader.
- Add to
/boot/grub/grub.cfg
:menuentry "Windows" { insmod part_gpt insmod fat insmod chain search --no-floppy --set=root --label "ESP" chainloader ($root)/EFI/Microsoft/Boot/bootmgfw.efi }
- Turn-off Fast Startup
- Add to
-
-
systemd-boot
systemd-boot is integrated into systemd. While simple and robust, it can only read from the ESP, i.e. no ext4 driver is integrated. To have access to the kernel and initramfs, one can either (i) bind (with
mount --bind
) theESP/arch
folder to/boot
. But with this solution/boot
is a FAT partition with limited functionality. Or (ii) add a hook to Pacman to automatically copy the kernel and initramfs to the ESP each time it’s updated. The hook method is explained below.File Description loader.conf Main systemd-boot config arch.conf Archlinux loader check-esp.hook Pacman ESP hook copy-boot-esp.hook Pacman ESP hook -
Mount ESP on
/efi
and copy kernel and initramfs to it.mkdir /efi mount /dev/sda1 /efi mkdir /efi/arch cp /boot/*img /boot/vm* /efi/arch
-
Install systemd-boot
bootctl --path /efi --no-variables install
-
Configure systemd-boot
- Copy loader.conf in
/efi/loader
- Copy arch.conf in
/efi/loader/entries
- Copy loader.conf in
-
Configure pacman hooks
- Create folder
/etc/pacman.d/hooks
- Copy check-esp.hook and copy-boot-esp.hook in it
- Create folder
-
Configure microcode
- In
/efi/loader/entries/arch.conf
, before the initramfsinitrd
line, add the line:- Intel
initrd /arch/intel-ucode.img
- AMD
initrd /arch/amd-ucode.img
- Intel
- Copy microcode to EFI
cp /boot/*img /efi/arch
- In
-
If Microsoft Windows and Linux are sharing the same ESP, systemd-boot can be set as main bootloader:
- Issue as admin in terminal:
bcdedit /set {bootmgr} path \EFI\systemd\systemd-bootx64.efi
- Turn-off Fast Startup
- Issue as admin in terminal:
-
-
-
Configuring Locals
-
Uncomment local in
/etc/locale.gen
(en_US.UTF-8 and/or fr_FR.UTF-8) -
Run
echo "LANG=\"en_US.UTF-8\"" > /etc/locale.conf locale-gen
-
Time
ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime
-
-
For NVMe SSD, enable periodic trim by enabling fstrim.timer systemd timer.
-
Set root password with
passwd
. -
Exit arch-chroot.
Final step & reboot
-
Creating fstab
genfstab -Lp /mnt > /mnt/etc/fstab
-
Unmount install partitions:
umount -R /mnt
-
Reboot
Configuration
Network
-
Nftables (firewall). Copy nftables.conf in
/etc
and start and enable nftables systemd service. (Check Nftables is loaded usingnft list ruleset
) -
SSH. Enable sshd systemd service.
-
Network interface
-
Networkd (systemd) - One wired fixed
-
Create /etc/systemd/network/wired.network (replace interface name enp1s0 with yours. You can list interfaces using
ip link
):[Match] Name=enp1s0 [Network] DHCP=yes
-
Enable systemd-networkd and systemd-resolved (to get DNS from DHCP) services.
-
Before starting network or rebooting, remove if it exists
/etc/resolv.conf
-
-
Netctl - Complex connections
-
NetworkManager - Laptop
- Install networkmanager packages
- Enable NetworkManager systemd service
- If systemd is starting service(s) that require an active connection, enable service NetworkManager-wait-online
-
-
Time synchronization with timesyncd (systemd)
timedatectl set-ntp true
Graphical desktop environment
-
Install KDE & enable SDDM (Simple Desktop Display Manager)
pacman -Sy plasma-meta systemctl enable sddm
If necessary, set SDDM keyboard config (for a french keyboard):
localectl set-x11-keymap fr
-
Install either
kde-applications-meta
(full install), or a sub-package likekde-utilities-meta
, or none for a minimal install. -
To enable Wayland-based Plasma session, install
plasma-wayland-session
. -
For video hardware decoding, with Intel CPU from Broadwell (2014), install
intel-media-driver
(see wiki for older GPU).
User config
-
Add a normal user (adapt or remove user and group ID)
groupadd -g 1000 charles useradd -m -u 1000 -g 1000 charles passwd charles
-
Keyboard layout can be configured directly in KDE System Settings.
- With an canadian Apple keyboard:
- Keyboard model is “Generic 104-key PC”
- The ~ and < are reversed. Copy Xmodmap in user’s home as
~/.Xmodmap
. - Install package
xorg-xmodmap
if necessary.
- With an canadian Apple keyboard:
-
Fonts and anti-aliasing.
- Copy Xresources in user’s home as
~/.Xresources
. - Copy fonts.conf in
~/.config/fontconfig
.
- Copy Xresources in user’s home as
-
Bluetooth. Enable bluetooth systemd service.
-
Sound
-
Display sound cards with
aplay -l
(fromalsa-utils
package). -
If there are two cards, their order will be random as detection by Udev is random. To maintain the main soundcard at the first position, add in
/etc/modprobe.d/alsa.conf
(replacesnd-ice1712
with sound card driver):options snd-ice1712 index=0
-
PulseAudio defaults hardware to use 44.1 kHz or 48 kHz sample rate. In case of crack sounds and if the sound card can handle multiple sample rates (i.e. 44.1, 48 or 96Khz), set PulseAudio to not systematically resample sound. Add to
~/.config/pulse/daemon.conf
:avoid-resampling = yes
-
-
Printing
- Install
cups
package - Enable cups.service systemd service
- Configure printer(s) at http://localhost:631
- Install
-
Recommended packages
pacman -S ttf-croscore pacman -S chromium firefox pacman -S audacious mpv pacman -S libreoffice-fresh hunspell-en_US hunspell-fr hyphen-en hyphen-fr pacman -S jre11-openjdk icedtea-web