How to Install Pi-Hole on Ubuntu (Beginner’s Guide)
Ads are all over the place on the Internet. Most people develop a sixth sense to ignore them, use a browser extension like AdBlock to hide some of them, or block everything on their whole network by installing Pi-Hole on Ubuntu. How do you do this? I will explain my setup in this article.
Pi-Hole is a free and open-source ad blocker that can be installed on any Linux distribution with only one command: curl -sSL https://install.pi-hole.net | bash. Once done, the network configuration needs to be updated to use it as the main DNS server.
This might seem simple at first glance, but I bet you’ll need more details on how to do this safely and efficiently. Keep reading to see how to set up Pi-Hole step-by-step on your network.
If you need help with Linux, I’ve got something that can help you right away!
Download my free Linux commands cheat sheet – it’s a quick reference guide with all the essential commands you’ll need to get things done on your system. Click here to get it for free!
Pi-Hole Server Installation on Ubuntu
Pi-Hole Requirements
Pi-Hole is a lightweight solution, and that doesn’t require much processing power to install it. In fact, it’s mainly used on the Raspberry Pi, a tiny computer with limited CPU and RAM, so it shouldn’t be an issue on any standard computer.
In their documentation, Pi-Hole recommends at least 2 GB of free space on the disk and 512 MB RAM.
Your computer will be perfect, but you can also use a Raspberry Pi 4 or a minimal Intel NUC for example. I read that you can even install it on a Synology NAS, with a docker container (I have this one on Amazon, but you can find cheaper models).
Warning: Pi-Hole might not be supported on the latest Ubuntu release, check this link to verify. As of this article update, the installation script was NOT working on Ubuntu 25.10, but was verified to work with Ubuntu 24.04LTS.
You can install Pi-Hole directly on your computer if you are using Ubuntu, but it’s probably better to install it on something you’ll run 24/7. For example, if you configure the whole network to use Pi-Hole, Internet won’t work on other devices if your computer is off or in sleeping mode. This would not be a great experience.
That’s why I suggest using a Raspberry Pi (you can install Ubuntu on it), a NAS or any device that you can leave running all the time.
Grab This Cheat Sheet!
I've compiled the must-know commands in a simple PDF for quick reference.
Download now
Note: If you are trying this on a Raspberry Pi with the default operating system, I have a detailed tutorial on how to install Pi-Hole on Raspberry Pi. In this article, I’ll focus on Ubuntu.
Update the Operating System
Once your hardware is selected and Ubuntu is installed, the first thing to do is to update your system. It’s a good practice to follow before installing anything on your system, just to avoid dependency issues and version incompatibility.
You can do this easily in a terminal:sudo apt update
sudo apt upgrade
Or use the software updater tool in the graphic interface if you are using the Desktop version:

Click Install now and type the user password to confirm the installation.
A reboot is probably a good idea if you have many updates to catch up on.
Then you’ll also need to install curl on your system if not already there:sudo apt install curl
The Pi-Hole installation script will handle everything else after that.

If you’re new to the Linux command line, this article will give you the most important Linux commands to know, plus a free downloadable cheat sheet to keep handy.
Pi-Hole Installation Script
Once your system is ready, the installation can be done with only one command, by copying and pasting this into a terminal:curl -sSL https://install.pi-hole.net | sudo bash
Grab This Cheat Sheet!
I've compiled the must-know commands in a simple PDF for quick reference.
Download now
The process is mostly automatic, but you’ll still need to answer a few questions to adjust your settings:
- Type your user password, and the installation starts:

- A few seconds later, a wizard will show up with a few questions for you to answer:

Just confirm by pressing Enter for the first few questions. - Then choose your DNS provider:

Google is fine, but you can choose another one if you prefer. - Pi-hole relies on third-party lists to block ads. By default, it will use StevenBlack’s host list, but you can deselect it if you want (not recommended).
Press Enter to continue (and the space bar to select/deselect). - Then, select the protocols you want to use (I recommend keeping both).
- Pi-Hole will use a static IP address (to avoid reconfiguring everything each time it uses a new IP).
The next step is to configure if you want to keep the current IP or set another one manually.
It depends on your network, at home you can probably keep the default one without any major issues. - Then confirm to enable the web interface and the web server (highly recommended):

- A couple of questions later, the installation wizard will configure everything as requested.
Make sure to not use the default password and move to the next step.
Configure Device Clients to Use Pi-Hole
Once your server is installed, the next step is to configure your network to use this server. Pi-Hole works like a DNS server, so you need to change the primary DNS server on all of the devices to use the Pi-Hole IP address.
This can be done manually on each device, but the easiest way is to change the default DNS server in your DHCP configuration.
Edit the DHCP Configuration to Set Pi-Hole as the Default DNS
The easiest way to config all devices at once is to go to your DHCP server configuration and set the primary DNS server to the Pi-Hole server IP address.
If you are installing this at home, your DHCP server is probably your Internet router.
I won’t explain how to do this in detail, as it will be different for each provider and router, but as a whole, the idea is to find the DHCP settings on the web interface and change the DNS server IP address.
By default, it’s probably the DNS server from your provider.
In my case, it was in the DNS settings:

Once you find something like this, remove the default values and set the primary DNS server to your Pi-Hole installation IP address (probably something like 192.168.1.X or 192.168.0.X). Leave the secondary DNS server empty.
It may take a few hours to update the configuration on all devices on your network, but it will be done automatically.
Change the Network Configuration on Each Client to Use Pi-Hole
Grab This Cheat Sheet!
I've compiled the must-know commands in a simple PDF for quick reference.
Download now
The alternative is to manually update the configuration on each device you want to use with Pi-Hole. This might take more time, especially if you have many devices on your network, but this way you can make sure everything is working before breaking the Internet for the whole family!
You might also like: The 5 fastest web browsers for Raspberry Pi — tested and ranked!
On Windows 10:
- Right-click on the “Start Menu” and choose “Network Connections”.
- Then click on “Change adapter settings”.
- Right-click on your current connection and choose “Properties”.
- Double-click on “Internet Protocol Version 4 (TCP/IPv4)”.
- Set the DNS server to static and enter your Pi-Hole server IP Address.
Keep the secondary DNS server empty.
On Windows 11:
- Search the Start Menu for “View network status and tasks.”
- Click the name of your connection next to “Connections:”
e.g., Wi-Fi (myNetwork) - The Status window will open. Click “Properties.”
- Double-click on “Internet Protocol Version 4 (TCP/IPv4)” to open the DNS settings.
- Select “Use the following DNS server addresses.”
– for Preferred DNS server: enter your Pi-Hole server IP Address.
– for Alternate DNS server: leave it blank.
On Linux and Mac OS:
- If you have a graphical interface, you’ll find the network settings in the System Preferences.
- If not, you can edit the /etc/resolv.conf file and replace the current DNS server with the Pi-Hole IP address.
I explain how to change the DNS server on a server edition of Linux in more details in this article. Click on the link to learn more, as the resolv.conf file might not work depending on your distribution.
On mobile, it’s in your Wi-Fi settings.
Click details or edit the network on a network to see the DNS configuration.
How to Know if Pi-Hole is Working?
To know if Pi-Hole is working, you can go to the web interface and check if it’s blocking ads. Another way is to try to access a domain hosting ad (like doubleclick.net) and verify that the Pi-Hole page appears instead of the website content.

The web interface is enabled on http://localhost/admin (if installed on your computer) or http://IP_Address/admin (if installed on another computer). The default password was the one provided at the end of the installation.

Prefer videos over reading? The RaspberryTips Community members get exclusive video lessons every month. Join now and watch them all right away. Get instant access.
Pi-Hole FAQ
Can Pi-Hole run on any Linux distribution?
Pi-Hole is officially supported on Raspberry Pi OS (Raspbian), Ubuntu, Debian, Fedora, Armbian OS, and CentOS. As most Linux distributions are based on these, Pi-Hole should run on almost any system.
Read next: 7 Surprising Uses for a Raspberry Pi
Grab This Cheat Sheet!
I've compiled the must-know commands in a simple PDF for quick reference.
Download now
Just check the exact supported release on this page before trying to install it. They are often a little behind when a new version is available. For example, as of this update (October 2025), Ubuntu 24.04 is verified to be working, but we could not get it working with Ubuntu 25.10 or newer yet.
Consider using Docker or Docker Compose to run Pi-Hole as a container to overcome compatibility issues with your system.
What can Pi-Hole be installed on?
The prerequisites to install Pi-Hole are 2 GB of disk space and 512 MB of RAM, so it can run on almost any computer, even the older ones. Raspberry Pi and other single-board computers are also supported as long as a supported operating system is installed.
My recommendation is to use a Raspberry Pi (as it’s the cheapest option), plug it somewhere on your network and keep it on all the time.
Warning: current prices are all over the place for a new Raspberry Pi. Make sure to check this article to pay the right price when buying a Raspberry Pi. I also give a few tips to find one in stock (which currently isn’t that easy).
What can I do with Pi-Hole?
The main purpose of Pi-Hole is to block ads on the Internet, by blocking their servers at a network level. Pi-Hole can also be used as a DHCP server and a network monitor.
Does Pi-Hole stop YouTube ads?
As Pi-Hole is working at a network level, it’s not the best option to block YouTube ads. On YouTube, ads and videos are served from the same domain, so Pi-Hole will block both or none, it can’t analyze the content itself.
You might also like: 25 project ideas you can try at home with Raspberry Pi
If blocking YouTube ads is your main goal, a browser extension like AdBlock or a browser like Brave have better chances of success.
Does Pi-Hole stop malware and phishing?
Pi-Hole won’t natively stop malware and phishing on your devices, but you can add additional block lists with domains that are known to host malware or act as phishing. It won’t have a 100% success rate, but it might increase the overall security of your network.
Whenever you're ready, here are other ways I can help you:
Master Linux Commands: Overwhelmed with Linux commands? This book is your essential guide to mastering the terminal. It includes practical tips, real-world examples, and a bonus cheat sheet to keep by your side.
The RaspberryTips Community: Need help with Linux or want to chat with people who actually get it? Join the RaspberryTips Community and get access to private forums, exclusive lessons, and direct support.
You can also find all my recommendations for tools and hardware on this page.
