Install Pi-hole on Ubuntu
Prepared By Walid Al Habib
Step-by-Step Pi-hole Installation on Ubuntu Server (2025)
System Requirements
- Ubuntu Server 20.04/22.04 or newer (VirtualBox, Raspberry Pi, bare metal)
- At least 512MB RAM (1GB recommended)
- 2GB disk space
- Static IP address configured
- Internet connection
- Sudo privileges
1. Update the system
sudo apt update && sudo apt upgrade -y
2. Set Static IP (if not already)
sudo nano /etc/netplan/01-netcfg.yaml
Example configuration:
network: version: 2 ethernets: enp0s3: dhcp4: no addresses: [your.ip/24] gateway4: your.gateway nameservers: addresses: [1.1.1.1, 8.8.8.8]
sudo netplan apply
3. Install Pi-hole
curl -sSL https://install.pi-hole.net | bash
4. Configure Pi-hole via Wizard
- Select interface
- Choose upstream DNS (Cloudflare recommended)
- Accept default blocklists
- Enable logging (as needed)
- Note down the password
5. Access Web Interface
http://your.ip/admin
6. Set Router DNS to Pi-hole IP
Login to router → Set DNS Server to Pi-Hole server IP
7. (Optional) Enable Pi-hole DHCP
- Disable DHCP on router
- Enable Pi-hole DHCP in Settings → DHCP
8. Update and Maintain
pihole -g # Update blocklists pihole -up # Update Pi-hole software
9. Change Web Admin Password
pihole -a -p
Use this command to set or reset the Pi-hole admin interface password.
Common Pi-hole Usage
- Monitor blocked domains and client activity in the web UI
- Whitelist or blacklist domains via the dashboard
- Temporarily disable Pi-hole using
pihole disable
- Check system status using
pihole status
- View logs:
tail -f /var/log/pihole.log
Prepared by - Walid Al Habib