Skip to content

5.Post installation

Julien Chappuis edited this page Jan 13, 2024 · 24 revisions

Post-installation

Table of Contents

This part follows closely the Arch wiki Installation Guide, and covers the parts called Post installation (i.e General recommendations) in the wiki.

The goal is to reach a fully functional command line environment. Desktop environment installation will be covered in the next page.

Connect to the wifi (command line)

laptop
ping -c 3 www.google.com (1)
nmcli dev wifi connect <SSID> password “<password>” (2)
ping -c 3 www.google.com (3)
  1. this should fail as the wifi is off

  2. replace <SSID> and <password>

  3. this should succeed

Activate TRIM for SSDs

sudo systemctl enable fstrim.timer

Fix /data ownership

sudo chown jubi /projects
sudo chown jubi /data

Install nvidia drivers

workstation
sudo pacman -S linux-headers
sudo pacman -S nvidia libglvnd nvidia-utils opencl-nvidia nvidia-settings
sudo vim /etc/mkinitcpio.conf
  • Edit the MODULES line

MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
sudo vim /boot/loader/entries/arch.conf
  • Add to options line

nvidia-drm.modeset=1 nvidia-drm.fbdev=1
sudo mkinitcpio -P
sudo reboot
  • After reboot, launch nvidia-smi to test if all cards are detected

Enabling persistence daemon for CUDA

sudo systemctl enable nvidia-persistenced.service

Configure Linux LTS

Note : only do this on dual boot systems if you have extended the size of Windows EFI partition. 2 kernels take ~116MiB, which won’t fit on the standard 100MiB size.

The goal here is to have a backup kernel (using the LTS version) in case a kernel update creates any issues.

sudo pacman -S linux-lts linux-lts-headers
cd /boot/loader/entries
sudo cp arch.conf arch-lts.conf

sudo vim arch-lts.conf
  • Modify the file as follows, paying attention to the "-lts" suffixes

title Archlinux LTS
linux vmlinuz-linux-lts
initrd /intel-ucode.img
initrd /initramfs-linux-lts.img
options root=PARTUUID=xxxxxxxxxxxx rw nvidia-drm.modeset=1 nvidia-drm.fbdev=1    #this line is the same for both kernels. Don't modify the xxxxxxxx part
cd ..                       #(goes to /boot/loader)
sudo vim loader.conf        #this option will provide options at boottime
  • Modify the file as follows :

timeout 5 (uncomment this line)
console-mode keep
#default xxxxxxxxxxxx       #comment this line
default arch
mkinitcpio -P
sudo bootctl update
sudo bootctl status

nVidia (DKMS option for Wayland)

sudo pacman -S nvidia-dkms (1)
  1. Works both for nvidia and nvidia-lts

sudo systemctl enable nvidia-suspend.service
sudo systemctl enable nvidia-hibernate.service
sudo systemctl enable nvidia-resume.service

Install and configure Git

Install Git

sudo pacman -S git

Configure Git

git config --global user.name "<name>"      #put your desired <name>
git config --global user.email "<email>"    #put your <email>
git config --global init.defaultBranch main

Install and configure Paru (AUR heper)

I use paru as my AUR helper of choice as it is a maintained successor of Yaourt.

Paru

Install Rust

pacman -S rustup
rustup default stable #(1)
  1. Installs the stable rust toolchain

Install Paru

cd ~
mkdir Downloads
cd Downloads
git clone https://aur.archlinux.org/paru.git
cd paru
less PKGBUILD (1)
makepkg –si
  1. Check that everything is OK

Configure Paru

Make sure that CombinedUpgrade, UpgradeMenu, NewsOnUpgrade are activated. Add SkipReview

sudo vim /etc/paru.conf

Configure Pacman

This enables colored output and parallel download.

sudo vim /etc/pacman.conf
#Uncomment the line Color
#Uncomment the line ParallelDownloads = 5

Configure paccache

This enables automatic cleaning of pacman cache (weekly)

paru -S pacman-contrib
sudo systemctl enable paccache.timer

Install reflector to manage /etc/pacmand.d/mirrorlist automatically

Reference

Install reflector

paru -S reflector

Configure reflector (run once)

As a service :

cd /etc/xdg/reflector
sudo rm reflector.conf
sudo curl -L -O "https://raw.githubusercontent.com/Jubijub/arch-config/master/etc/xdg/reflector/reflector.conf"
sudo systemctl start reflector.service

reflector.conf

# Reflector configuration file for the systemd service.
#
# Empty lines and lines beginning with "#" are ignored.  All other lines should
# contain valid reflector command-line arguments. The lines are parsed with
# Python's shlex modules so standard shell syntax should work. All arguments are
# collected into a single argument list.
#
# See "reflector --help" for details.

# Recommended Options

# Set the output path where the mirrorlist will be saved (--save).
--save /etc/pacman.d/mirrorlist

# Select the transfer protocol (--protocol).
--protocol https

# Select the country (--country).
# Consult the list of available countries with "reflector --list-countries" and
# select the countries nearest to you or the ones that you trust. For example:
--country Switzerland,France,Germany

# Use only the  most recently synchronized mirrors (--latest).
#--latest 5

# Sort the mirrors by synchronization time (--sort).
--sort rate

Manual launch :

sudo reflector --country Switzerland --age 24 --protocol https --sort rate --verbose --save /etc/pacman.d/mirrorlist
# this will fetch the latest servers from CH, speed rank them, then write the result to mirrorlist

Automate Reflector launch

Every week
sudo systemctl enable reflector.timer
After every update of pacman-mirrorlist Using my mirrorupgrade.hook
cd /etc/pacman.d/hooks
sudo curl -L -O "https://raw.githubusercontent.com/Jubijub/arch-config/master/etc/pacman.d/hooks/mirrorupgrade.hook"
Manual edit of mirrorupgrade.hook
sudo vim /etc/pacman.d/hooks/mirrorupgrade.hook
  • Edit the file so that it contains :

[Trigger]
Operation = Upgrade
Type = Package
Target = pacman-mirrorlist

[Action]
Description = Updating pacman-mirrorlist with reflector and removing pacnew...
When = PostTransaction
Depends = reflector
Exec = /bin/sh -c "reflector --country Switzerland --age 24 --protocol https --sort rate --verbose --save /etc/pacman.d/mirrorlist;
rm -f /etc/pacman.d/mirrorlist.pacnew"

Configure Google DNS

paru -S openresolv dnsutils

Fetch resolvconf.conf

cd /etc
sudo curl -L -O "https://raw.githubusercontent.com/Jubijub/arch-config/master/etc/resolvconf.conf"

Manually edit resolvconf.conf

sudo vim /etc/resolvconf.conf
  • Edit name_servers line so that it contains

name_servers="8.8.8.8 8.8.4.4 2001:4860:4860::8888 2001:4860:4860::8844"
sudo vim /etc/NetworkManager/conf.d/rc-manager.conf
  • Add to the file /etc/NetworkManager/conf.d/rc-manager.conf

[main]              #(warning : this is case sensitive)
rc-manager=resolvconf
sudo resolvconf -u
sudo systemctl restart NetworkManager.service
cat /etc/resolv.conf
  • Verify the file looks like this

#Generated by resolvconf
search home nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
nameserver 192.168.1.254
dig www.google.com
#Verify which server is used (look for line :: SERVER: 8.8.8.8 )
dig -6 www.google.com
#Verify which server is used (look for line :: SERVER 2001:4860:4860::8888 )

Install fonts

Install base ttf fonts

paru -S ttf-dejavu noto-fonts

Install Nerd fonts (for console and coding)

Nerd fonts are well known monospace coding & terminal fonts (JetBrains Mono, FiraCode, Inconsolatas, Droid Mono, etc…​) patched with extra glyphs. See Nerd fonts Github. Installing these fonts is the last thing required to have a fully functional Tide Fish prompt.

Warning
Make sure you use at least version 2.1 as it fixes a bug with monotype fonts

Fonts are packaged individually, and usually follow the pattern ttf-<name of the nerd font>-nerd.

paru -S ttf-jetbrains-mono-nerd
paru -S ttf-cascadia-code-nerd
paru -S ttf-hack-nerd
paru -S ttf-firacode-nerd

Install useful command line tools

Since my zsh and fish config use those tools, installing them will fix the errors about those tools missing.

pacman -S bat eza fd fzf ripgrep btop
  • bat` is a replacement of cat with syntax higlighting, line numbers, etc…​

  • eza is a replacement of ls with better coloring, Git support, etc…​ (eza is a fork of exa which is no longer supported)

  • fd is an enhanced find with a simpler syntax.

  • fzf is a fuzzy search tool, to search with partial names.

  • ripgrep is a grep replacement.

  • btop is a top replacement.

Configure Bat

Configure Bat theme

cd ~/Download
git clone https://github.com/catppuccin/bat.git
cd bat
mkdir -p "$(bat --config-dir)/themes"
cp *.tmTheme "$(bat --config-dir)/themes"
bat cache --build
bat --list-themes

Edit ~/.config/bat/config

--theme="Catppuccin-mocha"

Set bat as the fzf previewer

Edit .zshenv

export FZF_DEFAULT_OPTS="--height 20% --border --preview 'bat --style=numbers --color=always --line-range :500 {}'"

Configure Eza

Install completion files

For Zsh :

mkdir ~/.zfunc
cd ~/.zfunc
curl -L "https://raw.githubusercontent.com/ogham/exa/master/completions/zsh/_exa" -O

For Fish :

mkdir -p ~/.config/fish/completions
cd ~/.config/fish/completions
curl -L "https://raw.githubusercontent.com/ogham/exa/master/completions/fish/exa.fish" -O

Verify .zshrc

alias exa"exa --color --time-style=long-iso"
alias ls="exa"
alias la="ls --long --header --icons"
alias lg="ls --long --header --icons --git"

Verify config.fish

alias exa"exa --color --time-style=long-iso"
alias ls="exa"
alias la="ls --long --header --icons"
alias lg="ls --long --header --icons --git"

Configure fd

Verify .zshrc

alias fd="fd -HI" #(1)
  1. Ensures fd doesn’t filter hidden directories or files

Verify config.fish

alias fd="fd -HI" #(1)
  1. Ensures fd doesn’t filter hidden directories or files

Configure Fish

I use Fish as my main shell for its amazing completions, and build in features (suggestions, etc…​).

Install Fisher plugin manager

curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher

Catppuccin Mocha Theme

fisher install catppuccin/fish
fish_config theme save "Catppuccin Mocha"

Configure fzf

fisher install PatrickF1/fzf.fish

Ensure fish loads fzf key bindings

Create ~/.config/fish/functions/fish_user_key_bindings.fish

function fish_user_key_bindings
    fzf_key_bindings
end

Configure fzf to use bat

Verify ~/.config/fish/config.fish

# fzf
set -Ux FZF_DEFAULT_OPTS "\
--height 20% --border \
--preview 'bat --style=numbers --color=always --line-range :500 {}' \
--color=bg+:#363a4f,bg:#24273a,spinner:#f4dbd6,hl:#ed8796 \
--color=fg:#cad3f5,header:#ed8796,info:#c6a0f6,pointer:#f4dbd6 \
--color=marker:#f4dbd6,fg+:#cad3f5,prompt:#c6a0f6,hl+:#ed8796"

Configure Starship.rs theme

paru -S starship
starship preset nerd-font-symbols -o ~/.config/starship.toml

make fish the default shell

chsh -s /bin/fish

Configure Zsh

I use Zsh when a POSIX-compliant alternative is required, or when I used something that doesn’t support Fish well, due to its amazing completion capabilities, and the superb command line theme Powerlevel10k.

note : configuration is shown for information only. If you use my .zshenv and .zshrc files, all the plugins will be configured already.

Catppuccin Machiato Theme

cd ~/Downloads
git clone https://github.com/catppuccin/zsh-syntax-highlighting.git
cd zsh-syntax-highlighting/themes/
mkdir ~/.zsh
cp -v catppuccin_mocha-zsh-syntax-highlighting.zsh ~/.zsh/

Edit .zshrc

source ~/.zsh/catppuccin_mocha-zsh-syntax-highlighting.zsh

Install Zsh extensions

paru -S zsh-completions zsh-autosuggestions zsh-fast-syntax-highlighting fzf zsh-theme-powerlevel10k

Configure Syntax highlighting

Add to .zshrc

source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
fast-theme free

Configure Fish-like auto-suggestions

Add to .zshrc

source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.plugin.zsh

Configure fzf

Add to .zshrc

#fzf
source /usr/share/fzf/key-bindings.zsh
source /usr/share/fzf/completion.zsh

Add to .zshenv

#Catpuccin Mocha theme
export FZF_DEFAULT_OPTS="--height 20% --border \
     --preview 'bat --style=numbers --color=always --line-range :500 {}' \
     --color=bg+:#363a4f,bg:#24273a,spinner:#f4dbd6,hl:#ed8796 \
     --color=fg:#cad3f5,header:#ed8796,info:#c6a0f6,pointer:#f4dbd6 \
     --color=marker:#f4dbd6,fg+:#cad3f5,prompt:#c6a0f6,hl+:#ed8796"

export MANPAGER="sh -c 'col -bx | bat -l man -p'"

Install Powerlevel 10k

paru -S zsh-theme-powerlevel10k
  • Add source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme to ~/.zshrc

  • Run Powerlevel10k configuration

p10k configure
Clone this wiki locally