Let’s Install an AdBlocker with PiHole

What’s PiHole?

Why PiHole?

Is PiHole just an AdBlocker?

  • Block Trackers, Spyware and Malware and Viruses
  • Blacklist / Whitelist Domains
  • A DHCP Server

How does it work?

Installing PiHole


  • A system capable of running Linux
  • Debian / Fedora / CentOS / Raspberry Pi OS installed
  • 24/7 Power Supply (if PiHole host used a DHCP Server)
  • Root / Super User Privileges


Update and Upgrade the System packages

sudo apt update && sudo apt upgrade

Install PiHole via Script

  • One line command
  • Clone Repository and run the script
  • Download the installer and run the script
sudo apt install git wget curl
curl -sSL https://install.pi-hole.net | bash

Setting PiHole as our DHCP Server

  • Remove our default router as DHCP Server (Varies by model and manufacturer)
  • Make PiHole default DHCP Server.

Adding Block Lists

Updating PiHole Database

Optional Configuration

sudo nano /etc/lighttpd/lighttpd.conf
server.document-root        = "/var/www/html"
server.error-handler-404 = "/pihole/index.php"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
server.port = 80 # <-- change to 8000
accesslog.filename = "/var/log/lighttpd/access.log"
accesslog.format = "%{%s}t|%V|%r|%s|%b"
sudo systemctl restart lighttpd





Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store