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

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 | bash

Or install it with Git.

git clone --depth 1 Pi-hole

cd Pi-hole/automated\ install/


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

Access Web Interface

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

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

Advertising Lists

Tracking & Telemetry Lists

Malicious Lists


Bitcoin Miners