Installing Pi Hole Ubuntu 16.04


Pi Hole is an ad blocking service that uses your server as a DNS to filter out known ad sites and can even filter out pornographic and malicious sites.

Update System

Let's update and upgrade our packages.

sudo apt-get update && sudo apt-get upgrade -y

Install Git

We will need to install git in order to download the Pi Hole repository.

sudo apt-get install git

Establish an Internal Static IP

Because your internal IP address can change, we will need to give it a static address.

sudo vim /etc/network/interfaces

If you have any of the following text...

auto eth0
iface eth0 inet dhcp

Replace it 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

The dns-nameservers could change if you decide not to go with Google. Save the file and reboot your server.

sudo reboot

Retrieve Pi Hole

Let's get Pi Hole now.

If you want to install it using curl.

curl -sSL https://install.pi-hole.net | bash

Or install it with Git.

git clone --depth 1 https://github.com/pi-hole/pi-hole.git Pi-hole

cd Pi-hole/automated\ install/

bash basic-install.sh

Follow the setup guide. Choose your DNS provider. Choose wether or not you want a Web Interface (Recommended). Logging should be enabled if you are using a Web Interface. Hit Yes, to add firewall rules to allow TCP port 80 and TCP and UDP port 53. You'll want to take note of your Web Interface Password near the end of the installation as it will ask for it when you try logging into the web interface.

Enable Ports

If you have UFW firewall enabled, you'll need to open the 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

Now you will need to enter into your router's interface and change the DNS server to be the static ip you chose, in my case it was 192.168.1.15.

Access Web Interface

You can open Pi Hole's web interface by using the following url.

http://192.168.1.15/admin

Update Router's DNS

You will want to go to your router's login page and add your Pi Hole as the DNS server. If this step isn't done, the internet request will not be routed through your server. You'll want to look up how to do so in accordance to the model of router you have.

Changing Upstream DNS Providers

If you change your mind after using your first DNS choice, here is a list of other providers and what they offer.

Additional Blacklist Sites

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

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

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

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

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

https://raw.githubusercontent.com/ZeroDot1/CoinBlockerLists/master/hosts