Self-Hosting on a Raspberry Pi: What Works and How to Set It Up
What a Raspberry Pi can realistically self-host, the hardware that makes it reliable, a step-by-step Docker setup and how to reach it securely from anywhere.
· 7 min read
Contents
- What a Raspberry Pi is good at
- Hardware that makes it reliable
- Model and memory
- Storage: avoid running everything from an SD card
- Power and cooling
- Network
- Step 1: Install the operating system
- Step 2: Basic hardening
- Step 3: Install Docker
- Step 4: Deploy your first services
- Step 5: Access it securely from anywhere
- Step 6: Backups and maintenance
- Raspberry Pi vs mini PC vs VPS
- FAQ
- Which Raspberry Pi should I buy for self-hosting?
- Can a Raspberry Pi run 24/7?
- Can I host a public website on a Raspberry Pi?
- Further reading
A Raspberry Pi is one of the cheapest ways to start self-hosting: it is small, silent, uses only a few watts and runs a full Linux system. It is also easy to overload or make unreliable with the wrong setup.
This guide covers what a Pi handles well, the hardware choices that matter for stability, and a clean setup with Docker that you can expand over time.
What a Raspberry Pi is good at
A Raspberry Pi 4 or 5 comfortably runs a handful of lightweight services at once:
| Service type | Examples | Works well? |
|---|---|---|
| Network-wide ad blocking / DNS | Pi-hole, AdGuard Home | ✅ Excellent — the classic Pi project |
| Home automation | Home Assistant | ✅ Very popular on Pi |
| Monitoring | Uptime Kuma, simple dashboards | ✅ |
| VPN / remote access | WireGuard, Tailscale | ✅ |
| Password manager | Vaultwarden | ✅ Lightweight |
| Small web apps and bots | Static sites, Discord/Telegram bots, small APIs | ✅ |
| File sync for one household | Syncthing, small Nextcloud | ⚠️ OK with an SSD, slower with many users |
| Media streaming | Jellyfin | ⚠️ Fine when clients play files directly; weak at video transcoding |
| Heavy databases, CI builds, many containers | Large PostgreSQL, build servers | ❌ Use a mini PC or VPS |
| Local AI models | LLMs | ❌ Only very small models, slowly — see running a local LLM |
Hardware that makes it reliable
Model and memory
A Raspberry Pi 5 (or a Pi 4) with 4 GB or 8 GB of RAM is the sensible choice for self-hosting several services. Older models and the 1–2 GB variants work for a single lightweight service such as Pi-hole.
Storage: avoid running everything from an SD card
SD cards are the most common cause of a "dead" Pi. Constant small writes from logs and databases wear them out, and power cuts can corrupt them. Options, from best to acceptable:
- NVMe SSD via an M.2 HAT on the Pi 5 — fastest and most reliable.
- USB 3 SSD — a big improvement over SD and works on the Pi 4 and 5. Both can boot directly from USB.
- High-endurance SD card from a reputable brand — acceptable for light use, with backups.
Power and cooling
- Use the official power supply for your model. Underpowered supplies cause random crashes and corrupted storage; the Pi 5 in particular needs a 5V/5A USB-C supply for full USB power.
- Add active cooling (the official active cooler or a case with a fan). A throttling Pi slows down under sustained load.
- Optionally, a small UPS or a UPS HAT protects against corruption from power cuts.
Network
Use Ethernet instead of Wi-Fi for anything others depend on, like DNS. Give the Pi a fixed IP via a DHCP reservation in your router, so its address never changes.
Step 1: Install the operating system
- Download Raspberry Pi Imager on your computer.
- Choose your Pi model and Raspberry Pi OS Lite (64-bit) — no desktop, more resources for your services.
- In the customization settings, set a hostname, create a user with a strong password, enable SSH and add your public key (see SSH keys explained).
- Write it to the SD card or SSD, connect the Pi to your network and power it on.
Connect from your computer:
ssh youruser@pi.local # or use the IP address
Update everything:
sudo apt update && sudo apt full-upgrade -y
sudo reboot
Step 2: Basic hardening
Even on a home network, apply the essentials from our VPS security checklist: key-only SSH, a firewall and automatic security updates.
sudo apt install ufw unattended-upgrades -y
sudo ufw allow from 192.168.1.0/24 to any port 22 proto tcp # SSH from your LAN only
sudo ufw enable
sudo dpkg-reconfigure --priority=low unattended-upgrades
Adjust 192.168.1.0/24 to your home network's range.
Step 3: Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
Log out and back in, then check:
docker run --rm hello-world
docker compose version
Check that images support ARM. The Pi uses a 64-bit ARM processor (arm64 / aarch64). Most popular images publish ARM versions, but some do not — look for linux/arm64 on the image's page. An "exec format error" means you pulled an image built only for x86.
Step 4: Deploy your first services
Create a folder for your stack:
mkdir -p ~/stack && cd ~/stack
compose.yaml with an uptime monitor and a password manager as examples:
services:
uptime-kuma:
image: louislam/uptime-kuma:1
restart: unless-stopped
ports:
- "3001:3001"
volumes:
- ./uptime-kuma:/app/data
vaultwarden:
image: vaultwarden/server:latest
restart: unless-stopped
ports:
- "8081:80"
volumes:
- ./vaultwarden:/data
docker compose up -d
Open http://pi.local:3001 for Uptime Kuma. Note that Vaultwarden requires HTTPS for most clients — put it behind a reverse proxy with a certificate before using it (see Caddy as a reverse proxy), or reach it through Tailscale's HTTPS feature.
If you are new to Compose, read Docker Compose for beginners first.
Step 5: Access it securely from anywhere
The safest way to reach home services remotely is not to open ports on your router. Instead, use a mesh VPN:
- Tailscale (built on WireGuard) installs in a minute and connects your phone and laptop to the Pi over an encrypted network, without port forwarding:
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up
- WireGuard directly, if you prefer to run everything yourself (this needs one UDP port forwarded on your router).
Only expose a service publicly if it really needs to be public, and then put it behind a reverse proxy with HTTPS and strong authentication.
Step 6: Backups and maintenance
- Back up the service folders (
~/stack/*) and yourcompose.yamlregularly, ideally to another machine — see how to back up Docker volumes. - Update containers monthly:
docker compose pull && docker compose up -d. - Watch temperature and storage:
vcgencmd measure_temp
df -h
- Reduce SD card writes if you still use one: limit log sizes in Docker by adding to
/etc/docker/daemon.json:
{
"log-driver": "json-file",
"log-opts": { "max-size": "10m", "max-file": "3" }
}
Then restart Docker with sudo systemctl restart docker.
Raspberry Pi vs mini PC vs VPS
| Raspberry Pi | Used mini PC | VPS | |
|---|---|---|---|
| Upfront cost | Low | Low to medium | None |
| Monthly cost | Electricity only (a few watts) | Electricity (more watts) | Subscription |
| Performance | Modest | Much higher (x86, more RAM) | Varies by plan |
| Software compatibility | ARM images only | Everything x86 | Everything |
| Public hosting | Depends on home internet | Depends on home internet | Static IP, data center uptime |
| Data stays at home | ✅ | ✅ | ❌ |
A Pi is ideal for always-on household services. If you outgrow it, a small used mini PC is often the next step; for public websites, a VPS is usually more reliable than a home connection.
FAQ
Which Raspberry Pi should I buy for self-hosting?
A Raspberry Pi 5 with 4 GB or 8 GB of RAM, plus an SSD, the official power supply and active cooling.
Can a Raspberry Pi run 24/7?
Yes. With good power, cooling and an SSD instead of an SD card, Pis run for years continuously.
Can I host a public website on a Raspberry Pi?
You can, but home connections may have dynamic IPs, limited upload speed and provider restrictions. A tunnel service or a cheap VPS is usually more practical for public sites.
Further reading
Keep reading
Docker Compose for Beginners: Self-Host Your First App
Learn Docker Compose step by step: install it, write your first compose.yaml, persist data with volumes, connect services and keep everything updated.
How to Back Up and Restore Docker Volumes the Right Way
Back up Docker named volumes and bind mounts safely, dump databases consistently, automate it with cron, copy backups off-site and test restores.
How to Secure a New Linux VPS: 10 Steps for the First Hour
A practical hardening checklist for a fresh Ubuntu or Debian server: a sudo user, SSH keys, firewall, automatic updates, fail2ban and backups.