Files
homelab/infrastructure/graduated/arch/workstation.md
2024-07-31 22:36:46 -04:00

13 KiB

Workstation

Framework AMD Notes

ATH12K Wifi Drivers

Install the wireless-regdb to set the regulatory domain to US

pacman -S wireless-regdb

Edit /etc/conf.d/wireless-regdom to set the domain

https://git.codelinaro.org/clo/ath-firmware/ath12k-firmware/-/tree/main

  1. git clone https://git.codelinaro.org/clo/ath-firmware/ath12k-firmware

  2. cd ath12k-firmware

  3. Run the following:

    wget https://github.com/qca/qca-swiss-army-knife/raw/master/tools/scripts/ath12k/ath12k-fw-repo
    chmod 755 ath12k-fw-repo
    sudo ./ath12k-fw-repo --install /lib/firmware
    
  4. sudo cp ath12k/board.bin /lib/firmware/ath12k/WCN7850/hw2.0/

  5. sudo cp ath12k/regdb.bin /lib/firmware/ath12k/WCN7850/hw2.0/

  6. Reboot

Microcode

pacman -S amd-ucode

Edit /boot/loader/entries/.conf and add the following:

title       Arch Linux (Work)
linux       /vmlinuz-linux
initrd      /amd-ucode.img
initrd      /initramfs-linux.img
options     ...

linux-git kernel

https://aur.archlinux.org/packages/linux-git

  1. git clone https://aur.archlinux.org/linux-git.git
  2. cd linux-git
  3. makepkg
  4. sudo pacman -U linux-git... linux-git-headers...

Base Tools

# gvfs and gvfs-dnssd are for webdav support
pacman -S rsync which git iperf3 pwgen dosfstools exfatprogs gvfs gvfs-dnssd

ZSH

pacman -S zsh grml-zsh-config zsh-syntax-highlighting zsh-autosuggestions pkgfile
chsh -s $(which zsh)

cat <<EOF > ~/.zshrc
# Basic settings
autoload bashcompinit && bashcompinit
autoload -U compinit; compinit
zstyle ':completion:*' menu select

# Prompt settings
autoload -Uz promptinit
promptinit
PROMPT_EOL_MARK=

# Syntax Highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh

# Command Not Found Autocomplete
source /usr/share/doc/pkgfile/command-not-found.zsh

### Custom Commands and Aliases ###
EOF

Prompt Themes

See: https://wiki.archlinux.org/title/Zsh#Prompt_themes

Use prompt -l to list prompts

Use prompt -p to see previews

In your .zshrc set the following:

autoload -Uz promptinit
promptinit
prompt grml

Aliases

You can put you aliases in .zshrc with the following format:

alias update='sudo pacman -Syu --noconfirm'

It's recommended that for complicated/multiline aliases you create a folder called ~/.local/scripts where you store each alias. Make sure to back up this folder!

Rollback Pacman Update

This script will grep for all updates performed today and roll them back one by one.

rollback_update.sh

grep -a upgraded /var/log/pacman.log| grep $(date +"%Y-%m-%d") > /tmp/lastupdates.txt
awk '{print $4}' /tmp/lastupdates.txt > /tmp/lines1;awk '{print $5}' /tmp/lastupdates.txt | sed 's/(/-/g' > /tmp/lines2
paste /tmp/lines1 /tmp/lines2 > /tmp/lines
tr -d "[:blank:]" < /tmp/lines > /tmp/packages
cd /var/cache/pacman/pkg/
for i in $(cat /tmp/packages); do sudo pacman --noconfirm -U "$i"*; done

Podman

Install with the following

pacman -S podman buildah cni-plugins slirp4netns podman-dnsname aardvark-dns

Then you can run rootless containers like so:

podman pull docker.io/library/python:3.11
podman run -it python:3.11 bash

podman network create test
podman pod create --network test --publish 8000:8000 test1
podman run -it --pod test1 python:3.11 bash

You can also deploy pods with kubernetes yamls.

podman network create test
podman kube play --network test podman-deploy.yaml --replace

Docker

pacman -Sy docker docker-compose
usermod -aG docker ducoterra

logout, log back in to use docker as non-root user.

You can use btrfs as your storage driver by following these instructions:

https://docs.docker.com/storage/storagedriver/btrfs-driver/

QEMU/KVM

  1. Install virtualization capabilties

    pacman -S qemu-full libvirt iptables-nft dnsmasq virt-manager qemu-desktop swtpm
    usermod -aG libvirt ducoterra
    
  2. Edit /etc/libvirt/libvirtd.conf

    ...
    unix_sock_group = 'libvirt'
    ...
    unix_sock_rw_perms = '0770'
    ...
    
  3. Edit /etc/libvirt/qemu.conf

    # Some examples of valid values are:
    #
    #       user = "qemu"   # A user named "qemu"
    #       user = "+0"     # Super user (uid=0)
    #       user = "100"    # A user named "100" or a user with uid=100
    #
    user = "ducoterra"
    
    # The group for QEMU processes run by the system instance. It can be
    # specified in a similar way to user.
    group = "ducoterra"
    
  4. sudo systemctl enable --now libvirtd

  5. sudo virsh net-autostart default

If you get a blank screen when launching a VM check that you've used the correct bios - either secboot or not secboot. This is the most common problem.

Arch Guests

In order to get drivers for spice you'll need the guest spice drivers:

sudo pacman -S qemu-guest-agent spice-vdagent

Kubernetes

pacman -S kubectl helm

VSCode

For the open source version of code install code:

sudo pacman -S code

For the proprietary version of vscode use the AUR:

https://aur.archlinux.org/packages/visual-studio-code-bin

cd ~/aur
git clone https://aur.archlinux.org/visual-studio-code-bin.git
cd visual-studio-code-bin
makepkg -si

Shell

Edit settings.json

{
    "terminal.integrated.defaultProfile.linux": "zsh",
}

Fonts

Intel One Mono is designed to be easily readable for developers.

https://github.com/intel/intel-one-mono

Download and extract the ttf.zip

mkdir ~/.local/share/fonts
rsync -av /path/to/download/*.ttf ~/.local/share/fonts/

Edit settings.json

{
    "editor.fontFamily": "Intel One Mono",
    "editor.fontLigatures": true,
    "terminal.integrated.fontFamily": "Intel One Mono",
}

Navigation

The best navigation shortcut ever is alt+left and alt+right to move the cursor to it's previous positions.

[
    {
        "key": "alt+left",
        "command": "workbench.action.navigateBack",
        "when": ""
    },
    {
        "key": "alt+right",
        "command": "workbench.action.navigateForward",
        "when": ""
    }
]

Extensions

To save a list of installed extensions run:

code --list-extensions >> vscode_extensions.txt

To install that list of extensions run:

cat vscode_extensions.txt | xargs -L 1 code --install-extension

Wireguard

Wireguard requires linux-headers. If that isn't installed or is misconfigured your vpn likely won't activate.

pacman -S wireguard-tools

Remote Desktop

pacman -S remmina freerdp

Transmission

pacman -S gtk4 transmission-gtk

VLC

pacman -S vlc

Bitwarden

https://bitwarden.com/download/

mv ~/Downloads/Bitwarden*.AppImage ~/Applications/Bitwarden.AppImage
chmod +x ~/Applications/*.AppImage
[Desktop Entry]
Name=Bitwarden
Exec=/home/ducoterra/Applications/Bitwarden.AppImage
Icon=/home/ducoterra/.icons/bitwarden.png
Type=Application

Nextcloud

https://nextcloud.com/install/#install-clients

mv ~/Downloads/Nextcloud*.AppImage ~/Applications/Nextcloud.AppImage
chmod +x ~/Applications/*.AppImage
[Desktop Entry]
Name=Nextcloud
Exec=/home/ducoterra/Applications/Nextcloud.AppImage
Icon=/home/ducoterra/.icons/nextcloud.png
Type=Application

Insomnia

https://github.com/Kong/insomnia/releases/tag/core@2023.5.7

mv ~/Downloads/Insomnia*.AppImage ~/Applications/Insomnia.AppImage
chmod +x ~/Applications/*.AppImage
[Desktop Entry]
Name=Insomnia
Exec=/home/ducoterra/Applications/Insomnia.AppImage
Icon=/home/ducoterra/.icons/insomnia.png
Type=Application

QMK

Initialization

I have a mirror and a fork of the mirror on my personal Gitea. For this strategy you'll need to checkout the fork and add the mirror. This ensures I'll always have an up-to-date mirror of qmk while also giving me a repo to make changes for my personal keyboards.

git clone git@gitea.reeseapps.com:ducoterra/qmk_firmware.git
cd qmk_firmware
git remote add mirror git@gitea.reeseapps.com:mirrors/qmk_firmware.git
git fetch mirror
git rebase mirror/master
pacman -S qmk
qmk setup
sudo cp /home/ducoterra/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/
qmk config user.keyboard=keychron/q11/ansi_encoder
qmk config user.keymap=ducoterra

Development

Every time you start a project you'll want to sync with the mirror.

git fetch mirror
git rebase mirror/master

Commit to master while you're in the fork.

Cura

https://ultimaker.com/software/ultimaker-cura/#links

mv ~/Downloads/*Cura*.AppImage ~/Applications/Cura.AppImage
chmod +x ~/Applications/*.AppImage
[Desktop Entry]
Name=Cura
Exec=/home/ducoterra/Applications/Cura.AppImage
Icon=/home/ducoterra/.icons/cura.png
Type=Application

Creality Print

https://www.creality.com/pages/download-software?spm=..page_11657537.creality_print_1.1

mv ~/Downloads/Creality_Print*.AppImage ~/Applications/Creality_Print.AppImage
chmod +x ~/Applications/*.AppImage
[Desktop Entry]
Name=Creality Print
Exec=/home/ducoterra/Applications/Creality_Print.AppImage
Icon=/home/ducoterra/.icons/creality_print.png
Type=Application

Bambu Studio

https://github.com/bambulab/BambuStudio/releases

I usually grab the Ubuntu appimage. The Fedora one seems to crash when displaying the camera.

# You might need to install webkit2gtk
pacman -S webkit2gtk
mv ~/Downloads/Bambu_Studio_linux*.AppImage ~/Applications/BambuStudio.AppImage
chmod +x ~/Applications/*.AppImage

Note! The file name "BambuStudio.desktop" must match the appimage name "BambuStudio" for the icon to show up.

~/.local/share/applications/BambuStudio.desktop

[Desktop Entry]
Name=Bambu Studio
Exec=/home/ducoterra/Applications/BambuStudio.AppImage
Icon=/home/ducoterra/.icons/bambu_studio.png
Type=Application
update-desktop-database

Orca Slicer

https://github.com/SoftFever/OrcaSlicer

This is an open source fork of Bambu Slicer with more features.

# You might need to install webkit2gtk
pacman -S webkit2gtk
mv ~/Downloads/OrcaSlicer*.AppImage ~/Applications/OrcaSlicer.AppImage
chmod +x ~/Applications/*.AppImage
[Desktop Entry]
Name=Orca Slicer
Exec=/home/ducoterra/Applications/OrcaSlicer.AppImage
Icon=/home/ducoterra/.icons/orca_slicer.png
Type=Application

AWS CLI

https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html

# Install less if you don't have it already
pacman -S less

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

Add the following to your .zshrc:

complete -C '/usr/local/bin/aws_completer' aws

NSlookup

pacman -Syu bind

rpi-imager

https://github.com/raspberrypi/rpi-imager

sudo pacman -S cmake qt5-base

Install rpi-imager

git clone https://github.com/raspberrypi/rpi-imager.git
cd rpi-imager
mkdir -p build
cd build
cmake ../src
make
sudo make install

Upgrade rpi-imager

```bash
cd rpi-imager
git pull
rm -r build
mkdir -p build
cd build
cmake ../src
make
sudo make install

qFlipper

https://flipperzero.one/update

mv ~/Downloads/*qFlipper*.AppImage ~/Applications/qFlipper.AppImage
chmod +x ~/Applications/*.AppImage
[Desktop Entry]
Name=qFlipper
Exec=/home/ducoterra/Applications/qFlipper.AppImage
Icon=/home/ducoterra/.icons/qFlipper.png
Type=Application