Workstation
This page contains the documentation of my usual workstation setup. Most of it was taken from the following ressources:
Preparation
- Prepare https://www.ventoy.net on an USB drive
- Download the Arch Linux image from https://archlinux.org/download/ and copy it to the USB drive
- Set up the BIOS:
- Disable secure boot1
- Swap Fn and Ctrl keys
- Enable function keys as primary function
- Enable virtualization
- Set BIOS passwords
- Connect the device to the internet
- Boot into Ventoy and select the Arch Linux image
- Change keyboard layout with
loadkeys de_CH-latin1 - Update system clock with
timedatectl set-ntp true - Make sure the device is charged enough or connected to power
- Get battery capacity with
cat /sys/class/power_supply/BAT0/capacity
- Get battery capacity with
Access via SSH
Connecting to the live environment via SSH becomes handy, when you need to do some research on the internet, copy some commands or working on a different and maybe more comfy workplace.
- Reset the root password with
passwd - Allow login as root with password
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config - Reload SSH service with
systemctl restart sshd.service - Find the IP address with
ip addr show - Connect from another computer with
ssh -o PreferredAuthentications=password root@[ip-address]
Partitioning
- Find installed block devices with
fdisk -l - If there is a EFI partition with at least 200 MiB it can be used for
/boototherwise the size should be increased or a separate/bootpartition created - Partition the block device with
fdisk /dev/nvme0n1to something likeDevice Start End Sectors Size Type /dev/nvme0n1p1 2048 2099199 2097152 1G EFI System /dev/nvme0n1p2 2099200 2000408575 1998309376 952.9G Linux filesystem - Encrypt system partition with
cryptsetup luksFormat /dev/nvme0n1p2- Read carefully how to confirm
- Mount encrypted partition to
cryptlvmwithcryptsetup open /dev/nvme0n1p2 cryptlvm - Create a physical volume on top of the LUKS container with
pvcreate /dev/mapper/cryptlvm - Create a volume group with the previously create physical volume with
vgcreate systemcryptlvm /dev/mapper/cryptlvm - Create logical volumes on the volume group:
lvcreate -L 8G systemcryptlvm -n swap lvcreate -L 400G systemcryptlvm -n root lvcreate -l 100%FREE systemcryptlvm -n home - Format filesystem on each logical volume:
mkfs.btrfs /dev/systemcryptlvm/root mkfs.btrfs /dev/systemcryptlvm/home mkswap /dev/systemcryptlvm/swap - If necessary format EFI partition with
mkfs.fat -F32 /dev/nvme0n1p1 - Mount filesystems:
mount /dev/systemcryptlvm/root /mnt mkdir /mnt/home mount /dev/systemcryptlvm/home /mnt/home swapon /dev/systemcryptlvm/swap - Mount boot partition2:
mkdir /mnt/boot mount /dev/nvme0n1p1 /mnt/boot
Install base system
- Set appropriate mirrors in
/etc/pacman.d/mirrorlistor viareflector --country Switzerland --age 12 --protocol https --sort rate --download-timeout 10 --save /etc/pacman.d/mirrorlist - Install base system with
pacstrap /mnt base linux linux-firmware - Generate an fstab file
genfstab -U /mnt >> /mnt/etc/fstab - Change root into the new system with
arch-chroot /mnt - Install
lvm2,vimandbtrfs-progswithpacman -S lvm2 vim btrfs-progs - Update hooks in
/etc/mkinitcpio.conftoHOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block encrypt lvm2 filesystems fsck)by addingencrypt lvm2using vim - Set time zone
ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime - Set hardware clock with
hwclock --systohc - Uncomment locale
en_US.UTF-8 UTF-8undde_CH.UTF-8 UTF-8in/etc/locale.gen - Generate locales with
locale-gen - Set locale in
/etc/locale.conftoLANG=en_US.UTF-8 - Set keymap in
/etc/vconsole.conftoKEYMAP=sg FONT=eurlatgr- All locales with
localectl list-keymaps - All fonts with
ls -l /usr/share/kbd/consolefonts/ | grep -i ".psfu.gz"
- All locales with
- Set hostename in
/etc/hostname - Create new
initramfswithmkinitcpio -P - Set root password with
passwd
Boot manager
- Install
grubandefibootmgrpackages withpacman -S grub efibootmgr - Install bootloader with
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB - Get UUID of cryptdevice with
blkid | grep crypto - Edit
/etc/default/grub:- Add
GRUB_DISABLE_OS_PROBER=falseat the end of the file to preventWarning: os-prober will not be executed to detect other bootable partitionand install packageos-proberif you want to dual boot - Change
GRUB_CMDLINE_LINUX="cryptdevice=UUID=904eab28-ca25-4c03-a948-75539689b4d1:cryptlvm root=/dev/systemcryptlvm/root"
- Add
- Generate GRUB configuration
grub-mkconfig -o /boot/grub/grub.cfg
Microcode
- Add microcode package with
pacman -S amd-ucodeorpacman -S intel-ucode - Regenerate GRUB configuration
grub-mkconfig -o /boot/grub/grub.cfg
User management
- Add a user
useradd -m robin - Set password
passwd robin - Add sudo package
pacman -S sudo - Edit sudoers file with
EDITOR=vim visudo - Uncomment that members of group
sudocan execute any command by uncommenting the line%sudo ALL=(ALL:ALL) ALL - Add group sudo with
groupadd sudo - Add user to group sudo
gpasswd -a robin sudo
Graphical User Interface
- Install Gnome with
pacman -S gnome - Enable
gdmwithsystemctl enable gdm - Set x11 keymap with
localectl --no-convert set-x11-keymap ch - Configure Gnome:
- Fast cursor speed
gsettings set org.gnome.desktop.peripherals.mouse speed 1 - Fast touchpad speed
gsettings set org.gnome.desktop.peripherals.touchpad speed 1 - Tab to click for touch pad
gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true - Set keyboard layout
gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'ch')]" - Allow ALT and right mouse button to resize windows
gsettings set org.gnome.desktop.wm.preferences resize-with-right-button true - Define keyboard shortcuts for opening terminal and browser
- Enable switching windows shortcut on ALT + Tab in
Keyboardsettings - Enable night light mode
- Enable Auto login
- Edit
/etc/gdm/custom.conf:[daemon] AutomaticLoginEnable=True AutomaticLogin=robin
- Edit
- Fast cursor speed
- Add network manager package
pacman -S networkmanager - Enable network manager
systemctl enable NetworkManager.service - Enable Gnome Keyring SSH Agent with
systemctl --user enable --now gcr-ssh-agent - Define
SSH_AUTH_SOCKin.bashrcwithexport SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/gcr/ssh - Install a Chinese font
pacman -S noto-fonts-cjk
Reboot to system
- Logout CTRL + D
- Unmount
umount -R /mnt - Restart
reboot
AUR helper
- Install build tools
pacman -S --needed base-devel git - Clone paru
git clone https://aur.archlinux.org/paru.git - Build paru
cd paru && makepkg -si
Drivers and firmware support
- Install firmware updated
paru -S fwupd - Get new update metadata
fwupdmgr get-updates - Install updates
fwupdmgr update - Enable bluetooth
systemctl enable --now bluetooth - Install fingerprint reader
paru -S fprintd- Scan fingerprint in Gnome Settings
- Install tlp
paru -S tlp tlp-rdw- Enable service
systemctl enable --now tlp.service - Enable service
systemctl enable --now NetworkManager-dispatcher.service - Mask
systemctl mask systemd-rfkill.serviceandsystemctl mask systemd-rfkill.socket - Set battery thresholds with
tlp setcharge 60 80 BAT0
- Enable service
- Install printer support
paru -S cups hplib
Configure VPN
- Configure Wireguard via NetworkManager
Tools
For more details about the software I use have a look at the software page.
- Install git
pacman -S git- Configure user and email
git config --global user.name "Robin" && git config --global user.email "[email protected]" - Configure GPG key
git config --global user.signing - Enable commit signing by default
git config --global commit.gpgsign true
- Configure user and email
- Install docker (Container runtime)
paru -S docker docker-compose docker-buildx- Add user to docker group
gpasswd -a robin docker - Restart
- Add user to docker group
- Install localesend (Share data and files locally)
paru -S localesend-bin - Install Firefox (Browser)
paru -S firefox- Login into Mozilla account
- Install Visual Studio Code (Editor)
paru -S visual-studio-code-bin- Install Firacode font
paru -S ttf-fira-code - Login with Github
- Install Firacode font
- Install KeepassXC (Password manager)
paru -S keepassxc - Install Evolution (Mail client)
paru -S evolution- Configure email accounts
- Configure webdav accounts
- Install LibreOffice (Office suite)
paru -S libreoffice-fresh- Enable experimental features in settings “Options > LibreOffice > Advanced”
- Enable Tabbed/Ribbon UI “View > User Interface”
- Install network tools
paru -S nmap bind-tools - Install man pages
paru -S man-db man-pages - Install fish
paru -S fish- Set fish as default interactive shell
kgx -e fish - Configure fish with
fish_config - Install fisher
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
- Set fish as default interactive shell
Device specific
Lenovo ThinkPad P14s Gen 4 AMD
- Prevent the touchpad from waking up the device3
- Create a new udev rule at
/etc/udev/rules.d/99-disable-touchpad-wakeup.rules - Add the following content:
KERNEL=="i2c-SYNA8018:00", SUBSYSTEM=="i2c", ATTR{power/wakeup}="disabled"
- Create a new udev rule at