Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

Latest commit

 

History

History
231 lines (197 loc) · 10.1 KB

Arch_Linux_post-installation_configuration.md

File metadata and controls

231 lines (197 loc) · 10.1 KB

Arch Linux Post-installation configurations

  • Disable bell sound

    To disable bell sound on tab-completion, uncomment the line set bell-style none in /etc/inputrc. Edit /etc/vimrc add line set belloff=all after runtime! archlinux.vim, to disable bell sound in vim. Then relogin to take effect. Add line export LESS="$LESS -Q" to the end of /etc/profile also disable the bell sound in less.

  • Default editor

    Add line export EDITOR=/usr/bin/vim to the end of /etc/profile to set vim as default editor.

  • Add new admin user tux,

    # useradd -m -G wheel tux
    # passwd tux
    

    Edit sudoers file with visudo command. Uncomment %wheel ALL=(ALL) ALL allow members in wheel group gain sudo access, or %wheel ALL=(ALL) NOPASSWD: ALL execute any command without password (insecure!).

  • Enable parallel download for pacman

    Uncomment line ParallelDownloads in /etc/pacman.conf.

  • Install reflector to select the most up-to-date mirrors based on country. Edit configuration file /etc/xdg/reflector/reflector.conf

    --save /etc/pacman.d/mirrorlist
    --country us
    --protocol https
    --latest 5
    --sort age
    

    and enable reflector.timer to update mirrorlist weekly.

  • Install AUR helper paru. First install base-devel package group, then

    mkdir -p ~/.cache/paru
    cd ~/.cache/paru
    git clone https://aur.archlinux.org/paru.git
    cd paru
    makepkg -si
    
  • Install pacman-contrib package, then enable paccache.timer to delete unused pacman cache weekly.

  • Enable fstrim.timer provided by util-linux package for Periodic SSD TRIM.

  • To setup btrfs snapshot and rollback solution, install snapper and cronie package, then follow this guide.

    # umount /.snapshots
    # rm -r /.snapshots
    # snapper -c root create-config /
    # btrfs subvolume delete /.snapshots
    # mkdir /.snapshots
    

    The btrfs subvolumes layout in the Arch Linux installation note already follows this suggested guide layout, so the mount entry already in fstab.

    # mount -a
    # chmod -R 750 /.snapshots
    

    Also create new config for home

    # snapper -c home create-config /home
    

    Edit snapshots limit for both root and home in config files /etc/snapper/configs/rootand /etc/snapper/configs/home.

    NUMBER_MIN_AGE="1800"
    NUMBER_LIMIT="10"
    NUMBER_LIMIT_IMPORTANT="10"
    
    TIMELINE_MIN_AGE="1800"
    TIMELINE_LIMIT_HOURLY="5"
    TIMELINE_LIMIT_DAILY="7"
    TIMELINE_LIMIT_WEEKLY="0"
    TIMELINE_LIMIT_MONTHLY="0"
    TIMELINE_LIMIT_YEARLY="0"
    

    To restore to previous state, follow this guide.

  • Automatically creating snapshots upon a pacman transaction

    Install rsync and snap-pac package, then create pacman hook /etc/pacman.d/hooks/50-bootbackup.hook to backup /boot partition

    [Trigger]
    Operation = Upgrade
    Operation = Install
    Operation = Remove
    Type = Path
    Target = usr/lib/modules/*/vmlinuz
    
    [Action]
    Depends = rsync
    Description = Backing up /boot...
    When = PostTransaction
    Exec = /usr/bin/rsync -a --delete /boot /.bootbackup
    
  • dotfiles restore, based on this guide

    • Login as user tux.

    • clone git-directory

      $ git clone --bare <dotfiles-repo-url> $HOME/.dotfiles
      $ alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
      
    • checkout. Because there may be some files like .bashrc or .gitignore in the home directory, first remove (since this is fresh installed system, we simply delete them) these conflicted files then checkout.

      $ dotfiles checkout 2>&1 | egrep "\s+\." | awk {'print $1'} | xargs -I{} rm {}
      $ dotfiles checkout
      
    • Let git status ignore untracked file

      $ dotfiles config --local status.showUntrackedFiles no
      
    • Or you can put all these command in a single script like this, then

      cd ~
      curl -O https://raw.githubusercontent.com/Bai-Chiang/Linux_tinkering_notes/main/restore_dotfiles.sh
      bash restore_dotfiles.sh
      
    • After setting up the desktop environment and ssh key (see below), follow this guide copy public key to GitHub via web interface. Then change the remove url in ~/.dotfiles/config

      ...
      [remote "origin"]
          url = [email protected]:Bai-Chiang/dotfiles.git
      ...
      

      Then you can push to github repository using

      dotfiles push
      

      You may need extra setup for the first time, follow the hints/suggestions.

  • SSH key

    install openssh package.

    Generate new key pair

    $ ssh-keygen -t ed25519
    

    to copy public key to remote server with ssh port 2222

    ssh-copy-id -i ~/.ssh/id_ed25519.pub -p 2222 [email protected]
    
  • Wifi set up, use iwd or wpa_supplicant (I can't connect to MSCHAPv2 network with iwd, but it works with wpa_supplicant.) Install iwd and enable iwd.service. Check whether wifi is block using command rfkill list. To unblock all wifi/bluetooth use rfkill unblock all, and reboot. Login as admin user tux.

    Connect wifi with an interactive prompt with command iwctl, follow this to connect to wifi. eduroam setup follow this guide.

  • GUI

    • Install driver

    • Install desktop environment/window manager

    • set up XDG user directories by installing xdg-user-dirs then run xdg-user-dirs-update.

    • Install xdg-utils, read this to set up default application.

    • Install extra fonts (like ttf-dejavu), CJK fonts (noto-fonts-cjk), Emoji and Kaomoji, and ttf-font-awesome.

    • PipeWire and pavucontrol

    • Flatpak

      Add flatpak repo

      flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
      

      To automatically update flatpak applications everyday, create this service file ~/.config/systemd/user/flatpak-update.service

      [Unit]
      Description=Update flatpak
      StartLimitIntervalSec=3h
      StartLimitBurst=5
      OnFailure=failure-notification@%n
      
      [Service]
      Type=oneshot
      ExecStart=/usr/bin/flatpak update --assumeyes
      Restart=on-failure
      RestartSec=30min
      
      

      It try to update all flatpak packages, if failed it will retry at most 5 times every 30min. If this service failed it will send a notification through another systemd service ~/.config/systemd/user/[email protected]

      [Unit]
      Description=Send a notification about a failed systemd unit
      
      [Service]
      Type=simple
      ExecStart=/usr/bin/notify-send "service %i failed"
      

      It send a desktop notification (needs libnotify package and a notification server. To automate update every day crate a timer file ~/.config/systemd/user/flatpak-update.timer

      [Unit]
      Description=Update flatpak applications on boot
      
      [Timer]
      OnCalendar=daily
      Persistent=true
      
      [Install]
      WantedBy=timers.target
      

      Then enable timer

      $ systemctl --user daemon-reload
      $ systemctl --user enable --now flatpak-update.timer
      
    • Theming

      When using window manager, there is no theming engine, and all GUI applications launch as default theme. I don't need all applications have consistant theming, but I do want them using dark theme instead of default light theme. For GTK applications add GTK_THEME=Adwaita:dark to environment variable, also create ~/.config/settings.ini then follow this guide set up a basic configuration. For Qt application using Adwaita-dark theme feels odd, I prefer using Breeze dark theme, but there is no easy way to specify the theme. So I copied ~/.config/kdeglobals from another machine with Breeze-dark theme, then set QT_QPA_PLATFORMTHEME=kde. The config files settings.ini and kdeglobals could be backup using this method, so you only need to set up once.