iolk / dot-files

My ArchLinux configuration guide

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArchLinux Install

Updated on 13 Dec 2020

Attention: this installation guide is just the detailed procedure that i followed to install ArchLinux on my HP Elitebook 8470p so it does not take into account problems on other machines

If you have already installed Arch please go to "ArchLinux Configuration" section below

First follow the ArchLinux Installation Guide until the disk partition section

Partitioning

I choose to use UEFI with GPT partition table.

Reason "You are using Arch. Why would you even consider legacy anything?"

This is my partition scheme

Mount point Partition type Size
/mnt/boot EFI system partition 512M
[SWAP] Linux swap 6G (6GB RAM)
/mnt Linux x86-64 root (/) Remainder

From now i suppose that the disk to partitionate is /dev/sda To make this partiotion scheme:

  • Remove all the partitions with fdisk or gdisk
  • Check with fdisk -l /dev/sda if your hard drive has Disklabel type: gpt if not convert it to GPT with sgdisk -g /dev/sda
  • Make the partitions with gdisk
Partition type gdisk code
EFI system partition ef00
Linux swap 8200
Linux x86-64 root (/) 8304

Format Partitions

It's recommended to use FAT32 for the EFI System Partition

mkfs.ext4 /dev/sda3
mkfs.fat -F32 /dev/sda1
mkswap /dev/sda2

Mount the file systems

mount /dev/sda3 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot
swapon /dev/sda2

Install essential packages

pacstrap /mnt base linux linux-firmware

I prefer to install other packages while chrooted.

Generate Fstab

Insted of using -U option i decided to use PARTUUID as source identifier since i choose GPT

genfstab -t PARTUUID /mnt >> /mnt/etc/fstab

Then follow the system configuration section until the bootloader

Install some useful stuff

While chrooted please make sure that you install those in order to have a usable system when rebooted. Especially net-tools,iw and iwd for the network and WiFi

pacman -S nano net-tools htop iw iwd zsh intel-ucode git reflector curl

Bootloader

Since i had some problems with the HP UEFI firmware i decided to use GRUB as bootloader instead of use UEFI directly BUT i will remove GRUB as soon as possible

GRUB Installation

First check your firmware bitness

Please make sure that you have installed the microcode (intel-ucode or amd-ucode ) before installing GRUB

While chrooted follow the GRUB UEFI Installation:

pacman -S grub efibootmgr
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB

Remeber that if you firmware bitness is 32 you have to use --target=i386-efi

For HP users

I don't know if that applies to all HPs but it's worth to check

As described in HP Elitebook 840 G1 UEFI setup: "The problem is that HP hard coded the paths for the OS boot manager in their UEFI boot manager to \EFI\Microsoft\Boot\bootmgfw.efi to boot Microsoft Windows, regardless of how the UEFI NVRAM variables are changed"

With the HP Elitebook 8470p i experienced the same issue and followed the "Using the Customized Boot path option" section **but remember ** that your EFI path is \EFI\GRUB\grubx64.efi **not ** \EFI\grub\grubx64.efi

Then finally boot your ArchLinux

exit
umount -R /mnt
reboot

ArchLinux Configuration

Configure ZSH

chsh -s /bin/zsh

WiFi Connection

The wired connection is not covered yet

If you installed the packages in the "Install some useful stuff" then:

systemctl enable systemd-networkd
systemctl enable systemd-resolver
systemctl enable iwd
systemctl start systemd-networkd
systemctl start systemd-resolver
systemctl start iwd

ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

Edit /etc/iwd/main.conf with:

[General]
AddressRandomization=once
AddressRandomizationRange=nic
EnableNetworkConfiguration=true
[Network]
NameResolvingService=systemd

Then run iwctl and connect to a wireless network

station wlan0 scan
station wlan0 get-networks
station wlan0 connect your_network

and then try to ping google.com. It should work.

Add and log as a non-root user

First install sudo and allow the wheel group to run it

pacman -S sudo 
EDITOR=nano visudo

Then simply uncomment the %wheel ALL=(ALL) ALL line and add your user

useradd -m -G rfkill,uucp,wheel,tty,power,audio,users -s /bin/zsh your_fancy_username
passwd your_fancy_username
exit

References: Sudo and Users and groups

Installing packages

Optional: if you want to speed-up the download you can run reflector:

sudo reflector --verbose --latest 30 --sort rate --save /etc/pacman.d/mirrorlist

Please install Oh My Zsh (check the link instructions)

Then to install all the packages:

cd ~
git clone https://github.com/iolk/dot-files.git
mv dot-files/* ./
mv dot-files/.* ./
rmdir dot-files
pacman -S --needed $(comm -12 <(pacman -Slq | sort) <(sort .pkg-list))

You can check and modify the packages in the .pkg-list if you want

Optional configs

RClone with Drive

In order to syncronize my KeePass file between devices i use Google Drive. I decided to use RClone to mount my drive directory.

Simply run rclone configure and configure a remote (in this case a Google Drive remote) and then:

  • Check the file ~/.config/systemd/user/keepassondrive.service (set proper dirs/remote)
  • systemctl --user enable keepassondrive

That allows you to mount you remote directory as soon as the internet connection is established

Update redshift coordinates

nano ~/.config/redshift/redshift.conf

Power management

TLP & acpid

systemctl enable tlp
systemctl enable acpid

Fonts

Enable font presets by creating symbolic links:

sudo ln -s /etc/fonts/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d
sudo ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d
sudo ln -s /etc/fonts/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d

The above will disable embedded bitmap for all fonts, enable sub-pixel RGB rendering, and enable the LCD filter which is designed to reduce colour fringing when subpixel rendering is used.

GTK, Icon and Cursor themes

If you want to change your gtk/icon/cursor theme just install it and run lxappearance to set it

To install the cursor theme put the theme files in ~/.icons in this case you can see the Vimix-cursors folder

To install the theme download it and extract in /usr/share/themes/

Themes used in this configuration:

Dark theme preference

In the ~/.config/gtk-3.0/settings.ini you can change the gtk-application-prefer-dark-theme option

Kernel-based Virtualizzation

To start libvirt

~/.config/i3/scripts/libvirtd_start.sh

For futher configurations: https://libvirt.org/auth.html https://jamielinux.com/docs/libvirt-networking-handbook/ https://www.redhat.com/archives/vfio-users/2015-November/msg00159.html

If virsh net-list --all shows no networks make a file default.xml: (ref.)

<network>
  <name>default</name>
  <uuid>9a05da11-e96b-47f3-8253-a3a482e445f5</uuid>
  <forward mode='nat'/>
  <bridge name='virbr0' stp='on' delay='0'/>
  <mac address='52:54:00:0a:cd:21'/>
  <ip address='192.168.122.1' netmask='255.255.255.0'>
    <dhcp>
      <range start='192.168.122.2' end='192.168.122.254'/>
    </dhcp>
  </ip>
</network>

then

sudo virsh net-define --file default.xml
sudo virsh net-start default
sudo virsh net-autostart --network default

Docker

I set up some aliases in the .zshrc file so to start/stop the docker.service run dockerd start/stop:

Useful commands:

d rm $(d ps -aq)
d kill $(d ps -aq)
d rmi $(d images --filter "dangling=true" -q --no-trunc)

Install docker-compose

sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose   
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

MPD

sudo systemctl start mpd
sudo systemctl enable mpd

Security

From the ArchLinux Security page:

  • Firewall
  • VPN
  • AppArmor
  • Kernel lockdown mode
  • Microcode
  • Hardware vulnerabilities
  • Password manager
  • Do not use the root account for daily use
  • Enforce a delay after a failed login attempt
  • Lock out user after three failed login attempts
  • Limit amount of processes
  • Run Xorg rootless
  • Kernel hardening
  • DNSCrypt

Todos

Currently evaluating Sway + Wayland

About

My ArchLinux configuration guide


Languages

Language:Shell 96.9%Language:Dockerfile 3.1%