/ Ubuntu 16.04.2

How to install PiHole on Ubuntu 16.04

PiHole Ad Blocker for Ubuntu 16.04

Introduction

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.

You can find more info on PiHole here or on their GitHub sites here

Installation

Connect to your server as the admin user via SSH.

ssh [email protected]

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 8.8.8.8 8.8.4.4
.....

Save file and reboot

sudo shutdown -r now

Connect to your server as the admin user via SSH to the newly set IP address.

ssh [email protected]

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

step1

Hit OK

step2

Choose your favourite DNS provider. After testing all servers the fastest one for me was OpenDNS.

step3

step4

step5

Choose wether or not you want a Web Interface (Recommended)

step6

Logging should be enabled here if you are using a Web Interface

step7

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

step8

Take note of your Web Interface Password

step9

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

http://your.server.ip/admin

web

Log in to the site

web2

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.

web3

Additional Pie Hole Blocklists

hosts files from several well-curated sources like adaway.org, mvps.org, malwaredomainlist.com, someonewhocares.org, and potentially others.

Suspicious Lists

https://hosts-file.net/grm.txt
https://reddestdream.github.io/Projects/MinimalHosts/etc/MinimalHostsBlocker/minimalhosts
https://raw.githubusercontent.com/StevenBlack/hosts/master/data/KADhosts/hosts
https://raw.githubusercontent.com/StevenBlack/hosts/master/data/add.Spam/hosts
https://v.firebog.net/hosts/static/w3kbl.txt

Advertising Lists

Block advertisment sites and content
https://adaway.org/hosts.txt
https://v.firebog.net/hosts/AdguardDNS.txt
https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
https://hosts-file.net/ad_servers.txt
https://v.firebog.net/hosts/Easylist.txt
https://raw.githubusercontent.com/StevenBlack/hosts/master/data/SpotifyAds/hosts
https://raw.githubusercontent.com/StevenBlack/hosts/master/data/UncheckyAds/hosts

Tracking & Telemetry Lists

Block tracking sites and protect your privacy
https://v.firebog.net/hosts/Airelle-trc.txt
https://v.firebog.net/hosts/Easyprivacy.txt
https://v.firebog.net/hosts/Prigent-Ads.txt
https://raw.githubusercontent.com/quidsup/notrack/master/trackers.txt
https://raw.githubusercontent.com/StevenBlack/hosts/master/data/add.2o7Net/hosts
https://raw.githubusercontent.com/StevenBlack/hosts/master/data/tyzbit/hosts

Malicious Lists

Blocked malicious sites and make your network safer
https://v.firebog.net/hosts/Airelle-hrsk.txt
https://s3.amazonaws.com/lists.disconnect.me/simple_malvertising.txt
https://mirror1.malwaredomains.com/files/justdomains
https://hosts-file.net/exp.txt
https://hosts-file.net/emd.txt
https://hosts-file.net/psh.txt
https://mirror.cedia.org.ec/malwaredomains/immortal_domains.txt
https://www.malwaredomainlist.com/hostslist/hosts.txt
https://bitbucket.org/ethanr/dns-blacklists/raw/8575c9f96e5b4a1308f2f12394abd86d0927a4a0/bad_lists/Mandiant_APT1_Report_Appendix_D.txt
https://v.firebog.net/hosts/Prigent-Malware.txt
https://v.firebog.net/hosts/Prigent-Phishing.txt
https://raw.githubusercontent.com/quidsup/notrack/master/malicious-sites.txt
https://ransomwaretracker.abuse.ch/downloads/RW_DOMBL.txt
https://v.firebog.net/hosts/Shalla-mal.txt
https://raw.githubusercontent.com/StevenBlack/hosts/master/data/add.Risk/hosts
https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist

Pornography

Block pornography sites in your network
https://github.com/chadmayfield/pihole-blocklists/raw/master/lists/pi_blocklist_porn_all.list
https://raw.githubusercontent.com/chadmayfield/pihole-blocklists/master/lists/pi_blocklist_porn_top1m.list

Bitcoin Miners

Simple lists that can help prevent cryptomining in the browser or other applications.
https://raw.githubusercontent.com/ZeroDot1/CoinBlockerLists/master/hosts

10$ off on me with This Link, if you don't have your own server visit DigitalOcean servers starting at 5$ a month
10$ off on me with

Jaco Toledo

Jaco Toledo

Hi, I am a System Administrator that Lives in Jacksonville Florida and loves to experiment with anything IT, my favorite Linux Distro is Ubuntu I Love its simplicity.

Read More