Skip to content

Instantly share code, notes, and snippets.

@silenc3r
Last active July 3, 2023 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silenc3r/86fd2c22046b6206992e624adc578a76 to your computer and use it in GitHub Desktop.
Save silenc3r/86fd2c22046b6206992e624adc578a76 to your computer and use it in GitHub Desktop.
Fedora setup instructions

System Setup

Hostname

hostnamectl set-hostname --static overlord

Swap file

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile

sudo swapon /swapfile

Add this line to /etc/fstab

/swapfile none swap defaults 0 0

Swapiness

sysctl -w vm.swappiness=10
echo 'vm.swappiness=10' | sudo tee /etc/sysctl.d/99-swappiness.conf >/dev/null

Make journal persistent

https://doc.opensuse.org/documentation/leap/reference/html/book-reference/cha-journalctl.html

Disable hibernation

sudo systemctl mask hibernate.target hybrid-sleep.target

Faster don't wait so long on shutdown

in /etc/systemd/system.conf and /etc/systemd/user.conf:

DefaultTimeoutStartSec=15s
DefaultTimeoutStopSec=15s

Disable CPU security mitigations

Without grubby

Add mitigations=off to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub, then

on Fedora run:

sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

on Debian derivatives run:

sudo update-grub

With grubby

sudo grubby --update-kernel=ALL --args="mitigations=off"

Check if it worked

Reboot and run

lscpu

LVM

When creating LVM entities it's good idea to give them discernible names (e.g vg00, lv_data0) so they're easy to spot in output from lvm commands. Naming them just vg, lv, etc. leads to a lot of confusion later.

Create LVM cache

create PV and add it to VG in one command

vgextend MyVolGroup /dev/fastdisk

writethrough is safer in case disk fails, writeback is faster

lvcreate --type cache --cachemode writeback -l 100%FREE -n root_cachepool MyVolGroup/rootvol /dev/fastdisk

Display lvm cache mode

lvs -o+cache_mode MyVolGroup/rootvol

Remove cache

lvconvert --uncache MyVolGroup/rootvol

Hostblock

/etc/hosts.custom

# pattern: 0.0.0.0 website-name.domain

0.0.0.0 chip.pl
0.0.0.0 gazeta.pl
0.0.0.0 hckrnews.com
0.0.0.0 interia.pl
0.0.0.0 komputerswiat.pl
0.0.0.0 lobste.rs
0.0.0.0 news.ycombinator.com
0.0.0.0 old.reddit.com
0.0.0.0 onet.pl
0.0.0.0 pcformat.pl
0.0.0.0 pclab.pl
0.0.0.0 phoronix.com
0.0.0.0 radiozet.pl
0.0.0.0 old.reddit.com
0.0.0.0 rmf24.pl
0.0.0.0 spidersweb.pl
0.0.0.0 tokfm.pl
0.0.0.0 twitch.com
0.0.0.0 twitch.tv
#0.0.0.0 twitter.com
0.0.0.0 wp.pl

0.0.0.0 www.chip.pl
0.0.0.0 www.gazeta.pl
0.0.0.0 www.hckrnews.com
0.0.0.0 www.interia.pl
0.0.0.0 www.komputerswiat.pl
0.0.0.0 www.lobste.rs
0.0.0.0 www.news.ycombinator.com
0.0.0.0 www.old.reddit.com
0.0.0.0 www.onet.pl
0.0.0.0 www.pcformat.pl
0.0.0.0 www.pclab.pl
0.0.0.0 www.phoronix.com
0.0.0.0 www.radiozet.pl
0.0.0.0 www.reddit.com
0.0.0.0 www.rmf24.pl
0.0.0.0 www.spidersweb.pl
0.0.0.0 www.tokfm.pl
0.0.0.0 www.twitch.com
0.0.0.0 www.twitch.tv
#0.0.0.0 www.twitter.com
0.0.0.0 www.wp.pl

/etc/systemd/system/update-hosts-block-file.service

[Unit]
Description=Update custom hosts file
Requires=network-online.target

[Service]
Type=oneshot
Environment=HOSTS_URL='https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling/hosts'
ExecStart=curl -fLo /tmp/hosts $HOSTS_URL
ExecStart=sed -i '/^fe80/d' /tmp/hosts
ExecStart=/bin/bash -c 'cat /etc/hosts.custom >> /tmp/hosts'
ExecStart=mv /tmp/hosts /etc/hosts
ExecStart=restorecon -v /etc/hosts
PrivateTmp=yes

/etc/systemd/system/update-hosts-block-file.timer

[Unit]
Description=Update custom hosts file
Wants=network-online.target

[Timer]
OnCalendar=weekly
AccuracySec=1h
RandomizedDelaySec=2h
Persistent=true

[Install]
WantedBy=timers.target

Enable timer and update hosts

sudo systemctl daemon-reload
sudo systemctl enable update-hosts-block-file.timer
sudo systemctl start update-hosts-block-file.service

systemd-resolved

https://www.ctrl.blog/entry/systemd-resolved.html

Resolver listens at 127.0.0.53 and it may be needed to configure NetworkManager to use this DNS addres.

/etc/systemd/resolved.conf.d/custom.conf

[Resolve]
DNS=194.204.152.34 194.204.159.1 8.8.4.4 1.0.0.1 8.8.8.8 1.1.1.1 9.9.9.9
FallbackDNS= 84.200.69.80 84.200.70.40 2606:4700:4700::1111 2606:4700:4700::1001
Domains=~.
DNSSEC=no
#DNSOverTLS=yes  # slow as fuck
DNSOverTLS=no
Cache=yes
ReadEtcHosts=yes
sudo ln -s -f /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

sudo systemctl enable --now systemd-resolved.service

sudo systemctl restart NetworkManager.service

Package management

RPM Fusion

Add free repo

sudo rpm --import 'https://rpmfusion.org/keys?action=AttachFile&do=get&target=RPM-GPG-KEY-rpmfusion-free-fedora-'$(rpm -E %fedora) && sync && sudo dnf install 'https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-'$(rpm -E %fedora)'.noarch.rpm' -y && sync

Add non-free repo

sudo rpm --import 'https://rpmfusion.org/keys?action=AttachFile&do=get&target=RPM-GPG-KEY-rpmfusion-nonfree-fedora-'$(rpm -E %fedora) && sync && sudo dnf install 'https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-'$(rpm -E %fedora)'.noarch.rpm' -y && sync

Update AppStream metadata

sudo dnf -y groupupdate core

Install codecs

sudo dnf -y groupupdate multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin

sudo dnf -y groupupdate sound-and-video

Add tainted repos for dvd support

sudo dnf -y install rpmfusion-free-release-tainted
#sudo dnf -y install rpmfusion-nonfree-release-tainted  # non-free firmware
sudo dnf -y install libdvdcss

Enable fastest mirror

in /etc/dnf/dnf.conf

fastestmirror=True

Install dnf-utils and rpmconf

rpmconf is used to check for .rpmsave .rpmnew files

sudo dnf install -y rpmconf

dnf-utils provides repoquery

sudo dnf install -y dnf-utils

Remove unneded packages

sudo dnf remove -y \
            rhythmbox 
            cheese \
            gnome-classic-session \
            gnome-shell-extension-background-logo \
            gnome-getting-started-docs \
            ibus-{hangul,kcc,libpinyin,libzhuyin,m17n}
sudo dnf group remove -y \
    guest-desktop-agents \ 
    x86-baremetal-tools

Packman Repo (OpenSUSE)

sudo zypper ar -cfp 90 'https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_$releasever/' packman

sudo zypper dup --from packman --allow-vendor-change

sudo zypper in ffmpeg

PackageKit

Stop automatic updates

sudo systemctl stop packagekit.service
sudo systemctl disable packagekit.service
sudo systemctl stop packagekit-offline-update.service
sudo systemctl disable packagekit-offline-update.service
gsettings set org.gnome.software allow-updates false
gsettings set org.gnome.software download-updates false

Disable Software autostart

mkdir -p ~/.config/autostart
cp /etc/xdg/autostart/gnome-software-service.desktop ~/.config/autostart/
echo "X-GNOME-Autostart-enabled=false" >> ~/.config/autostart/gnome-software-service.desktop

remove gnome software from search providers - it autostarts gnome software

dconf write /org/gnome/desktop/search-providers/disabled "['org.gnome.Software.desktop']"

Disable PackageKit cache

in /etc/PackageKit/PackageKit.conf

KeepCache=false

Make CommandNotFound just warn, not install

in /etc/PackageKit/CommandNotFound.conf

SingleInstall=warn

Make vim default EDITOR

sudo dnf install -y vim-default-editor --allowerasing

Polish locale and autocorrection

Fedora

sudo dnf install -y \
    hunspell-pl \
    autocorr-pl \
    hyphen-pl \
    libreoffice-langpack-pl

OpenSUSE

YaST > Software Management > View > Languages Install pl_PL

Pulseaudio bullshit

In case ~/.esd_auth files is created:

In /etc/pulse/default.pa comment out line

load-module-esound-protocol-unix
rm -f ~/.esd_auth

Early OOM

sudo zypper in earlyoom

sudo systemctl enable --now earlyoom.service

GNOME setup

Adjust some settings

# Make Alt-Tab cycle through applications in current workspace only
dconf write /org/gnome/shell/app-switcher/current-workspace-only true

# Font anialiasing
dconf write /org/gnome/settings-daemon/plugins/xsettings/antialiasing "'rgba'"

# Show weekdays and week numbers
dconf write /org/gnome/desktop/calendar/show-weekdate true
dconf write /org/gnome/desktop/interface/clock-show-weekday true

# Disable mouse acceleration
dconf write /org/gnome/desktop/peripherals/mouse/accel-profile "'flat'"

# Caps is Ctrl
dconf write /org/gnome/desktop/input-sources/xkb-options "['lv3:ralt_switch', 'caps:ctrl_modifier', 'shift:both_capslock_cancel']"

# Suspend after 1 hour on inactivity
dconf write /org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type "'suspend'"

Fix keybindings

# Disable default gnome-shell settings
dconf write /org/gnome/shell/keybindings/switch-to-application-1 "@as []"
dconf write /org/gnome/shell/keybindings/switch-to-application-2 "@as []"
dconf write /org/gnome/shell/keybindings/switch-to-application-3 "@as []"
dconf write /org/gnome/shell/keybindings/switch-to-application-4 "@as []"
dconf write /org/gnome/shell/keybindings/switch-to-application-5 "@as []"
dconf write /org/gnome/shell/keybindings/switch-to-application-6 "@as []"
dconf write /org/gnome/shell/keybindings/switch-to-application-7 "@as []"
dconf write /org/gnome/shell/keybindings/switch-to-application-8 "@as []"
dconf write /org/gnome/shell/keybindings/switch-to-application-9 "@as []"

# Shift+Super+number moves window to given workspace
dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-1 "['<Shift><Super>exclam']"
dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-2 "['<Shift><Super>at']"
dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-3 "['<Shift><Super>numbersign']"
dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-4 "['<Shift><Super>dollar']"
dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-5 "['<Shift><Super>percent']"
dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-6 "['<Shift><Super>asciicircum']"
dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-7 "['<Shift><Super>ampersand']"
dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-8 "['<Shift><Super>asterisk']"
dconf write /org/gnome/desktop/wm/keybindings/move-to-workspace-9 "['<Shift><Super>parenleft']"

# Super+number switches to workspace
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-1 "['<Super>1']"
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-2 "['<Super>2']"
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-3 "['<Super>3']"
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-4 "['<Super>4']"
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-5 "['<Super>5']"
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-6 "['<Super>6']"
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-7 "['<Super>7']"
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-8 "['<Super>8']"
dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-9 "['<Super>9']"

# Super + esc to lock screen
dconf write /org/gnome/settings-daemon/plugins/media-keys/screensaver "['<Super>Escape']"

Install extensions and other

sudo dnf install -y \
    dconf-editor \
    gnome-tweaks \
    tilix-nautilus \
    gnome-shell-extension-caffeine \
    gnome-shell-extension-pomodoro \
    gnome-shell-extension-gsconnect \
    gnome-shell-extension-drive-menu \
    gnome-shell-extension-topicons-plus \
    gnome-shell-extension-auto-move-windows \
    gnome-shell-extension-windowoverlay-icons

Manual install

Configure extensions

# Caffeine
dconf write org/gnome/shell/extensions/caffeine/show-notifications false

# Clipboard Indicator
dconf write /org/gnome/shell/extensions/clipboard-indicator/enable-keybindings false

Remove 'open in terminal'

sudo dnf -y remove gnome-terminal-nautilus

Dotfiles

TODO

Key management

OpenSUSE

Install pam_kwallet

sudo zypper in pam_kwallet

Create file ~/.config/autostart/ssh-add.desktop with content:

[Desktop Entry]
Exec=ssh-add -q
Name=ssh-add
Type=Application

IMPORTANT Wallet must be named 'kdewallet' or it won't get automatically unlocked. Don't create wallet manually. You will be propted to create new wallet on next login.

~/bin

TODO

Programming tools

asdf and direnv

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2
asdf update

Fish

Add the following to ~/.config/fish/config.fish:

source ~/.asdf/asdf.fish

Completions must be configured manually with the following command:

mkdir -p ~/.config/fish/completions; and ln -s ~/.asdf/completions/asdf.fish ~/.config/fish/completions

Bash

Add the following to ~/.bashrc:

. $HOME/.asdf/asdf.sh

Completions must be configured by adding the following to your .bashrc:

. $HOME/.asdf/completions/asdf.bash

Direnv

asdf plugin add direnv
asdf direnv setup --shell fish --version latest

Set global version

asdf list
asdf global direnv <version>

Python

https://jinyuz.dev/2020/07/switching-from-pyenv-rbenv-goenv-and-nvm-to-asdf/

Make sure devel libs are installed

Debian

sudo apt install build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev liblzma-dev

OpenSUSE

sudo zypper in readline-devel libbz2-devel libopenssl-devel libffi-devel zlib-devel sqlite3-devel ncurses-devel tk-devel xz-devel

Install plugin

asdf plugin add python
asdf install python latest:3
# set global python version
asdf list
asdf global python <version>

Update pip

which pip
pip install --upgrade pip

pipx

Make sure correct python version is set

pip install --user pipx
pipx install black
pipx install dikicli
pipx install litecli
pipx install neovim-remote
pipx install poetry
pipx install pre-commit
pipx install tldr
pipx install url2kindle
pipx install yt-dlp
pipx install pytest

nvpy

pipx install nvpy
# go to nvpy repo
pipx runpip nvpy install .

OCaml

asdf plugin-add opam https://github.com/asdf-community/asdf-opam.git
asdf install opam latest
asdf list opam # check version
asdf global opam <version>
opam init  # hook thingy is important
opam install opam-bin
opam-bin install
opam install ocaml-lsp-server ocp-indent ocamlformat utop ppx_jane base dune

~/bin/ocamllsp

#!/bin/bash

eval $(opam env --shell=bash --readonly 2> /dev/null);
ocamllsp

nodejs

asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf install nodejs latest
asdf global nodejs latest

godot

asdf plugin add godot https://github.com/nyrst/asdf-godot.git
asdf install godot latest
asdf global godot latest

shellcheck

asdf plugin add shellcheck https://github.com/luizm/asdf-shellcheck.git
asdf install shellcheck latest
asdf global shellcheck latest

Racket

TODO

ddcutil

Add copr repo and install

sudo dnf copr enable rockowitz/ddcutil 

sudo dnf install -y ddcutil

Create new group and add yourself as member

sudo groupadd --system i2c
sudo usermod -G i2c -a <username>

Install udev rule

sudo cp /usr/share/ddcutil/data/45-ddcutil-i2c.rules /etc/udev/rules.d/

Load kernel module

echo 'i2c-dev' | sudo tee /etc/modules-load.d/i2c-dev.conf >/dev/null
sudo modprobe i2c-dev

cli apps

sudo zypper install ripgrep fd jq fzf moreutils mtr pv vifm speedtest-cli tmux rlwrap gh

sudo zypper in fish

gui apps

Sublime text

Fedora

sudo rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg

sudo dnf config-manager --add-repo https://download.sublimetext.com/rpm/stable/x86_64/sublime-text.repo

sudo dnf -y install sublime-merge sublime-text

OpenSUSE

sudo rpm -v --import https://download.sublimetext.com/sublimehq-rpm-pub.gpg

sudo zypper addrepo -g -f https://download.sublimetext.com/rpm/stable/x86_64/sublime-text.repo

sudo zypper install sublime-text sublime-merge

Appimages

TODO

Firefox

TODO

  • find profile location in about:profiles
cd <profile-dir>

user.js

get scripts

curl -O 'https://raw.githubusercontent.com/arkenfox/user.js/master/updater.sh'
curl -O 'https://raw.githubusercontent.com/arkenfox/user.js/master/prefsCleaner.sh'

chmod +x updater.sh prefsCleaner.sh

get user-overrides.js

curl -O 'https://gist.githubusercontent.com/silenc3r/91ee03f93dc56afa6cd63db8a81d3559/raw/user-overrides.js'

update

./updater.sh -s -u

Transmission torrents

TODO

Fonts (OpenSUSE)

Remove legacy fonts that don't work with subpixel rendering. This fixes Bitstream Charter.

sudo zypper rm xorg-x11-fonts-legacy
sudo zypper in lato-fonts google-merriweather-fonts

IBM Plex

Download OpenType.zip from https://github.com/IBM/plex/releases

Gelasio

https://github.com/SorkinType/Gelasio/tree/main/fonts/otf

Color profiles

Install colord-kde. The in Color Corrections tab install profile system wide.

run

colormgr get-devices
colormgr get-profiles
colormgr device-add-profile <display id> <profile id>
colormgr device-make-profile-default <display id> <profile id>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment