Home Server Setup Guide (Part 5): Setting Up Pi-hole with Podman for Ad-Free Browsing
Ready to banish ads and trackers from every device on your network? In this guide, I’ll walk you through setting up Pi-hole a powerful DNS-based ad blocker using Podman, a lightweight, daemonless container engine, on your home server. Say goodbye to intrusive pop-ups and hello to a cleaner, faster browsing experience all while keeping your setup secure and efficient. Let’s dive in!
In Part 4, we explored self-hosting passwords with Vaultwarden and Tailscale. Now, let’s enhance your server’s privacy and performance with Pi-hole, perfectly paired with Podman for a lean setup.Tired of ads slowing down your browsing or trackers invading your privacy? Pi-hole is your solution a network-wide ad blocker that works at the DNS level, filtering out unwanted traffic before it even reaches your devices. Here’s why it’s a game-changer:
- Privacy Boost: Pi-hole prevents your devices from phoning home to ad and tracker servers, keeping your data yours.
- Universal Ad Blocking: Block ads across all devices phones, laptops, smart TVs without installing extra software.
- Efficiency Gains: Reduce bandwidth waste by blocking malicious and unnecessary domains at the source.
Below is a step-by-step configuration to deploy Pi-hole using Podman. We’ll use a docker-compose.yml style file (compatible with Podman) to define our setup, tailored for your Tailscale network IP.Save this as podman-compose.yml in your project directory:
version: "3.8"
services:
pihole:
container_name: pihole
image: docker.io/pihole/pihole:latest
hostname: pihole
ports:
- "53:53/tcp" # DNS over TCP
- "53:53/udp" # DNS over UDP
- "0.0.0.0:80:80/tcp" # Web Admin Panel (Tailscale IP)
- "443:443/tcp" # Optional: HTTPS
environment:
TZ: Asia/Kolkata
WEBPASSWORD: # set admin dashboard password
PIHOLE_DNS_: 1.1.1.1;8.8.8.8 # Upstream DNS (Cloudflare, Google)
ServerIP: # Tailscale IP
volumes:
- ./etc-pihole:/etc/pihole
- ./etc-dnsmasq.d:/etc/dnsmasq.d
cap_add:
- NET_ADMIN
restart: unless-stopped
Follow these steps to get Pi-hole up and running with Podman:
- Update your system:
sudo apt update &&
sudo apt upgrade -y
- Install Podman:
sudo apt install podman -y
- Set up volume directories:
mkdir -p etc-pihole etc-dnsmasq.d
- Use podman-compose (install it with sudo apt install podman-compose if needed):
sudo podman-compose up -d
- This starts the pihole container in detached mode within a new pod.
- Verify the Setup
- Check pod status:
sudo podman pod ps
- View logs to ensure Pi-hole is running:
sudo podman logs -f pihole
- Access the web interface at http://Tailscale IP/admin
Pi-hole is now live! Here’s how to control it:
sudo podman start pihole
sudo podman stop pihole
- Stop and remove the old container:
sudo podman stop pihole sudo podman rm pihole
- Redeploy:
sudo podman-compose up -d
- Help: podman - -help
- Version: podman - -version
- List All Containers: sudo podman ps - -all
- List Images: podman images
- List Networks: podman network ls
- Disk Usage: podman system df
To maximize Pi-hole’s effectiveness (aiming for a 90+ score on adblock tests), add robust blocklists:
Go to Adlists.
adding each URL with description (optional) click on Add button:
Tools > Update Gravity.
Test your setup at CanYouBlockIt.com or TurtuleCute and tweak blocklists as needed!