PiHole Ad Blocker for Ubuntu 16.04
In this guide, we will be installing PiHole in Ubuntu 16.04.
Pihole is an incredible easy to use and install AdBlocking Server with an easy to use web interface. PiHole works by replacing your current DNS server and uses multiple blocklists to block malicious DNS queries and AD Sites.
The Pi-hole can block ads for all devices on your network once it is set up in your routers config. This setup allows you to save bandwidth while also blocking known malicious sites.It can also block Pornography and unsafe sites by using readily available blocklists from around the web.
Connect to your server as the admin user via SSH.
Update and upgrade your web server
sudo apt-get update && sudo apt-get upgrade -y
Install all the required components
sudo apt-get install git
Set a static IP
sudo nano /etc/network/interfaces
Replace the following text
.... auto eth0 iface eth0 inet dhcp ....
With the following
..... auto eth0 iface eth0 inet static address 192.168.1.15 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 220.127.116.11 18.104.22.168 .....
Save file and reboot
sudo shutdown -r now
Connect to your server as the admin user via SSH to the newly set IP address.
Now the installation begins
git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole cd Pi-hole/automated\ install/ bash basic-install.sh
Enter your account sudo password
Choose your favourite DNS provider. After testing all servers the fastest one for me was OpenDNS.
Choose wether or not you want a Web Interface (Recommended)
Logging should be enabled here if you are using a Web Interface
Hit Yes, to add firewall rules to allow TCP port 80 and TCP and UDP port 53 unfortunatelly these rules are not persistant in Ubuntu bellow you will find the correct way to open the required ports in case you have UFW firewall enabled
Take note of your Web Interface Password
At this point the Web Interface works however if we have UFW firewall enabled here are the instruccions to open the required ports so this persist after reboot.
The following commands will open TCP port 80 for the web interface and TCP and UDP port 53 required by DNS
sudo ufw allow http
sudo ufw allow 53
Finally we need to change your routers DNS configuration to point to your PiHoles IP Address.
These changes differ from router to router.
Here are a couple of good resources to perform this change:
Finally Open your Web Interface at
Log in to the site
Increasing blocked sited by adding blocklists to PiHole
You can add additional blocklist from multiple sources to block even more sites with PiHole as shown below.
Additional Pie Hole Blocklists
hosts files from several well-curated sources like adaway.org, mvps.org, malwaredomainlist.com, someonewhocares.org, and potentially others.
Block advertisment sites and content
Tracking & Telemetry Lists
Block tracking sites and protect your privacy
Blocked malicious sites and make your network safer
Block pornography sites in your network
Simple lists that can help prevent cryptomining in the browser or other applications.
Subscribe to UbuntuBoss: Easy Ubuntu Tutorials | How to for Ubuntu Linux
Get the latest posts delivered right to your inbox