This method installs Pi-hole v6 natively on the operating system — no containers, no virtualization layer. It is best suited for dedicated hardware such as a Raspberry Pi or a bare-metal Ubuntu server where you want Pi-hole to own the network stack directly. The script isDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/damianiglesias/pihole-ubuntu-deploy/llms.txt
Use this file to discover all available pages before exploring further.
deploy.sh version 4.1, authored by Damian Iglesias, and automates every step from dependency installation through static IP assignment.
Installation Steps
Run the deployment script
The script must be executed as root. If the effective user ID is not
0 it prints an error and exits immediately.Network preparation (automatic)
Before touching anything else, the script prepares the host network so Pi-hole can bind to port 53:
- Stops and disables
systemd-resolved - Removes
/etc/resolv.conf - Writes new nameservers:
- Pings
8.8.8.8to verify internet connectivity — exits with a fatal error if the ping fails
Dependency installation (automatic)
Runs
apt-get update then installs all required packages in one shot:Pi-hole core installation
Pulls and runs the official Pi-hole installer:Follow the blue interactive screens that appear. Accept all defaults unless you have a specific reason to change them. The script verifies the
pihole command is available after installation and exits with an error if it is not found.Advanced blocklists (optional)
After the core install you are prompted:If you answer See the Blocklist URLs section below for the exact addresses added.
y, the script injects three curated blocklist URLs directly into Pi-hole’s SQLite database at /etc/pihole/gravity.db using sqlite3, then triggers a gravity update:Web admin password setup
You are prompted to type and confirm a password for the Pi-hole web interface. The loop repeats until both entries match and the password is non-empty:The password is applied with:
Optional add-ons
Each add-on is independently prompted with
[y/n]. You can install any combination:| Prompt | Component | Notes |
|---|---|---|
| Install Unbound? | Recursive DNS resolver | Listens on 127.0.0.1:5335; see Unbound |
| Install PADD dashboard? | Terminal stats display | Optional SSH auto-start via .bashrc; see PADD Dashboard |
| Install DNS Manager tool? | Python DNS Manager | Cloned to /opt/pihole-dns-manager; see DNS Manager |
| Install Log2Ram? | RAM-based log buffer | Reduces disk wear — recommended for SD cards and VMs; see Log2Ram |
Static IP assignment
The script lists all non-loopback network interfaces using:You select the interface you want to pin (e.g. If confirmed, it backs up existing Netplan configs and writes a new one. See Generated Netplan Config below.
enp0s8). The script detects the current IP and default gateway, then asks:Blocklist URLs
When you opt in to advanced blocklists, the following three sources are inserted intogravity.db:
Generated Netplan Config
The static IP step writes/etc/netplan/99-pihole-static.yaml with the following structure, using the detected interface name, current IP address, and current default gateway:
netplan apply is run immediately after writing the file. The file permissions are set to 600.
Final Deployment Report
When all steps complete, the terminal is cleared and a summary banner is printed:Optional Component Docs
Unbound
Recursive DNS resolver running on port 5335. Eliminates reliance on upstream DNS providers.
PADD Dashboard
Terminal-based Pi-hole stats display. Can auto-launch on SSH login.
Python DNS Manager
CLI tool for syncing local DNS entries to Pi-hole via the API.
Log2Ram
Mounts the log directory in RAM to reduce SD card and SSD wear.