How to Self-Host Pi-hole on a VPS (Complete Guide)
Pi-hole is an excellent choice for network-wide ad blocking, and self-hosting it on a Virtual Private Server (VPS) can enhance your privacy and control over your browsing experience. In this guide, we will walk you through the steps to install and configure Pi-hole on a VPS. Weโll also discuss some VPS provider options to get you started.
Why Self-Host Pi-hole?
Self-hosting Pi-hole on your VPS allows you to:
- Block ads at the DNS level
- Prevent tracking by advertisers
- Control your own DNS settings
- Improve overall Internet performance by loading pages faster
Choosing a VPS Provider
Here is a comparison table of some top VPS providers, their pricing, and features to help you decide:
| Provider | Starting Price | Storage | Memory | Link |
|---|---|---|---|---|
| Contabo VPS | 5.99 EUR/mo | 200 GB SSD | 4 GB | Contabo |
| Hetzner Cloud | 4.15 EUR/mo | 20 GB SSD | 2 GB | Hetzner |
| DigitalOcean | 6 USD/mo | 25 GB SSD | 1 GB | DigitalOcean |
| Vultr | 6 USD/mo | 25 GB SSD | 1 GB | Vultr |
| Linode | 5 USD/mo | 25 GB SSD | 1 GB | Linode |
You can also visit our full VPS comparison for more options.
Step-by-Step Installation Guide
Step 1: Create a VPS Instance
- Sign up with your chosen VPS provider.
- Choose an appropriate plan. For Pi-hole, 1 GB of RAM should be sufficient, but opt for more if you plan to host additional services.
- Set up your instance. Choose Ubuntu 20.04 or a similar Linux distribution as your OS during the setup process.
Step 2: Connect to Your VPS
Using SSH, connect to your VPS instance:
ssh root@your_vps_ip
Replace your_vps_ip with the IP address provided by your VPS provider.
Step 3: Update Your Server
Run the following commands to ensure your server is up to date:
apt update && apt upgrade -y
Step 4: Install Docker
Using Docker is one of the easiest ways to run Pi-hole. Install Docker by executing:
apt install docker.io -y
systemctl start docker
systemctl enable docker
Step 5: Pull Pi-hole Docker Image
Now pull the Pi-hole Docker image from the repository:
docker pull pihole/pihole
Step 6: Run Pi-hole Docker Container
Run the Pi-hole container with the following command:
docker run -d \
--name pihole \
-e TZ="Your/Timezone" \
-e WEBPASSWORD="YourPassword" \
-e DNS1="8.8.8.8" \
-e DNS2="8.8.4.4" \
-p 53:53/tcp \
-p 53:53/udp \
-p 80:80 \
--restart=unless-stopped \
pihole/pihole
Make sure to replace Your/Timezone with your actual timezone (e.g., America/New_York) and YourPassword with a secure password for the web interface.
Step 7: Configure Your Router
To fully utilize Pi-hole, configure your home routerโs DNS settings to point to your VPS. Set the DNS to the IP address of your VPS so all devices on your network use Pi-hole for DNS resolution.
Step 8: Access the Web Interface
You can access the Pi-hole admin interface using:
http://your_vps_ip/admin
Log in using the password you set earlier.
FAQs
How do I update Pi-hole on my VPS?
Updating Pi-hole can usually be done by updating the Docker container. Simply stop the container first:
docker stop pihole
Then pull the latest version and restart it:
docker pull pihole/pihole
docker start pihole
This ensures you are running the latest version with the latest ad lists. You should also regularly check for updates within the Pi-hole interface itself.
Is it safe to self-host Pi-hole on a VPS?
Yes, self-hosting Pi-hole on a VPS can be safe as long as you take necessary precautions. Ensure that your VPS is secured using a strong SSH password and considered practices such as disabling root login and enabling firewall rules. Using a reputable VPS provider minimizes risks, and a private server allows control over your DNS queries.
Can I run other services along with Pi-hole on the same VPS?
Yes, you can run multiple services on the same VPS, as long as your server has enough resources. However, ensure that the other services do not conflict with Pi-holeโs ports. For instance, avoid running another DNS service that uses port 53 unless configured correctly. Docker containers can help isolate these services and manage resource usage efficiently.
By following these steps, you will have Pi-hole running effectively on your VPS. Now you can enjoy a clutter-free browsing experience and take control of your networkโs DNS settings.