Pi-hole is a caching DNS server with the ability to block ads and other unwanted resources.

Initially, the Pi-hole project was developed for Raspberry Pi single-board computers, but over time it became available for most Linux distributions.

Distribution Release Architecture
Raspbian Stretch / Buster ARM
Ubuntu 16.x / 18.x ARM / x86_64
Debian 9 / 10 ARM / x86_64 / i386
Fedora 31 / 32 ARM / x86_64
CentOS 7 / 8 x86_64

In this guide, we will consider installing on OSs like Centos 7.7, Ubuntu 18.04, and installing on VPS + OpenVPN.

Install Pi-hole on Centos 7.7

First, you need to check the status of SELinux and disable it if necessary:


open SELinux configuration file with any editor

mcedit /etc/selinux/config

and change the SELINUX value to disabled

then reboot the server. Further, the entire installation is reduced to one command:

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

Then the installation script will be launched and following the prompts complete the installation.

Now we are ready to move on to our newly installed Pi-Hole control panel. You can access it in your browser by typing “http://xxx.xxx.xxx.xxx/admin” or “http://pi.hole/admin”. Change the IP address (xxx.xxx.xxx.xxx) according to your settings.

Install Pi-hole on Ubuntu 18.04

Installation on Ubuntu 18.04 comes down to one command:

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

After the installation is complete, you will receive a message with a password to access the web interface and a hint with the necessary command to change it.

Install Pi-hole on VPS + OpenVPN

This guide is intended to configure OpenVPN on a virtual server hosted in the cloud (for example, Cloudvps). This installation and configuration provide maximum protection for your traffic and filtering DNS queries when using public networks.

First, download the OpenVPN installer and make it executable, and then run it:

wget https://git.io/vpn -O openvpn-install.sh
chmod 755 openvpn-install.sh

Then install Pi-Hole and select tun0 as the interface and as the IP address. You can accept the rest of the default values ​​or customize the Pi-hole to your liking. Choosing an interface is the most important step. If you do not select tun0 (at least to begin with), it will not work properly.

Edit the OpenVPN configuration file using your favorite editor:

mcedit /etc/openvpn/server/server.conf

Change this push “dhcp-option DNS” line to use the IP address of your Pi-hole

push "dhcp-option DNS" 

Create a client configuration file (.ovpn).
Now that the server is configured, you need to create a settings file so that you can use Pi-Hole. You generate the .ovpn settings file by running the installer and selecting 1) Add a new client for each client that will connect to the VPN. You can repeat this process for any number of customers. In this example, we “add a new user” by giving the .ovpn file the name test, but you can use your own naming strategy.


Then export the finished settings file and use it to connect.