Home server, intermediate: make it survive
Your server works. Now make it last: organised services, data on its own disk, real backups, safe remote access and maintenance that doesn't need you every day.
Last updated November 30, 2026.
Before you start
This guide is the next step after a beginner guide (old PC or Raspberry Pi). You should already have a server that runs Linux, that you can reach over SSH, and that runs Docker with at least one service.
A beginner server works. An intermediate server survives: a dead disk, a bad update, a power cut or you being away from home. That is what we build here:
- Every service organised in its own folder with Docker Compose.
- Your data on its own disk, separate from the system.
- Automatic backups that follow the 3-2-1 rule, and a restore you have actually tested.
- Remote access from your phone without opening ports on your router.
- Updates, monitoring and a few security basics so it keeps running without you.
Step 1: Organise everything with Docker Compose
Long docker run commands are easy to forget. Docker Compose writes the same thing in a small file, so every service can be recreated, moved or backed up in seconds. It comes with the Docker install from the beginner guides.
Use one folder per service and keep all app data in one place, for example /srv/appdata. That single folder is what you will back up later.
sudo mkdir -p /srv/appdata /srv/stacks
sudo chown -R $USER:$USER /srv/appdata /srv/stacks
mkdir -p /srv/stacks/uptime-kuma && cd /srv/stacks/uptime-kuma
nano compose.yamlPaste this example, which runs Uptime Kuma, a monitor that alerts you when something goes down:
services:
uptime-kuma:
image: louislam/uptime-kuma:1
container_name: uptime-kuma
restart: unless-stopped
ports:
- "3001:3001"
volumes:
- /srv/appdata/uptime-kuma:/app/datadocker compose up -d # start it
docker compose logs -f # watch its logs (Ctrl+C to exit)
docker compose down # stop it (your data stays in /srv/appdata)Step 2: Give your data its own disk
If the system disk dies, you reinstall Linux in 20 minutes. If the disk with your photos dies, they are gone. Keeping data on a separate disk lets you rebuild either one without touching the other.
Connect the new disk and find its name and its UUID (a fixed ID that never changes, unlike names such as sdb):
lsblk -fsudo mkfs.ext4 -L data /dev/sdX1
sudo mkdir -p /mnt/data
sudo blkid /dev/sdX1 # copy the UUID it showsMount it automatically at every boot by adding one line to /etc/fstab (sudo nano /etc/fstab). The nofail option lets the server still boot if the disk is missing:
UUID=paste-your-uuid-here /mnt/data ext4 defaults,nofail 0 2sudo mount -a && df -h /mnt/dataIf mount -a shows no error and df lists the disk, you are done. Now point /srv/appdata to it, or simply use /mnt/data/appdata in your compose files.
Step 3: Backups that actually work (3-2-1)
The 3-2-1 rule: keep 3 copies of your data, on 2 different devices, with 1 copy away from home (fire, theft and lightning do not care about RAID). We will use restic, a free backup tool that encrypts, compresses and only copies what changed.
sudo apt install restic -y
sudo mkdir -p /root/.restic && sudo nano /root/.restic/password # write one long random passwordCreate the backup repository on a second disk (a USB disk is fine), and run the first backup:
export RESTIC_PASSWORD_FILE=/root/.restic/password
sudo -E restic -r /mnt/backup/restic init
sudo -E restic -r /mnt/backup/restic backup /srv/appdata /srv/stacksDatabases do not like being copied while they write. The simple safe way: stop the stacks for a minute, back up, start them again. Save this as /root/backup.sh and make it executable with sudo chmod 700 /root/backup.sh:
#!/bin/bash
export RESTIC_PASSWORD_FILE=/root/.restic/password
REPO=/mnt/backup/restic
for d in /srv/stacks/*/; do (cd "$d" && docker compose stop); done
restic -r $REPO backup /srv/appdata /srv/stacks
for d in /srv/stacks/*/; do (cd "$d" && docker compose start); done
restic -r $REPO forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --pruneRun it every night at 3 a.m. with sudo crontab -e and this line:
0 3 * * * /root/backup.sh >> /var/log/backup.log 2>&1For the off-site copy, restic can send the same encrypted backup to a cloud bucket (Backblaze B2, any S3-compatible storage) or to a second machine at a friend's house over SFTP. Because it is encrypted before it leaves, the provider can't read your files.
Test a restore (do not skip this)
sudo -E restic -r /mnt/backup/restic snapshots
sudo -E restic -r /mnt/backup/restic restore latest --target /tmp/restore-test
ls /tmp/restore-test/srv/appdataIf you can see your files there, your backup works. A backup you have never restored is only a hope.
Step 4: Reach it from anywhere, safely
The classic mistake is port forwarding: opening a port on your router so an app is reachable from the internet. Bots scan the whole internet all day, and an admin page with a weak password gets found quickly. There is a better way.
Tailscale creates a private network between your own devices. Your phone talks to your server as if it were at home, encrypted, and nothing is opened on your router. It is free for personal use.
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale upOpen the link it prints, sign in, then install the Tailscale app on your phone and sign in with the same account. Your server gets a private address (starting with 100.) and a name. Try opening http://your-server-name:3001 on your phone with Wi-Fi turned off.
Step 5: Docker and your firewall
Here is a trap that surprises almost everyone: when Docker publishes a port like "3001:3001", it opens it on every network card, and it can skip your firewall rules (ufw) to do it. So "I enabled the firewall" does not protect a published container.
The fix is to publish each port only where you need it. If a service only needs to be reached through Tailscale or a reverse proxy, bind it to one address:
ports:
- "127.0.0.1:3001:3001" # only from the server itself
- "100.x.y.z:3001:3001" # only through Tailscale (your server's 100. address)A firewall is still worth having for the rest of the system. Allow SSH first so you don't lock yourself out:
sudo apt install ufw -y
sudo ufw allow OpenSSH
sudo ufw enableStep 6: Keep it running without you
Updates
- The system: let security updates install themselves with
sudo apt install unattended-upgrades -y(on Debian and Ubuntu it works with its default settings). - The apps: update by hand, once or twice a month, one stack at a time, right after a backup. Read the release notes of big apps first.
cd /srv/stacks/uptime-kuma
docker compose pull && docker compose up -d
docker image prune -f # delete the old imagesMonitoring
- Uptime Kuma (from step 1): add a monitor for each service and connect a notification (Telegram, email, Discord…) so you hear about problems before your family does.
- Disk health: disks usually warn before they die. Install
smartmontoolsand check withsudo smartctl -H /dev/sdX, or run Scrutiny for a dashboard with history. - Watch the backup log:
tail /var/log/backup.logonce a week, or add it to your monitoring.
Power
A sudden power cut is the classic way to corrupt a database. A small UPS (battery backup) keeps the server on during short cuts, and with NUT (Network UPS Tools) it can shut the server down cleanly when the battery gets low.
Step 7: Security basics
- Log in with SSH keys, not passwords. On your main computer run
ssh-keygen -t ed25519, thenssh-copy-id yourname@server. Test that the key works before the next step. - Turn off password logins for SSH: in
/etc/ssh/sshd_configsetPasswordAuthentication no, thensudo systemctl restart ssh. Keep your current session open until you confirm you can still log in from a new one. - Use a different strong password for every app, kept in a password manager. Vaultwarden is a great self-hosted one.
- Only expose what must be public. Everything else lives behind Tailscale.
If something goes wrong
- The server doesn't boot after editing fstab: a typo in
/etc/fstabcan stop the boot. Connect a screen, log in to emergency mode, fix or comment out the line with#, and reboot. This is why we usednofail. - A container restarts in a loop:
docker compose logsin its folder shows why. It is usually a wrong path or a folder permission. - restic says "wrong password" or "repository not found": check that
RESTIC_PASSWORD_FILEis set and that the backup disk is mounted. - Tailscale works at home but not outside: make sure the app on the phone is connected (turn it off and on again), and that you use the server's
100.address or its Tailscale name. - A service is reachable from places it shouldn't be: check its
ports:lines (step 5) withdocker ps.
Next up: the advanced guide, with redundant storage, proper monitoring and how I run my own rack.