keepcalculator

06 Numbers and Powers

Lightweight Services to Self-Host on a Raspberry Pi

Card No. 06·88009 · Updated · Standard formula, shown below

You can run a surprising number of useful, lightweight services on a Raspberry Pi, from ad-blocking DNS to a personal cloud, password manager, and home automation hub. This article lists five proven options that run comfortably on a Raspberry Pi 4 or 5 with 2–4 GB of RAM, and explains what each does, how to set it up, and what to watch out for.

Why a Raspberry Pi Is Ideal for Self-Hosting

The Raspberry Pi is a low-power, low-cost single-board computer originally designed for education. Its small size and ARM-based processor make it perfect for running always-on services that don’t need heavy computing. A typical Pi 4 draws 3–5 watts under load, compared to 50–100 watts for a desktop PC, so it can run 24/7 for pennies a day. The Pi 5, released in 2023, offers roughly double the performance of the Pi 4, but even older models like the Pi 3 can handle basic services.

Because the Pi runs full Linux distributions (Raspberry Pi OS, Ubuntu Server, etc.), you can install almost any software that has an ARM build. Most popular self-hosted apps provide ARM-compatible Docker images, making setup straightforward. The main limitation is memory and storage: a Pi 4 with 2 GB RAM can run several small services, but you should avoid heavy applications like video transcoding or large databases.

1. Pi-hole: Network-Wide Ad Blocking

Pi-hole is a DNS-based ad blocker that filters unwanted domains at the network level. Instead of installing an extension on every device, you point your router’s DNS to the Pi, and it blocks ads and trackers for all devices on your network. It also provides a web dashboard with statistics on queries and blocked domains.

Installation is simple: run the official installer script on Raspberry Pi OS, then enter your router’s DNS settings. The default configuration uses very little RAM (around 100–200 MB) and runs happily on any Pi model. One common issue is that some devices (like smart TVs) use hardcoded DNS servers, bypassing Pi-hole. You can mitigate this by setting up firewall rules, but it’s not always necessary for basic use.

Pi-hole is best for home networks with multiple devices, especially if you want to reduce ads on phones and smart TVs where ad blockers are harder to install. It does not block ads inside YouTube or other apps that use the same domain as the video content, because that would break the service.

2. Home Assistant: Smart Home Hub

Home Assistant is an open-source home automation platform that connects to hundreds of smart devices (lights, switches, sensors, thermostats, cameras) and lets you control them from one interface. It runs as a Python application and can be installed via the official Raspberry Pi image or in Docker. The recommended setup is the Home Assistant Operating System, which includes a supervisor for managing add-ons.

On a Raspberry Pi 4 with 2 GB RAM, Home Assistant runs smoothly for most setups. The web UI is responsive, and automations run locally, so they work even if your internet goes down. The main resource hog is the database that stores history; you can reduce its size by limiting history retention or using the built-in recorder options.

One caveat: adding many camera streams or using voice assistants like the local Whisper add-on can push a Pi 4 to its limits. For those, consider a Pi 5 or an external server. Home Assistant is ideal for anyone who wants to automate their home without relying on cloud services.

3. Vaultwarden: Password Manager

Vaultwarden (formerly bitwarden_rs) is a lightweight implementation of the Bitwarden server API. It lets you host your own password vault, so your credentials are stored on your own hardware. It’s compatible with all official Bitwarden clients (browser extensions, mobile apps, desktop apps), so you get the same features as the cloud service without the subscription.

Vaultwarden is written in Rust and is extremely efficient. A Raspberry Pi 4 can handle it with less than 100 MB RAM. You’ll need to set up HTTPS for secure access from outside your network; the easiest way is to use a reverse proxy like Caddy or Nginx with Let’s Encrypt. The official Bitwarden clients require HTTPS even on local networks, so you’ll need to configure that.

Security is critical: make sure you enable two-factor authentication (2FA) on your account and keep the Pi updated. Vaultwarden stores data in an SQLite database, so regular backups are essential—copy the entire data directory to another device.

4. Jellyfin: Media Streaming

Jellyfin is a free, open-source media server that organizes your movies, TV shows, music, and photos, and streams them to any device. It’s a fork of Emby and is fully self-contained, with no licensing fees or cloud requirements. You can access your library through a web browser, mobile apps, or dedicated clients on smart TVs and game consoles.

On a Raspberry Pi 4, Jellyfin works well for direct playback—that is, when the client can play the file format without transcoding. Most modern clients support H.264 and H.265, so you’ll rarely need transcoding. If you do need to transcode (e.g., to a device that doesn’t support the codec), the Pi 4’s hardware acceleration can handle one or two 1080p streams, but 4K transcoding is not realistic. For best performance, keep your media in formats that your clients support natively.

Storage is the main concern: you’ll need external USB drives or a NAS. The Pi’s USB 3.0 ports can handle multiple drives, but you should ensure they’re powered properly (use an external power supply for 3.5″ drives). Jellyfin also has a metadata scraper that downloads posters and descriptions, which takes some disk space but is worth it.

5. Syncthing: File Synchronization

Syncthing is a peer-to-peer file synchronization tool that keeps folders in sync across multiple devices—like a private Dropbox. There’s no central server; your devices connect directly to each other, so your files never touch a third-party cloud. It works on Windows, macOS, Linux, Android, and iOS (via third-party apps).

On a Raspberry Pi, you can run Syncthing as a service that acts as an always-on node. This is useful if your other devices are not always online; the Pi stores the latest version of your files and syncs with any device when it comes online. Setup is straightforward: install the package, add folders, and share them with other devices by scanning QR codes or entering device IDs.

Syncthing uses a lot of CPU when it scans large file trees, but on a Pi 4 it’s acceptable for typical use. It also supports versioning and conflict resolution, so you won’t lose data if two devices edit the same file. For privacy, you can enable TLS and set up a relay if you’re behind a strict firewall.

How to Choose the Right Services

When deciding which services to run, consider your Pi’s hardware and your own needs. Here are practical factors:

  • RAM: Each service uses a certain amount. Pi-hole (~150 MB), Vaultwarden (~100 MB), Syncthing (~100 MB), Home Assistant (~500 MB), Jellyfin (~300 MB). If you have 2 GB, you can run three or four of these; with 4 GB, you can run all five.
  • Storage: Use a high-quality microSD card (A2 class) or an external SSD for better reliability. SD cards wear out faster with constant writes, so consider moving the OS to a USB SSD.
  • Network: If you plan to access services from outside your home, set up a VPN (like WireGuard) rather than exposing ports directly. This is more secure and easier to manage.
  • Power: Use an official power supply or a quality one that provides 5V/3A (for Pi 4/5). Underpowered adapters can cause crashes or SD card corruption.

Start with one service, get it running, then add more. Use Docker Compose to manage multiple containers with a single config file. This makes updates and rollbacks easier.

Common Problems and How to Avoid Them

Self-hosting on a Pi is fun, but you’ll likely hit a few snags. Here are the most common:

  • SD card corruption: This is the #1 killer of Raspberry Pi installations. Always shut down properly (sudo shutdown -h now) and use a quality card. For heavy services, move to an SSD.
  • IP address changes: Your Pi’s IP may change after a router reboot. Assign a static IP via your router’s DHCP reservation or set it in the Pi’s config.
  • Port conflicts: If you run multiple web services, they all need different ports. Use a reverse proxy like Nginx or Caddy to route traffic by subdomain (e.g., home.example.com, media.example.com).
  • Updates break things: Always read release notes before updating. Back up your configuration and data before major upgrades. Docker makes this easier—you can roll back to a previous image.
  • Overheating: If your Pi is in an enclosed case, it may throttle. Add a heatsink and fan, especially for the Pi 5. Check temperatures with vcgencmd measure_temp.

Frequently Asked Questions

Can a Raspberry Pi 3 run these services?

Yes, but with limitations. Pi-hole, Vaultwarden, and Syncthing run fine on a Pi 3 (1 GB RAM). Home Assistant will work but may be sluggish, and Jellyfin will struggle with anything beyond direct playback. For a smoother experience, use a Pi 4 or 5.

Do I need a static IP for self-hosting?

Not for local use, but if you want to access services remotely, a static IP (or dynamic DNS) is helpful. For security, set up a VPN server on the Pi instead of exposing ports.

Is it safe to expose my self-hosted services to the internet?

It’s risky if you don’t know what you’re doing. Use a VPN (like WireGuard) for remote access, keep software updated, and use strong passwords. Avoid opening ports for services that don’t have built-in security (like Syncthing).

How much does it cost to run a Raspberry Pi 24/7?

Electricity cost is minimal—a Pi 4 uses about 3-5 W, so roughly 2-3 kWh per month. At average electricity prices, that’s less than $1/month. The main cost is the hardware and storage.

Can I run these services on other hardware?

Yes, all of these services run on any Linux server, a NAS, or even a virtual private server. The Pi is just a convenient, low-cost option. If you already have a more powerful machine, you can run them there with better performance.

How do I back up my self-hosted services?

For each service, back up its data directory. Use rsync to a network drive or a USB disk. For Vaultwarden, copy the entire data folder. For Home Assistant, backup the .storage and configuration.yaml files. Test your backups by restoring on a spare Pi.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →