How to Install Pi-hole on Ubuntu

Share what you're reading!

In this tutorial, we will look at how to install Pi-hole on Ubuntu.

Pi-hole is a DNS sinkhole and installing it on Ubuntu is a very straightforward process. Assuming the device is online 24/7, it’s a great place to run it. We will use a script that walks you through the whole process of how to install Pi-hole on Ubuntu. As with all scripts, make sure that you review it to ensure that you’re comfortable running them.

There are many different systems that you can run Pi-hole on, and it’s always a good idea to have more than one DNS server (for redundancy purposes), so check out our other Pi-hole tutorials if you’re interested in running it on another device!

How to Install Pi-hole on Ubuntu

The steps below will show how to install Pi-hole on Ubuntu. The process is the same as any other Debian-based Linux distribution.

1. Run the command below to install Pi-hole. Please review the script to ensure you’re comfortable running it before proceeding (I am not the creator of this script).

curl -sSL | bash
installing Pi-hole. How to Install Pi-hole on Ubuntu.

2. Press Enter until you get to the Static IP address setup. It is extremely important for Pi-hole to have a static IP address. It’s recommended to set up a static IP on your router, but you can do it inside of the Ubuntu operating system as well if necessary.

Just make sure that you set (or plan to set) a Static IP before proceeding.

pi-hole static ip address.

3. Select an Upstream DNS Provider. The Upstream DNS Provider is where DNS requests (which are not found locally) will be forwarded.

pi-hole upstream dns servers.

4. Select Yes to use the default block list. Please keep in mind that this can be configured later, and you do not have to use this list if you don’t want to.

pi-hole blocklists.

5. Select Yes to install the admin interface. This is how you’ll manage Pi-hole.

pi-hole admin interface.

6. Select Yes to install the Admin Web Interface.

pi-hole web server.

7. Query logging is a personal preference (this is what will determine if DNS requests are logged), so select Yes or No based on your preference.

query logging in pi-hole

8. If you selected yes above, you’ll be asked to determine the privacy of DNS requests. Select the option you’d like, then press Continue.

pi-hole privacy mode.

9. Pi-hole will now install! Give it a few minutes to ensure that it’s fully configured. When it’s complete, you’ll receive a confirmation page where you can select OK to proceed. Please note the password given so that you can log in to the web interface!

pi-hole confirmation.

Connecting to Pi-hole/DNS Settings – How to Install Pi-hole on Ubuntu

1. Connect to the admin Pi-hole webpage at one of the addresses below:

pi-hole web interface

2. Pi-hole is now successfully installed and accessible. 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!

NOTE: The screenshot below is old, so using the information above, the IP address of the DNS server would be as opposed to

dns server on router

3. 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, etc. At this point, Pi-hole is fully configured and should be blocking ads (assuming the block lists are configured properly)!

Conclusion: How to Install Pi-hole on Ubuntu

This tutorial explained how to install Pi-hole on Ubuntu. If you’re using Ubuntu, especially as a server, running Pi-hole is a great option as it’s incredibly minimal. Please keep in mind that there are various other types of devices that can install Pi-hole and you should have a secondary DNS server for backup and reliability purposes.

Thank you for checking out the tutorial on how to install Pi-hole on Ubuntu. If you have any questions on how to install Pi-hole on Ubuntu, feel free to leave them in the comments!


Frank is an IT professional with 14+ years experience and the creator of WunderTech. He focuses on sharing his experience with others on computer hardware, servers, software, networking, and self-hosted apps. He has a BS in Computer Information Systems and an MBA. Learn more about Frank in his bio.