How to install Pi-hole on Raspberry Pi 4 with Ubuntu server


Hardware used:

  • Rapberry Pi 4, 2GB
  • MicroSD card, 16 GB

Write an image to the microSD card

I’m using Raspberry Pi Imager and the OS I’ve chosen is Ubuntu Server 20.10 64 bit for ARM.

Insert microSD card, connect Raspberry Pi to your network, SSH

After plugging Raspberry Pi into my local network, it will receive a dynamic IP fom my DHCP server. I will find it by using nmap to scan my network. I’m looking for a PC with only SSH port open:

$ nmap  
Starting Nmap 7.80 ( ) at 2020-11-08 14:08 CET
Nmap scan report for
Host is up (0.00035s latency).
Not shown: 999 closed ports
22/tcp open  ssh

Now connect to RaspberryPI and go through the initial setup. The default user and password is ubuntu/ubuntu - you will be required to change it.

$ ssh ubuntu@                                        
The authenticity of host ' (' can't be established.
ECDSA key fingerprint is SHA256:b2CSqjpH1ZE4IkxntnihASzpxZQ1Hne3VUJoLWNyQ0w.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '' (ECDSA) to the list of known hosts.
ubuntu@'s password: 
You are required to change your password immediately (administrator enforced)

Install pi-hole

Following pi-hole documentation install it. Follow the installer.

curl -sSL | bash

Note the password given at the end of the process, ie:

 Your Admin Webpage login password is H7uEWl7- 


sudo reboot

Login to web interface, configure

Login to web interface using static IP assigned during the installation.

Go to group management -> Adlist and (optionally) change the default list of hosts - from into another one, if you want to filter more:

Then rebuild the database under Tools -> Update Gravity

Set up your local router

Setup your router (DHCP server) to point to the static IP of your pi-hole as a DNS server.