Skip to content

Instantly share code, notes, and snippets.

@bitob
Last active May 25, 2023 08:14
Show Gist options
  • Save bitob/1f27ce5f4561efb090f87790cdffd413 to your computer and use it in GitHub Desktop.
Save bitob/1f27ce5f4561efb090f87790cdffd413 to your computer and use it in GitHub Desktop.

Arch Linux Installation

This is just how I set up my Arch system with the Plasma Desktop Environment and the Xorg Display Server.
I'm installing the System on a nvme alongside with a Windows 10 Installation. Therefore, there are already nvme0n1p1 - nvmen0n1p4 on the system, created by the windows setup. One of them is the ESP partition that will be reused as /boot/efi.
This setup will use an unencrypted /boot and an encrypted lvm container containing / and /home as well as a swap for hibernate.

When in doubt, always refer (and listen) to the Arch Linux Installation Guide.

Boot the Live System

  • Download the monthly iso
  • Create a bootable usb stick
  • Disable Secureboot
  • Boot the Live Stick

Prepare the Live System

Load Keymap

# loadkeys de-latin1

With a german keyboard, type

# loadkezs deßlatin1

Connect the Internet

Using Ethernet, the inetrnet connection should work out of the box. Check it with

# ip link
# ping archlinux.org

If using wifi, make sure your wifi is not blocked with rfkill, unblock it if needed and connect wifi via iwctl.

Update System Clock

# timedatectl set-ntp true
# date

Prepare your Disk/Partition

The Installation Guide suggest using fdisk -l but using cfdisk is much more intuitive and just easier.

# cfdisk /dev/nvme0n1

Since we want to encrypt swap, / and /home and just leave /boot unencrypted, we will use the layout explained in the LVM on LUKS article.

So we create one partition with 1-2G and change the type to Linux swap (should be nvme0n1p5) as well as one partition with type Linux LVM (should be nvme0n1p6), with will contain swap, / and /home.

Don't forget to write the changes before exit from cfdisk.

Setup LUKS and LVM

LUKS

Create and open the LUKS container

# cryptsetup luksFormat /dev/nvme0n1p6
# cryptsetup open /dev/nvme0n1p6 cryptlvm

LVM

Create a physical volume, a volume group and the 3 logical volumes.
Make sure that swap is bigger than your RAM to ensure easy hibernation. It is possible to hibernate with smaller swaps, but I guess that's advanced stuff with what I don't want to deal right now.

# pvcreate /dev/mapper/cryptlvm
# vgcreate ArchLvmGroup /dev/mapper/cryptlvm
# lvcreate -L 12G ArchLvmGroup -n swap
# lvcreate -L 85G ArchLvmGroup -n root
# lvcreate -l 100%FREE ArchLvmGroup -n home

Create File Systems

Note that the used btrfs is not marked as stable, but a lot of people say it is basically stable and some distros start to use it by default. We use btrfs because I hope we can utilities the backup features.

# mkfs.btrfs /dev/ArchLvmGroup/root
# mkfs.btrfs /dev/ArchLvmGroup/home
# mkswap /dev/ArchLvmGroup/swap

Mount the Filesystem

# mount /dev/ArchLvmGroup/root /mnt
# mkdir /mnt/home
# mount /dev/ArchLvmGroup/home /mnt/home
# swapon /dev/ArchLvmGroup/swap

Don't forget /boot

For /boot we use a stable file system. Since we use the ESP created by windows, we don't need FAT32 for /boot.

mkfs.ext4 /dev/nvme0n1p5
mkdir /mnt/boot
mount /dev/nvme0n1p5 /mnt/boot
mkdir /mnt/boot/efi
mount /dev/nvme0n1p1 /mnt/boot/efi

Install the System

Base System

We use the default kernel 'linux'. It is possible to add different kernels here, like the linux zen kernel etc.

# pacstrap /mnt base base-devel linux linux-firmware

Additional Packages

Since Arch Linux is minimal, we need a bunch of additional packages like sudo, man, a text editor and a network manager.

# pacstrap /mnt git vi neovim sudo man man-db man-pages texinfo networkmanager btrf-progs

Generate File System Table

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

Setup the System

Go into the new System

# arch-chroot /mnt

Set Timezone

# ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
# hwclock --systohc

Localization

Uncomment en_US.UTF-8 UTF-8 in /etc/locale.gen.
Since a german linux system is a pain in every orifice, just stay with US!
Run:

# locale-gen

Set the LANG Variable

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

Set Keymap

# echo "KEYMAP=de-latin1" >> /etc/vconsole.conf

Set Hostname

# echo "<hostname>" >> /etc/hostname

Configuring mkinitcpio

Install lvm

# pacman -S lvm2

Add missing HOOKS

Make sure the keyboard, keymap, encrypt and lvm2 hooks are set in /etc/mkinitcpio.conf.

HOOKS=(base udev autodetect modconf keyboard keymap block encrypt lvm2 filesystems fsck)

Generate initramfs

# mkinitcpio -P

Bootloader

Install Grub

# pacman -S grub efibootmgr

Configure Grub

Add the cryptdevice to the kernel parameters in /etc/default/grub.
Since we will need the UUID of our crpytlvm, we can find it with

# blkid

The UUID we are looking for is the one from /dev/nvme0n1p6.

GRUB_CMDLINE_LINUX_DEFAULT="... cryptdevice=UUID=<device-UUID>:cryptlvm root=/dev/ArchLvmGroup/root"

Install the Bootloader

# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ArchGrub
# grub-mkconfig -o /boot/grub/grub.cfg

Set the Root Password

# passwd

Reboot

# exit
# umount -R /mnt
# poweroff

Remove the Live Stick and cross your fingers while booting the new system.

Enable Network

# systemctl start NetworkManager.service
# systemctl enable NetworkManager.service
# ping archlinux.org

At least for Ethernet, that's all what it needs.

General recommendations

Maybe it makes sense to have a look on this: https://wiki.archlinux.org/title/General_recommendations

Install KDE Plasma

Install XOrg

I use XOrg instead of Wayland to avoid screensharing issues with Microsoft Teams.

# pacman -S xorg

Install Graphic Driver

Refer to the Arch Wiki.
Find the Graphic Device and install the correct graphics driver (for me intel)

# lspci -v | grep -A1 -e VGA -e 3D
# pacman -Ss xf86-video
# pacman -S xf86-video-intel

Install Plasma

We use the plasma meta package to get all the plasma stuff that is available.

# pacman -S plasma-meta

Choose the font you want. It is recommended to use vlc over gstreamer.

Install KDE Applications

Choose your Apps from the kde-applications package. Typical apps like dolphin, ark, konsole, kate, partitionmanager, yakuake, etc. are recommended. You probably will never use all 172 packages...

# pacman -S kde-applications
<Choose your apps here>

Install the Simple Desktop Display Manager

SDDM is the recommended display manager for KDE Plasma.

# pacman -S sddm
# systemctl enable sddm.service

Create your user

And give him permission to sudo

# useradd -m -G wheel <user>
# passwd <user>
# sudoedit /etc/sudoers
// Uncomment the line %wheel    ALL=(ALL) ALL
// :wq to save and quit from vi

Reboot

# reboot

You should be able to log in via SDDM into Plasma with your user.
You can setup the wifi connection now via the Plasma Network Widget (bottom right).

Enable Hibernation

Grub

Add the resume kernel parameter in /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT="... resume=/dev/ArchLvmGroup/swap"

and regenerate the config

# grub-mkconfig -o /boot/grub/grub.cfg

Initramfs

Add the resume hook after the lvm2 hook in /etc/mkinitcpio.conf

HOOKS=(... lvm2 resume filesystems ...)

And regenerate the initramfs

# mkinitcpio -P

Install a graphical package manager

As with Manjaro, we can use pamac to manage the official repos as well as AUR, flatpaks and snaps inclusive updates in a simple GUI.

# pacman -S flatpak
# 
# git clone https://aur.archlinux.org/snapd.git
# cd snapd
# mkpkg -si
# cd ..
# rm -rf snapd
# 
#  git clone https://aur.archlinux.org/snapd-glib.git
# cd snapd-glib
# makepkg -si
# cd ..
# rm -rf snapd-glib
#
# git clone https://aur.archlinux.org/archlinux-appstream-data-pamac.git
# cd archlinux-appstream-data-pamac
# makepkg -si
# cd ..
# rm -rf archlinux-appstream-data-pamac
#
# git clone https://aur.archlinux.org/libpamac-full.git
# cd libpamac-full
# makepkg -si
# cd ..
# rm -rf libpamac-full
#
# git clone https://aur.archlinux.org/pamac-all.git
# cd pamac-all
# makepkg -si
# cd ..
# rm -rf pamac-all

Enable Secureboot

TODO!

Custom Settings

  • Remove us keyboard and add de keyboard
  • Install xf86-input-synaptics and configure the toiuchpad
  • Don't restore auto saved session
  • TBC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment