Setting Up a Home Lab Server: Step by Step
A complete step-by-step home lab build: choose hardware, install Debian, harden SSH, set up storage and backups, run containers, and reach it remotely.
By Velloreth
A home lab is a computer you own, running services you chose, on hardware that sits in your home. The failure mode is not technical - it is building something impressive that you never use. So the first step is not hardware.
Pick the job first. Ad-blocking DNS for the household, a notes server you actually open daily, a staging environment for side projects, a media library, a git server. Write down two or three of them. Everything in this guide is in service of running those things reliably.
Step 1: Choose the hardware
| Option | Typical cost | Power | RAM ceiling | Good for |
|---|---|---|---|---|
| Used business mini PC | Low | 10-15 W | 32-64 GB | Almost every home lab |
| Old laptop | Free-ish | 15-25 W | Usually fixed | Has a battery built in |
| Raspberry Pi 5 | Medium | 3-7 W | 16 GB | One or two light services |
| NUC-style mini PC | Medium-high | 10-20 W | 64 GB | Quiet, small, new |
| Old tower server | Cheap, loud | 60 W+ | High | When you need many drives |
A used Dell OptiPlex, Lenovo ThinkCentre, or HP EliteDesk in the micro or tiny form factor is the default answer. They are sold in bulk when companies refresh fleets, they take laptop or desktop DIMMs depending on model, they idle quietly, and parts are everywhere.
Two specs matter more than the CPU:
- RAM: 16 GB minimum, 32 GB if you plan to run several containers. Memory is what self-hosted applications actually run out of.
- Storage: an SSD for the OS, and a separate disk for data. Keeping bulk data off the system disk makes reinstalling the OS a non-event.
Check the disk health before you commit to a used machine:
sudo apt install smartmontools
sudo smartctl -a /dev/sda | head -20
Look at Reallocated_Sector_Ct and Power_On_Hours. A drive with growing reallocated sectors is a drive about to fail - walk away or factor in a replacement.
Step 2: Install the operating system
Debian stable is the right default: boring, well documented, and slow to break. Download the netinst ISO for the current stable release and write it to a USB stick - on Windows, Rufus in DD mode; on Linux or macOS, dd or the Raspberry Pi Imager.
Boot from it. The install is guided:
- Hostname - something you will recognise on the network, like
atlas. - User account - your name plus a strong password. Do not enable the root password; Debian’s installer lets you set root to disabled and use
sudofrom your user. - Partitioning - “Guided - use entire disk”, with all files in one partition for the OS disk. If you have a second disk, leave it unformatted for now and mount it in Step 5.
- Software selection - uncheck “desktop environment” and “web server”. Keep “SSH server” and “standard system utilities”.
- Grub - install to the main disk.
Reboot, log in, and confirm you are on the network:
ip -br a
lo UNKNOWN 127.0.0.1/8 ::1/128
enp1s0 UP 192.168.1.50/24
From your laptop:
ssh youruser@192.168.1.50
Step 3: Baseline before anything else
Do this before installing services. Retrofitting security onto a machine with eight containers running is much harder than doing it on a clean box.
Updates on autopilot:
sudo apt update && sudo apt upgrade -y
sudo apt install -y unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades
Accept the prompt to enable automatic installation of security updates. On Debian the default unattended-upgrades config already covers security pockets.
Firewall:
sudo apt install -y ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
Anywhere on eth0 ALLOW IN OpenSSH
Add ports as you add services - sudo ufw allow 80/tcp, 443/tcp, and so on. If a service only ever talks to containers on the same machine, it needs no host port at all.
SSH with keys only:
# on your laptop, if you do not already have a key
ssh-keygen -t ed25519 -C "laptop"
ssh-copy-id youruser@192.168.1.50
Then on the server, edit /etc/ssh/sshd_config:
PasswordAuthentication no
PermitRootLogin no
AllowUsers youruser
Apply and verify in a second terminal before closing your first one - a locked-out SSH daemon is the classic first mistake:
sudo systemctl restart ssh
In the new terminal, ssh youruser@192.168.1.50 should work with no password prompt. Only close the old session once it does.
Step 4: Give it a stable identity
Your server’s IP will change if you leave it to DHCP, and every hostname hardcoded in a config file will break quietly.
Reserve an address at the router - DHCP reservation, keyed to the machine’s MAC address. It gets the same benefits as a static IP (a fixed address) without the risk of two devices ever claiming the same one.
Verify the MAC first:
cat /sys/class/net/enp1s0/address
Then confirm the reservation took:
ping -c3 atlas.local || ping -c3 192.168.1.50
.local resolution works out of the box on most networks via mDNS. If it does not on yours, use the IP.
Step 5: Storage and backups
Mount the second disk:
lsblk -f
sudo mkfs.ext4 /dev/sdb1
sudo mkdir -p /srv/data
echo '/dev/sdb1 /srv/data ext4 defaults,nofail 0 2' | sudo tee -a /etc/fstab
sudo mount /srv/data
df -h /srv/data
nofail matters: without it, a disk hiccup at boot drops you to an initramfs shell instead of starting the server.
Add a weekly SMART check:
sudo apt install -y smartmontools
(crontab -l 2>/dev/null; echo '0 6 * * 1 /usr/sbin/smartctl -a /dev/sdb | grep -E "Reallocated|Pending"') | crontab -
Backups. Two disks is not a backup - both can fail, and ransomware does not care about your RAID. Plug in a USB drive, give it its own mount point:
lsblk -f
sudo mkfs.ext4 /dev/sdc1
sudo mkdir -p /srv/backup
echo '/dev/sdc1 /srv/backup ext4 defaults,nofail 0 2' | sudo tee -a /etc/fstab
sudo mount /srv/backup
sudo chown $USER /srv/backup
Then use restic:
sudo apt install -y restic
export RESTIC_REPOSITORY=/srv/backup/restic-repo
export RESTIC_PASSWORD="$(openssl rand -base64 24)"
restic init
restic backup /srv/data
restic snapshots
Copy those two values into a password manager before you close the terminal - restic cannot restore without the password, and a repository you cannot open is not a backup. Cron needs them on the machine too, so put a copy in ~/.restic-env readable only by you:
cat > ~/.restic-env <<'EOF'
export RESTIC_REPOSITORY=/srv/backup/restic-repo
export RESTIC_PASSWORD="the-password-you-saved"
EOF
chmod 600 ~/.restic-env
Schedule it:
(crontab -l 2>/dev/null; echo '0 2 * * * . $HOME/.restic-env && restic backup /srv/data && restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --prune') | crontab -
Once a quarter, restore a file into a scratch directory and confirm it opens. A backup job you have never tested is a hypothesis.
Step 6: Run the services
Containers keep the host clean - one apt for Docker, everything else isolated and disposable.
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER
newgrp docker
docker run --rm hello-world
Then one compose.yaml per service under /srv/apps/. An ad-blocking resolver, as a concrete example:
name: adguard
services:
adguard:
image: adguard/adguardhome:latest
restart: unless-stopped
network_mode: host
volumes:
- /srv/data/adguard/work:/opt/adguardhome/work
- /srv/data/adguard/conf:/opt/adguardhome/conf
network_mode: host is deliberate here: a DNS server has to answer on port 53, and published ports with NAT make DNS behave oddly. It is the exception, not the rule - everything else should use explicit ports: mappings.
mkdir -p /srv/apps/adguard && cd /srv/apps/adguard
# paste compose.yaml, then
docker compose up -d
docker compose ps
Finish setup at http://192.168.1.50:3000, then point your router’s DHCP DNS at the server’s IP so every device in the house is covered.
The pattern repeats for each service: a directory under /srv/apps/, a compose.yaml, a health check, docker compose up -d --wait, and a ufw allow if it needs an outside port. Keep them separate - one compose project per service means restarting your media server cannot take down DNS.
Step 7: Reach it from outside the house
Do not port-forward services to the internet. Home connections are usually behind carrier-grade NAT anyway, and exposed admin panels are scanned continuously.
Install Tailscale on the server and on your laptop:
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up
Authenticate in the URL it prints. Now the server has a stable address on your private tailnet - reachable from a hotel wifi, with no open inbound ports and no router configuration.
WireGuard is the self-hosted alternative: more setup, no third-party coordination service, same encryption. For a first home lab, Tailscale is faster to get working and free for the number of devices a household has.
Step 8: Know when it breaks
You need two things: an alert when the box goes down, and a way to see what it is doing.
For downtime, point any uptime monitor at a service you run - even a simple https://status.example.com check on the ad-blocker’s web UI. Being told beats discovering.
For load, three commands cover most of it:
uptime # load average and how long it has been up
docker ps --format 'table {{.Names}}\t{{.Status}}'
df -h / /srv/data # disk creeping up is the slow emergency
Install htop if you want a live view. Beyond that, resist the pull toward a full monitoring stack - Prometheus and Grafana are genuinely useful, and for one server they are also another five services to keep patched.
What to run, honestly
The services that earn their keep in most homes:
- Ad-blocking DNS - used by every device immediately, visible benefit within a day.
- Notes or file sync - you open it daily or you do not run it.
- Staging environment - deploys from Git, lets you break things before production.
- Media server - if you actually watch things you have.
- Automated backups - runs itself, never gets attention otherwise.
The ones that rot: dashboards nobody looks at, a wiki with three pages, a chat server with two users. Start with two services. Add a third when the first two are boring and stable.
The maintenance loop
Weekly, about five minutes:
sudo apt update && sudo apt upgrade -y
for d in /srv/apps/*/; do
(cd "$d" && docker compose pull && docker compose up -d --wait)
done
df -h / /srv/data
Monthly: check df -h, run . ~/.restic-env && restic snapshots to confirm runs are piling up, and read the SMART log for anything growing. Quarterly: restore a backup into a scratch directory and reboot the machine to prove it comes back on its own.
That is the whole discipline. A home lab that gets five minutes a week stays useful for years; one that needs an afternoon a month gets unplugged and becomes a story about a project you started.