The Pi-Hole [Link] is nothing but a DNS server with Blacklist that is automatically updated from the internet.
The blacklist will not resolve the addresses (domains) that are known for being a source of advertisement, spam, and phishing.
Pi-Hole does not require much CPU, RAM, or storage and can be installed in any raspberry pi, even the Zero in parallel with many other applications, and will not affect the performance at all.
It offers a web interface where you can add domains do a blacklist or a whitelist. If there is no HTTP/HTTPS server running it can install the Lighttpd.
There are two main installation methods. On the host OS or in a Docker container. We will install it on the host.
su
After entering on the root account chose one of the methods below:
sudo su curl -sSL https://install.pi-hole.net | bash OR git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole cd "Pi-hole/automated install/" sudo bash basic-install.sh
Follow the installation instructions, there is no mystery. End get out of the root account.
At the end will be presented the address to the web GUI and a randomly generated password. Better change it immediately:
sudo pihole admin -p
Access on the browser https://pi-hole-ip-address/admin
Or use the command line to manage and monitor as below.
If you need to reconfigure:
sudo pihole reconfigure
Updating the gravity list issue:
sudo pihole updateGravity
See the log of the resolved and blocked in realtime with:
sudo pihole tail
Updating the Pi-Hole:
sudo pihole updatePihole
BONUS
Consider enabling file system overlay on your raspberry pi to protect the MicroSD card from get corrupted or fail over time.
sudo raspi-config
Navigate Performance Options > Overlay File System > Yes > Yes to enable the write-protect ob both partitions.
Note: it will read the SD card only once on boot and will not retain any data through reboots. It will require disabling the file system overlay before updates or configuration changes then re-enable after manually.