Home Server Setup Guide (Part 5): Setting Up Pi-hole with Podman for Ad-Free Browsing

Transform Your Server into an Ad-Blocking Powerhouse with Pi-hole and Podman!

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.

Why Pi-hole? Unlock a New Level of Internet Control

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.

Why Podman Over Docker?

Podman stands out as a daemonless, rootless container engine, making it ideal for home servers. Unlike Docker, which requires a persistent daemon, Podman is lightweight and secure by default perfect for running Pi-hole on your repurposed laptop. Let’s harness that efficiency!

Getting Started: Your Pi-hole Setup with Podman

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.

Configuration File

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

Step-by-Step Installation

Follow these steps to get Pi-hole up and running with Podman:

1. Install Podman (if not already installed)

  • Update your system:
sudo apt update &&
 sudo apt upgrade -y
  • Install Podman:
sudo apt install podman -y

2. Create Directories for Persistence

  • Set up volume directories:
mkdir -p etc-pihole etc-dnsmasq.d

3. Deploy Pi-hole

  • 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.
  1. 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

Managing Pi-hole with Podman

Pi-hole is now live! Here’s how to control it:

  • Start Pi-hole:

    sudo podman start pihole
    
  • Stop Pi-hole:

    sudo podman stop pihole
    
  • Restart (after config changes):

    • Stop and remove the old container:
    sudo podman stop pihole
    sudo podman rm pihole
    
    • Redeploy:
    sudo podman-compose up -d
    

Essential Podman Commands

  • 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

Enhancing Your Ad-Blocking Experience

To maximize Pi-hole’s effectiveness (aiming for a 90+ score on adblock tests), add robust blocklists: