Note: This article is not meant as a tutorial of guide. Instead, it’s quick documentation for my home server setup which may or may not be useful to others. I learned most this stuff from Google, just trying things and making plenty of mistakes. There is nothing preventing you from doing the same.
Naming scheme
I’ve been using kink related names for all my devices and networks since 2010. My network is called The Dungeon, my desktop Dominatrix as it’s the most powerful machine, Slave Pen for my home server, Toybag for my laptop, Strap-on for my tablet, Remote Egg for my phone… It’s just one of those things that stuck around.
Hardware
Part | Description |
OS | Ubuntu 20.04 LTS |
CPU | Intel i5-4590 |
GPU | None, integrated graphics |
MOBO | MSI Z97 Gaming 5 |
RAM | 2x DDR3 8GB Kingston HyperX Savage @ 2400MHz |
PSU | XFX 550w Gold |
Case | Fractal Design Define R5 |
Storage | 240GB Crucial BX500 (boot drive) 4TB WD Red (Media library) 4TB WD Red (Downloads, manual backups, cloud storage) 2TB WD Black (Steam library archive) |
Most of these components are spare parts which were once used in my desktop PC. They clearly aren’t the best suited or most efficient for a home server, but it more than gets the job done. All of the data deemed important is stored on 3 machines, 1 of which is located off-site. The server runs headless 99% of the time, with ssh for all my terminal needs and remote desktop for the rare occasion I need a GUI.
Software
Plex
Media streaming service that allows you to stream to any Plex enabled device or web browser worldwide. You can also add friends to share specific libraries if you want.
sudo snap install plexmediaserver
I’ve got separate libraries set up to keep things organised:
- TV Shows
- Movies
- Cartoons
- Anime
- Anime Movies
Nextcloud
A self-hosted cloud storage with version control. Fork of OwnCloud which started to hide basic features like encrypted traffic and app usage behind a paywall.
sudo snap install nextcloud
While snap makes it easy to install, it will automatically set the data directory in ~/ which is a major issue when you’re using a small boot device. Moving the data directory is directly after setup, but not impossible if you already started to add files. Follow https://help.nextcloud.com/t/howto-change-move-data-directory-after-installation/17170 for step by step explanation on what to do.
Sonarr, radarr, lidarr.
This trio of applications allows for automated downloads for series and anime, movies and music, along with media library management. Each application comes with its own webportal to add content to the list and track which content ahs been downloaded.
Install using Dockstarter along with watchtower to allow for automatic updates of Dockstarter installed applications. Make sure to configure the media directories in Dockstarter too. All files downloaded by Dockstarter will be copied or moved to those folders based on your settings.
Indexers
Nyaa
RSS: Enabled
Auto-search: Enabled
Int search: Enabled
Url: https://nyaa.si/
Note: you can create a new profile and add tags for your favourite release groups.
Sukebei Nyaa for all things ecchi or hentai
RSS: Enabled
Auto-search: Enabled
Int search: Enabled
Url: https://sukebei.nyaa.si/
Note: you can create a new profile and add tags for your favourite release groups.
RARBG
Rss: Enabled
Auto-search: Enabled
Int-search: Enabled
API URL: https://torrentapi.org
Ranked only: disabled
Captcha token: refresh once, and then whenever RAR refuses to load or when using VPN.
Transmission
I use the Transmission web-ui through transmission-daemon. It’s lightweight, plays nice with everything and just works. For added convenience, install Transmission Easy Client in Chrome to add torrents from another PC to the download list.
Other applications that are fun or usefull:
- htop: terminal based task manager and resource viewer.
- thefuck: adds fuck command, which repeats previous terminal command with sudo prefix.
- cmatrix: red pill for your terminal.
- hollywood: fake hacking hollywood style.
- screenfetch: the classic printout of your OS and system.
Samba shares
I’ve enabled read-only shares for the torrent download folder, and, media library. Media files are automatically moved and structured into the media library. Removal of downloaded files can be done through transmission. Everything else is handled through SSH. A third read-write share is present for what I call the vault, manual backups of certain folders. These are mostly work and hobby related files.
MOTD/Terminal welcome screen
Some call it eyecandy, others would call it useless bloat. To me however adding a custom welcome message to the terminal is part of some much needed personalisation to truly make your system yours. I honestly can’t remember where I found the original script and Google fails me.
Add the following to .bashrc
dependencies: catimg, sensors, wget and probably some other stuff I’m missing.
# Get the tempurature from the probe
cur_temperature=$(cat /sys/class/thermal/thermal_zone2/temp)
cur_temperature="$(echo "$cur_temperature / 1000" | bc -l | xargs printf "%1.0f")°C"
# Get your remote IP address using external resource ipinfo.io
remote_ip="$(wget http://ipinfo.io/ip -qO -)"
# Get your local IP address
local_ip="$(ip addr list "enp2s0" | grep "inet " | cut -d' ' -f6| cut -d/ -f1)"
# Get the total machine uptime in specific dynamic format 0 days, 0 hours, 0 minutes
machine_uptime="$(uptime | sed -E 's/^[^,]*up *//; s/, *[[:digit:]]* user.*//; s/min/minutes/; s/([[:digit:]]+):0?([[:digit:]]+)/\1 hours, \2 minutes/')"
# Get your linux distro name
distro_pretty_name="$(grep "PRETTY_NAME" /etc/*release | cut -d "=" -f 2- | sed 's/"//g')"
# Get the brand and model of your CPU
cpu_model_name="$(grep "model name" /proc/cpuinfo | cut -d ' ' -f3- | awk '{print $1,$2,$3,$4,$5,$6,$7,$8,$9,$10}' | head -1)"
# Get memory usage to be displayed
memory_percent="$(free -m | awk '/Mem/ { if($2 ~ /^[1-9]+/) memm=$3/$2*100; else memm=0; printf("%3.1f%%", memm) }')"
memory_free_mb="$(free -t -m | grep "Mem" | awk '{print $4}')"
memory_used_mb="$(free -t -m | grep "Mem" | awk '{print $3}')"
memory_available_mb="$(free -t -m | grep "Mem" | awk '{print $2}')"
# Get SWAP usage to be displayed
swap_percent="$(free -m | awk '/Swap/ { if($2 ~ /^[1-9]+/) swapm=$3/$2*100; else swapm=0; printf("%3.1f%%", swapm) }')"
swap_free_mb="$(free -t -m | grep "Swap" | awk '{print $4}')"
swap_used_mb="$(free -t -m | grep "Swap" | awk '{print $3}')"
swap_available_mb="$(free -t -m | grep "Swap" | awk '{print $2}')"
#Get last login information (user, ip)
last_login_user="$(last -a "$USER" | head -2 | awk 'NR==2{print $3,$4,$5,$6}')"
last_login_ip="$(last -a "$USER" | head -2 | awk 'NR==2{print $10}')"
# Get the 3 load averages
read -r loadavg_one loadavg_five loadavg_fifteen rest < /proc/loadavg
# Get the current usergroup and translate it to something human readable
if [[ "$GROUPZ" == *"sudo"* ]]; then
USERGROUP="Administrator"
elif [[ "$USER" == "root" ]]; then
USERGROUP="Root"
elif [[ "$USER" == "$USER" ]]; then
USERGROUP="Regular User"
else
USERGROUP="$GROUPZ"
fi
# Clear the screen and reset the scrollback
clear
catimg ~/scripts/welcome.png
# Print out all of the information collected using the script
echo -e "${C1} ++++++++++++++++++++++++: ${C3}System Data${C1} :+++++++++++++++++++++++++++
${C1} + ${C3}Hostname ${C1}= ${C4}$(hostname)
${C1} + ${C3}IPv4 Address ${C1}= ${C4}$remote_ip ${C0}($local_ip)
${C1} + ${C3}Uptime ${C1}= ${C4}$machine_uptime
${C1} + ${C3}Time ${C1}= ${C0}$(date)
${C1} + ${C3}CPU Temp ${C1}= ${C0}$cur_temperature
${C1} + ${C3}Load Averages ${C1}= ${C4}${loadavg_one}, ${loadavg_five}, ${loadavg_fifteen} ${C0}(1, 5, 15 min)
${C1} + ${C3}Memory ${C1}= ${C4}$memory_percent ${C0}(${memory_free_mb}MB Free, ${memory_used_mb}MB/${memory_available_mb}MB Used)
${C1} ++++++++++++++++++++++++: ${C3}User Data${C1} :+++++++++++++++++++++++++++++
${C1} + ${C3}Username ${C1}= ${C4}$USER ${C0}($USERGROUP)
${C1} + ${C3}Last Login ${C1}= ${C4}$last_login_user from $last_login_ip
${C1} + ${C3}Sessions ${C1}= ${C4}$(who | grep -c "$USER")
${C1} ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++${CNC}
"
Code language: HTML, XML (xml)