How to Install Pi-hole on a Raspberry Pi

These instructions will explain how to install Pi-hole on a Raspberry Pi. 

How to Install Pi-hole on a Raspberry Pi - Instructions

I have this configured on a Raspberry Pi Zero W and it runs perfectly!

Before we get started, ensure that you can SSH into your Raspberry Pi with a valid Raspberry Pi operating system. If you aren’t sure how, please follow these instructions

pi-hole raspberry pi

There are two main ways to install Pi-hole: an automated installer or by downloading the installer and running the application. I will include both sets of instructions, but we will be utilizing the automated installer in this tutorial.

1. The automated installer requires root privileges. Gain root access by typing this command:

sudo su

2. Run one of the two command(s) to install Pi-hole:

Method 1 (Automated Installer)

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

Method 2 (Download and Execute)

wget -O basic-install.sh https://install.pi-hole.net
sudo bash basic-install.sh

how to install pi-hole on a raspberry pi

3. During the installation, Pi-hole will ask you to configure multiple different settings. The first step is to configure your upstream DNS provider. For this tutorial, I will use OpenDNS, but this step is entirely user specific and can be tailored to your wants/needs.

pi-hole raspberry pi

4. Pi-hole will prompt you with four lists that you can subscribe to that will automatically block ads. Since ad blocking is Pi-hole’s main attraction, it is suggested that you subscribe to all the default lists. However, if you’d rather not use these lists, you can add or remove them after Pi-hole has been installed.

pi-hole raspberry pi

5. The next step will ask you if you’d like to block ads on IPv4, IPv6, or both. Generally, you will always select IPv4 but IPv6 blocking is personal preference.

pi-hole raspberry pi

6. The following screen will show you what your static IP is currently set as. Your Raspberry Pie was either configured with a static IP address (if you did this prior to starting the tutorial) or was given a dynamic IP address from DHCP. At this step, you can set this address to be your static IP address. If you aren’t happy with the selection, press No. If you would like to use the IP address shown, press yes.

pi-hole raspberry pi

NOTE: There are no guarantees that your router will not try and hand out this IP address to a different device via DHCP. Generally, you should try and go with an IP address higher than X.X.X.100 as DHCP has a lower chance of handing this address out. A better option is to set a static IP address in your router’s configuration for your Raspberry Pi. Also, keep in mind that this will be the IP address you will use as your DNS server in future steps!

pi-hole raspberry pi

7. You will now be asked to install the web admin portal. I highly recommend this as the web interface is incredibly user friendly, but you have the option of managing everything through the terminal if you’d like. 

pi-hole raspberry pi

8. You will then be asked to install the web portal – keep that on and proceed.

Pihole10

9. The next step will ask you if you’d like to log queries. It’s a good idea to keep them on for potential troubleshooting but this setting is personal preference.

Pihole11

10. After setting your log preferences, you can then determine the level of detail you’d like for your domain searches. This is the final step in the configuration process. After this is set, the application will install.

Pihole12

11. The Pi-hole application will now be installed. The final step is to change the default Pi-hole application password and configure the application. Run this command to change your password:

pihole -a -p [YOUR PASSWORD]

12. Rebooting is not necessary, but I normally reboot the Raspberry Pi and then connect to the admin page at http://pi.hole/admin or http://[IP_ADDRESS]/admin

Pihole13

13. Pi-hole is now successfully installed. It is now necessary for you to point your devices to this DNS server. The first way of doing this is by configuring each device to use your newly created Pi-hole DNS server. The second option is to configure your router to use your Pi-hole DNS server by default, which is my preferred method. Configuring the system this way forces all devices to automatically use this DNS server, which means any device connected to your router will automatically be using Pi-hole!

DNSServers 1

14. After you configure your systems to use Pi-hole, you have a few different options: you can add new blacklists, whitelist specific sites, add local DNS records (new 5.0 feature), or many more.

Conclusion - How to Install Pi-hole on a Raspberry Pi

This tutorial explained how to install Pi-hole on a Raspberry Pi. The best part about running Pi-hole is that an older or less powerful Pi is perfectly capable of handling the DNS load.

Thank you for checking out the tutorial. If you have any questions, feel free to leave them in the comments.

Close Menu