Linux MintUbuntu Based

How To Install Pi-hole on Linux Mint 21

Install Pi-hole on Linux Mint 21

In this tutorial, we will show you how to install Pi-hole on Linux Mint 21. Pi-hole is a DNS sinkhole that acts as a DNS server, blocking unwanted content such as advertisements, trackers, and malware domains before they even reach your devices. By implementing Pi-hole on your network, you can enjoy an ad-free browsing experience across all your connected devices, from desktops and laptops to smartphones and smart TVs. Not only does this enhance your online privacy and security, but it also improves network performance by reducing the load of unwanted content.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Pi-hole on Linux Mint 21.


  • A server running one of the following operating systems: Linux Mint 21.
  • Pi-hole requires a static IP address to function properly. If you haven’t already, configure your Linux Mint 21 machine to use a static IP address. You can do this by modifying the network configuration files or using the Network Manager GUI.
  • While we’ll guide you through the process, a basic understanding of the command line will be beneficial. If you’re new to the CLI, you might want to acquaint yourself with some fundamental commands.
  • A stable internet connection is necessary to download the Pi-hole installation script and the required dependencies.
  • Administrative privileges are essential for installing and configuring software on your system. Ensure that you have superuser or sudo access.

Install Pi-hole on Linux Mint 21

Step 1. Before proceeding with the Pi-hole installation, it’s crucial to ensure that your Linux Mint 21 system is fully up-to-date. Open the terminal and run the following commands:

sudo apt update
sudo apt upgrade

These commands will fetch the latest package information and upgrade any outdated packages to their latest versions. This process may take a few minutes, depending on the number of updates available.

Step 2. Installing Pi-hole on Linux Mint 21.

To begin the installation process, open a terminal window on your Linux Mint 21 machine. You can download the Pi-hole install script directly using the curl command:

curl -sSL | bash

Alternatively, you can manually download the script, make it executable, and run it using the following commands:

wget -O
chmod +x
sudo bash

Once the installer script has been downloaded, it will automatically start the interactive installation process. You’ll be presented with a series of prompts to customize your Pi-hole installation. Let’s go through each of these prompts:

  • Upstream DNS Provider: Choose your preferred upstream DNS provider from the list (e.g., Google, OpenDNS, Cloudflare). This is the DNS server that Pi-hole will use to resolve domain names not blocked by its filters.
  • Protocols: Select the protocols you want to use for your Pi-hole setup. You can choose between IPv4 only, IPv6 only, or both. If you’re unsure, it’s generally safe to select both IPv4 and IPv6.
  • Static IP Address: Pi-hole requires a static IP address to function properly. If your Linux Mint 21 machine doesn’t already have a static IP, the installer will guide you through the process of setting one up.
  • Web Admin Interface: Choose whether to install the web admin interface for Pi-hole. This interface provides a user-friendly way to manage your Pi-hole settings, view statistics, and customize blocklists. It’s highly recommended to install the web admin interface.
  • Confirm Installation: Review your selected settings and confirm the installation. The installer will now download and install the necessary components for Pi-hole.

Step 3. Configure Your Network to Use Pi-hole.

With Pi-hole installed on your Linux Mint 21 machine, you need to configure your network devices to use it as their DNS server. There are two main ways to achieve this:

  • Router Configuration: The most convenient method is to set your router’s DNS server to the IP address of your Pi-hole machine. This way, all devices connected to your network will automatically use Pi-hole for DNS resolution. Consult your router’s documentation for specific instructions on how to change the DNS settings.
  • Device-Specific Configuration: Alternatively, you can manually configure each device on your network to use Pi-hole as its DNS server. This method gives you more granular control but requires setting the DNS server on each device individually.

Step 4. Access the Pi-hole Web Interface

If you chose to install the web admin interface during the installation process, you can now access it to manage your Pi-hole settings and view statistics. To access the web interface, follow these steps:

  • Open a web browser on any device connected to your network.
  • Enter the IP address of your Pi-hole machine, followed by “/admin” (e.g.,
  • You will be prompted to enter the admin password, which was displayed during the installation process. If you didn’t note it down, you can retrieve it by running the following command on your Pi-hole machine:
sudo cat /etc/pihole/setupVars.conf | grep WEBPASSWORD

Once logged in, you can explore the various features of the web interface, such as viewing blocked queries, adding whitelisted domains, and updating blocklists.

Install Pi-hole on Linux Mint 21

Step 6. Configure Pi-hole Settings.

Pi-hole offers a wide range of customization options to tailor your ad-blocking experience. Here are some common settings you may want to configure:

  • Blocklists: Pi-hole comes with a default set of blocklists, but you can add more to enhance its ad-blocking capabilities. Visit the “Adlists” section in the web interface to add, remove, or update blocklists.
  • Whitelisting: If you find that Pi-hole is blocking content on a website you trust, you can whitelist that domain to allow its content to be displayed. Navigate to the “Whitelist” section in the web interface to add domains to the whitelist.
  • DNS Settings: In the “DNS” section of the web interface, you can configure advanced DNS settings, such as changing the upstream DNS provider or enabling DNSSEC validation.
  • Query Logging: Pi-hole can log all DNS queries made by devices on your network. You can adjust the query logging settings in the “Logging” section of the web interface, choosing to enable or disable logging and set the log retention period.

Congratulations! You have successfully installed Pi-hole. Thanks for using this tutorial to install the latest version of the Pi-hole powerful and effective ad-blocking solution on the Linux Mint system. For additional help or useful information, we recommend you check the official Pi-hole website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button