Install Pi-hole on Ubuntu Server
Network-Wide Ad Blocking & Privacy • Prepared By Walid Al Habib
Step-by-Step Pi-hole Installation (2025 Updated)
System Requirements
- Ubuntu Server 20.04 / 22.04 / 24.04
- Minimum 512MB RAM (1GB+ recommended)
- Static IP address
- Internet access
1. Update System
sudo apt update && sudo apt upgrade -y
2. Set Static IP (Netplan Example)
sudo nano /etc/netplan/01-netcfg.yaml
Example config:
network:
version: 2
ethernets:
enp0s3:
dhcp4: no
addresses: [192.168.1.100/24]
gateway4: 192.168.1.1
nameservers:
addresses: [1.1.1.1, 8.8.8.8]
sudo netplan apply
3. Install Pi-hole (One Command)
curl -sSL https://install.pi-hole.net | bash
4. Follow the Interactive Installer
- Choose network interface
- Select Upstream DNS → Cloudflare (recommended)
- Keep default blocklists
- Install Web Admin Interface + Web Server
- Save the admin password shown at the end!
5. Access Pi-hole Web Dashboard
http://your-server-ip/admin
6. Point Devices to Pi-hole
- Router → Change DNS to your Pi-hole IP
- Or manually set on individual devices
7. (Optional) Use Pi-hole as DHCP Server
- Disable DHCP on your router
- Enable in Pi-hole → Settings → DHCP
8. Useful Commands
pihole -up # Update Pi-hole pihole -g # Update blocklists pihole restartdns # Restart DNS service pihole status # Check status tail -f /var/log/pihole.log
9. Change Admin Password
pihole -a -p
Enjoy an ad-free, private, and faster internet across your entire network.
Prepared by — Walid Al Habib