How to install pi-hole on an ubuntu vps server
How to install pi-hole on an ubuntu vps server

Pi-hole is a network-wide ad blocker that acts as a DNS sinkhole. It’s an effective tool for blocking ads and trackers on all devices connected to your network. This guide will walk you through the process of installing Pi-hole on an Ubuntu VPS server step-by-step.


Before we begin, ensure you have the following:

Launch 100% ssd ubuntu vps from $2. 49/mo!

Step 1: Update Your Server

First, log in to your Ubuntu VPS server via SSH. Update the package list and upgrade all packages to their latest versions.

sudo apt update && sudo apt upgrade -y

Step 2: Install Required Dependencies

Pi-hole requires certain software packages to function correctly. Install these dependencies using the following command:

sudo apt install curl git -y

Step 3: Download and Install Pi-hole

You can download and install Pi-hole using a single command provided by the Pi-hole team. This command uses curl to download and execute the Pi-hole installation script.

curl -sSL | bash

The installation script will guide you through the installation process, including setting up your DNS settings.

Step 4: Configure Pi-hole

During the installation process, you’ll be prompted to configure Pi-hole. Here are the key configuration steps:

  1. Choose an Interface: Select the network interface Pi-hole will use. For a VPS, this is typically eth0.
  2. Select Upstream DNS Providers: Pi-hole needs an upstream DNS server to forward queries it cannot answer. You can choose from providers like Google, OpenDNS, or Cloudflare.
  3. Block Lists: Pi-hole comes with default block lists, which you can customize later.
  4. Set IP Address: Ensure your VPS’s IP address is correct. This step is crucial as Pi-hole needs a static IP address.
  5. Install Web Admin Interface: It’s recommended to install the web admin interface to easily manage Pi-hole.
  6. Web Server Configuration: You can choose to install the Lighttpd web server or use an existing web server.
  7. Admin Password: Set an admin password for accessing the web interface.

Step 5: Access the Web Interface

After the installation, you can access the Pi-hole web interface to manage and monitor your Pi-hole instance.

  1. Open your web browser.
  2. Navigate to http://<your-server-ip>/admin.
  3. Log in using the password you set during the installation.

Step 6: Configure Your Network to Use Pi-hole

For Pi-hole to work effectively, you need to configure your network devices to use Pi-hole as the DNS server. You can do this in two main ways:

Option 1: Configure Individual Devices

Change the DNS settings on each device to point to your Pi-hole server’s IP address.

Option 2: Configure Your Router

Set your router to use Pi-hole as its DNS server. This will automatically apply Pi-hole’s filtering to all devices connected to your network.

Step 7: Update Pi-hole Block Lists

Pi-hole uses block lists to block ads and trackers. You can update these lists through the web interface.

  1. Log in to the Pi-hole admin interface.
  2. Go to “Group Management” > “Adlists”.
  3. Add new block lists URLs or manage existing ones.
  4. Click “Update Gravity” to apply the changes.

Step 8: Regular Maintenance

To keep Pi-hole running smoothly, perform regular maintenance:

  • Update Pi-hole: Regularly check for updates and install them.
    pihole -up
  • Monitor Logs: Use the web interface to monitor logs and ensure Pi-hole is functioning correctly.
  • Backup Configuration: Regularly backup your Pi-hole configuration to avoid data loss.

Troubleshooting Tips

  • DNS Resolution Issues: If you experience DNS resolution issues, check the Pi-hole logs and ensure your upstream DNS servers are correctly configured.
  • Accessing the Web Interface: If you can’t access the web interface, ensure your server’s firewall allows traffic on port 80.


Launch 100% ssd ubuntu vps from $2. 49/mo!
You’ve successfully installed Pi-hole on your Ubuntu VPS server. By following these steps, you can enjoy an ad-free browsing experience on all your network devices. Remember to regularly update Pi-hole and its block lists to maintain optimal performance and protection.

If you encounter any issues, refer to the Pi-hole documentation or seek help from the Pi-hole community.

Avatar of editorial staff

Editorial Staff

Rad Web Hosting is a leading provider of web hosting, Cloud VPS, and Dedicated Servers in Dallas, TX.