From 39a45f459ba25682d7f5db53fb87e5efd297f68f Mon Sep 17 00:00:00 2001 From: DuckDuckWhale Date: Sun, 13 Aug 2023 12:03:51 -0700 Subject: [PATCH] Misc: setup, Helix, bash, packages, apps, font - Setup: reorganize and add server specific setup - Helix: use relative line numbers - Bash: add aliases - Packages: install GStreamer plugins for AV1 preview - Apps: Video Trimmer - Font: Simplified Chinese font priority fix --- auto/bash/bash | 5 +++++ manual/helix/helix | 1 + setup/debian-server-setup.md | 43 ++++++++++++++++++++++++++++++++++++ setup/debian-setup.md | 23 ++++++++++++++----- setup/ubuntu-setup.md | 31 +++++++++++++++++--------- 5 files changed, 88 insertions(+), 15 deletions(-) create mode 100644 setup/debian-server-setup.md diff --git a/auto/bash/bash b/auto/bash/bash index 7b60e0e..508fe75 100755 --- a/auto/bash/bash +++ b/auto/bash/bash @@ -19,6 +19,11 @@ PS1='${debian_chroot:+($debian_chroot)}\[\e[01;38;5;11m\]\u\[\e[00;38;5;208m\]@\ PROMPT_DIRTRIM=3 alias ls='ls --color' +alias bat='batcat' +alias mosh='mosh -o' +alias cargo='cargo auditable' +alias md='pulldown-cmark -TFSLH' +alias auto-av1='nice ab-av1 auto-encode --min-samples 2 --keyint 2s --scd true' # Shows a oneline preview of all files under the folder after changing directory. diff --git a/manual/helix/helix b/manual/helix/helix index 5604c30..f1bae94 100755 --- a/manual/helix/helix +++ b/manual/helix/helix @@ -37,6 +37,7 @@ space.i = ":toggle lsp.display-inlay-hints" space.u = ":update" [editor] +line-number = "relative" auto-pairs = false bufferline = "multiple" rulers = [101] diff --git a/setup/debian-server-setup.md b/setup/debian-server-setup.md new file mode 100644 index 0000000..45ffc47 --- /dev/null +++ b/setup/debian-server-setup.md @@ -0,0 +1,43 @@ +# Debian Server Setup + +Here's the minimum setup I put on my Debian 12 Bookworm servers. + +## System configuration + +``` +# system updates +sudo apt update +sudo apt install -y openssh-server mosh ufw vim +sudo apt upgrade -y +sudo apt autoremove -y +# use Vim +sudo update-alternatives --config editor +# OpenSSH & Mosh & UFW +sudo groupadd --system ssh-users +sudo usermod -aG ssh-users $(whoami) +sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak +sudo wget \ + https://git.duckduckwhale.com/DuckDuckWhale/dotfiles/raw/branch/main/system/sshd/sshd_config \ + -O /etc/ssh/sshd_config +sudo systemctl enable ssh --now +sudo systemctl reload ssh +sudo ufw limit OpenSSH # sudo ufw limit 22/tcp +sudo ufw allow mosh # sudo ufw allow 60001:60999/udp # mosh profile includes unused 60000 & 61000 +sudo ufw enable +# sanity check +systemctl status ssh +sudo ufw status +su - $(whoami) +# apply all settings +sudo reboot +``` + +## User SSH keys + +``` +mkdir -p ~/.ssh +chmod 700 ~/.ssh +# insert your SSH public keys into the file +touch ~/.ssh/authorized_keys +chmod 600 ~/.ssh/authorized_keys +``` diff --git a/setup/debian-setup.md b/setup/debian-setup.md index 481408b..e4bece6 100644 --- a/setup/debian-setup.md +++ b/setup/debian-setup.md @@ -203,22 +203,35 @@ sudo chmod -R 700 /opt/grub - Change `GRUB_TIMEOUT=10` to `GRUB_TIMEOUT=3` - `$ sudo update-grub` -## OpenSSH Server & Mosh +### OpenSSH Server & Mosh & UFW +Installation and configuration: ``` sudo apt install -y openssh-server mosh sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak sudo cp ../system/sshd/sshd_config /etc/ssh/sshd_config sudo groupadd --system ssh-users sudo usermod -aG ssh-users $(whoami) +sudo systemctl enable ssh --now +sudo systemctl reload ssh +``` + +Firewall: +``` +sudo ufw limit OpenSSH # sudo ufw limit 22/tcp +sudo ufw allow mosh # sudo ufw allow 60001:60999/udp # mosh profile includes unused 60000 & 61000 +sudo ufw show added +# check before you enable +sudo ufw enable +``` + +Per user: +``` mkdir -p ~/.ssh chmod 700 ~/.ssh +# insert your SSH public keys into this file touch ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys -# insert your SSH public keys into the file -sudo ufw limit 22/tcp -sudo ufw allow 60001:60999/udp -sudo systemctl restart ssh ``` ## See logs as admin diff --git a/setup/ubuntu-setup.md b/setup/ubuntu-setup.md index 52bb2c7..b7caa4f 100644 --- a/setup/ubuntu-setup.md +++ b/setup/ubuntu-setup.md @@ -13,7 +13,7 @@ Here's my personal Ubuntu 23.04 setup. (Make sure to use Wayland on Nvidia!) - `sudo apt install arp-scan asciinema bookworm foliate gimp gnome-firmware gnome-games gnome-nettool gnome-packagekit gnome-passwordsafe gnome-shell-pomodoro gnome-usage gthumb heif-gdk-pixbuf heif-thumbnailer mkvtoolnix-gui openjdk-17-jdk pulseeffectsqpdf ranger - syncplay virtualbox-qt vlc audacity f3 prusa-slicer cmake` + syncplay virtualbox-qt vlc audacity f3 prusa-slicer cmake gstreamer1.0-plugins-bad` - Remove all snaps: - ``` # if this command fails, do the following then try again: @@ -93,6 +93,8 @@ Here's my personal Ubuntu 23.04 setup. (Make sure to use Wayland on Nvidia!) - `flatpak install flathub com.obsproject.Studio` - Background removal plugin: - `flatpak install com.obsproject.Studio.Plugin.BackgroundRemoval` +- Video Trimmer + - `flatpak install flathub org.gnome.gitlab.YaLTeR.VideoTrimmer` ## Optional Apps @@ -158,11 +160,7 @@ Here's my personal Ubuntu 23.04 setup. (Make sure to use Wayland on Nvidia!) echo '/swapfile none swap defaults 0 0' | sudo tee -a /etc/fstab > /dev/null ``` -### UFW - -`$ sudo ufw enable` - -### OpenSSH Server & Mosh +### OpenSSH Server & Mosh & UFW Installation and configuration: ``` @@ -171,14 +169,17 @@ sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak sudo cp ../system/sshd/sshd_config /etc/ssh/sshd_config sudo groupadd --system ssh-users sudo usermod -aG ssh-users $(whoami) -sudo systemctl enable sshd --now -sudo systemctl reload sshd +sudo systemctl enable ssh --now +sudo systemctl reload ssh ``` Firewall: ``` -sudo ufw limit OpenSSH -sudo ufw allow 60001:60999/udp +sudo ufw limit OpenSSH # sudo ufw limit 22/tcp +sudo ufw allow mosh # sudo ufw allow 60001:60999/udp # mosh profile includes unused 60000 & 61000 +sudo ufw show added +# check before you enable +sudo ufw enable ``` Per user: @@ -198,6 +199,16 @@ See the `system` folder and run each script as they apply to your installation. `sudo usermod -aG adm $(whoami)` +### Simplified Chinese Font Priority Fix + +Move SC to the top by: + +``` +$ sudoedit $(realpath /etc/fonts/conf.d/64-language-selector-prefer.conf) +``` + +Source: + ## Legacy ### For old Ubuntu versions