Install Pi-Hole directly onto Raspbian

Pi-hole is a network-level ad blocker and internet tracker blocker that can be installed on a Raspberry Pi or other compatible devices. This guide explains how to setup Pi-Hole on a Raspberry Pi computer running Raspbian OS (not Docker container).

Prepare the Pi OS

Use the Pi Imager if you need to or just run this on an already running Pi server. It does not need much compute but you will want Ethernet in wired format rather than wireless and you need a static IP.

If it’s a new build then run OS upgrades first to get a nice baseline

sudo apt-get update && sudo apt-get upgrade -y

Set a static IP

As your network devices are going to use this Pi as a DNS server you want to set it with a static IP. This is done by either manipulating your network kit to assign a sticky IP to the Pi or via the OS itself.

Set a static IP on Raspbian

Install Pi-Hole

Logged back into the Pi run the following command which will kick off the installation

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

Now you will be asked a series of questions to install and configure Pi Hole.

  • Accept the intro
  • Offer up a dontation at your discretion
  • Confirm you’re running with a static IP
  • Select the NIC
  • Choose to keep the current IP settings or change them if incorrect
  • Learn about IP conflict
  • You need an upstream DNS provider from this device to perform DNS requests. Choose any of the options at your discretion.
  • You can choose to include a black list of sites now or skip it
  • You do want the Admin interface!
  • You do want the web service to run the admin website
  • Choose to enable the query log or not, it’s down to if you’re going to want to analyse the logs or not
  • If you do enable the logs then choose how much data is written to the log

The install will now continue to install and configure Pi Hole.

When complete you will be given two imporant things. Make sure you logon to the admin console and save the password somewhere safe.

The admin console URL

The password to logon

image

References

pi-hole

Last modified July 21, 2024: update (e2ae86c)