VM
Proxmox
DNS
Pi-Hole
Installing Pi-hole on Ubuntu takes just a few minutes using the official one-step automated installer. Before starting, ensure your Ubuntu machine has a static IP address configured via your router's DHCP reservation or Ubuntu's Netplan so devices on your network never lose their DNS connection. [1, 2, 3, 4, 5]
1. Prepare Ubuntu
Open your terminal or connect to your server via SSH. Update your system packages and ensure curl is installed. [1, 2, 3]
bash
sudo apt update && sudo apt upgrade -y
sudo apt install curl -y
Use code with caution.
2. Run the Pi-hole Installer
Execute the official installation script from the Pi-hole Documentation: [1]
bash
curl -sSL https://install.pi-hole.net | bash
Use code with caution.
Alternative Manual Method. If the automated curl command encounters issues, users on Reddit agree that downloading and running the script locally works reliably: [1]
bash
wget -O basic-install.sh https://install.pi-hole.net
sudo bash basic-install.sh
Use code with caution.
3. Follow the Setup Wizard
The terminal will launch an interactive setup screen. Use the Arrow keys, Spacebar, and Enter to configure your settings: [1]
Static IP Confirmation. Confirm that your Ubuntu machine is using a static IP address.
Upstream DNS Provider. Choose a DNS provider (such as Cloudflare, Google, or Quad9) to resolve unblocked web requests.
Blocklists. Accept the default StevenBlack Unified Hosts list to start blocking ads immediately.
Web Admin Interface. Select Yes to install the web dashboard and its required web server modules.
Query Logging & Privacy. Choose your preferred logging level (the default shows all queries and offers full statistics). [1, 2, 3]
When the installation finishes, note the admin webpage URL and the generated login password displayed on the final screen. You can change this password anytime by running sudo pihole setpassword (or pihole -a -p on older versions). [1]
4. Configure Your Firewall (If Enabled)
If you use Ubuntu's UFW firewall, allow traffic on the required DNS and web interface ports as outlined in the Pi My Life Up Guide (https://pimylifeup.com/ubuntu-pi-hole/)
bash
sudo ufw allow 53/tcp
sudo ufw allow 53/udp
sudo ufw allow 80/tcp
Use code with caution.
5. Activate Network-Wide Blocking
Log into your dashboard at http://<YOUR_UBUNTU_IP>/admin to verify Pi-hole is running. To route traffic through it: [1, 2, 3]
Router Method (Recommended). Open your router's admin settings, locate the LAN / DHCP DNS section, and set your Ubuntu server's IP address as the primary DNS server.
Single Device Method. Manually change the DNS server in your computer or phone's network settings to your Ubuntu server's IP address. [1, 2, 3, 4, 5]
Would you like help with:
Setting a static IP address via Netplan on UbuntuDeploying Pi-hole using Docker instead of a bare-metal installConfiguring Unbound alongside Pi-hole for recursive DNS
Certificate Authority