Skip to content
  • Networking and privacy
  • Linux VPS
  • Ubuntu 24.04

Run Pi-hole on a VPS

Pi-hole runs well on a GhostRDP Linux VPS Basic plan with 2 vCPU and 6 GB RAM in Germany or the Netherlands, from €5.99/mo.

Pi-hole blocks ads and trackers at the DNS level for every device that uses it. On a VPS it works anywhere, as long as your devices reach it through your own VPN. This guide keeps DNS closed to the rest of the internet.

  • Blocks ads and trackers

    For phones, laptops and anything else on your VPN.

  • Not an open resolver

    Answers your devices only, never the whole internet.

  • Works anywhere

    At home, on mobile data or on hotel Wi-Fi.

Plans for Pi-hole

Pi-hole needs 512 MB of RAM and 2 GB of disk. Basic is plenty, even with WireGuard on the same server.

  • Linux VPS Basic

    Recommended

    €5.99/mo

    €5.09/mo billed yearly, save €10/year

    • 2 vCPU
    • 6 GB ECC RAM
    • 40 GB NVMe
    • 1 Gbps port
    Order Basic
  • Linux VPS Standard

    €12.99/mo

    €11.04/mo billed yearly, save €23/year

    • 4 vCPU
    • 8 GB ECC RAM
    • 70 GB NVMe
    • 1 Gbps port
    Order Standard

What you need

  • Operating system
    Linux VPS with Ubuntu 24.04
  • VPN first
    Set up WireGuard with our WireGuard guide (tunnel address 10.8.0.1), or use Tailscale
  • Minimum resources
    512 MB RAM and 2 GB of free disk, from Pi-hole's prerequisites

Official site: pi-hole.net

How to install Pi-hole

Written for Ubuntu 24.04 from the official instructions. Run the commands as root and replace YOUR_SERVER_IP with your server's address.

  1. 1

    Connect to your server over SSH

    Use the IP address and root password from your welcome email (the server page has a Copy SSH command button). Windows 10 and 11, macOS and Linux all include an SSH client in the terminal.

    Shell
    ssh root@YOUR_SERVER_IP
  2. 2

    Set up WireGuard first

    Follow our WireGuard VPN guide, so your devices reach the server through the tunnel at 10.8.0.1. Pi-hole will only answer devices on that tunnel.

  3. 3

    Install Pi-hole

    Pi-hole's one-step installer. When it asks for an interface, choose wg0. If you'd rather read the script first, download it with wget and run it with bash.

    Shell
    curl -sSL https://install.pi-hole.net | bash
  4. 4

    Close DNS and the web interface to the internet

    An open DNS server gets abused for attacks on others, so only your VPN may use it. This allows SSH and WireGuard from anywhere, and DNS and the admin page only from the tunnel.

    Shell
    ufw allow 22/tcp
    ufw allow 51820/udp
    ufw allow from 10.8.0.0/24 to any port 53
    ufw allow from 10.8.0.0/24 to any port 80,443 proto tcp
    ufw enable
    ufw status verbose
  5. 5

    Use Pi-hole as your DNS

    Set a password for the admin page, then change DNS = 9.9.9.9 to DNS = 10.8.0.1 in each WireGuard client config and reconnect.

    Shell
    pihole setpassword

After installing

  • Admin page
    With the tunnel on, open http://10.8.0.1/admin on your device.
  • Check it works
    Queries from your devices show up on the dashboard, and blocked domains are counted.
  • Update
    Run pihole -up now and then.

Pi-hole questions

Why not make Pi-hole public?

A DNS server that answers anyone is an open resolver. Attackers use those to flood other networks, and it would get your server shut down. Keeping DNS on the VPN avoids that.

Which plan do I need for Pi-hole?

Basic. Pi-hole and WireGuard together use a small part of it.

Does it work on my phone?

Yes. With the WireGuard app connected, your phone uses Pi-hole on mobile data and on any Wi-Fi.

Can I use Tailscale instead of WireGuard?

Yes. Allow DNS from Tailscale's 100.64.0.0/10 range instead of 10.8.0.0/24 and set the server as your tailnet's DNS server.

Stuck on a step? Our team answers on live chat and in tickets.

More on GhostRDP

Run Pi-hole on your own server.

Online in minutes. Pay with crypto, no ID needed.