Block Ads and Improve Internet Speed with Pi-Hole on Your Raspberry Pi

Learn how to install Pi-Hole, a free and open source ad blocking software, on your Raspberry Pi and take control of your internet experience. …


Updated September 4, 2023

Need help with your Raspberry Pi?
Contact Me!

Do you love silly Raspberry Pi Projects?
Check out my this YouTube Channel!


Learn how to install Pi-Hole, a free and open source ad blocking software, on your Raspberry Pi and take control of your internet experience.

Prerequisites

Before getting started with installation, ensure that you have the following:

  1. A Raspberry Pi with Raspbian (or any other compatible Linux distribution) installed. You can download Raspbian from the official Raspberry Pi website.
  2. An Ethernet cable or Wi-Fi adapter to connect your Raspberry Pi to your network.
  3. A free domain name for your Pi-Hole instance. If you don’t have one, you can get a free domain from Freenom (https://www.freenom.com).
  4. Access to the command line interface either through SSH or by connecting a keyboard and monitor to your Raspberry Pi.

Installation Steps

  1. First, make sure your Raspberry Pi is up-to-date:
sudo apt update
sudo apt upgrade
  1. Next, install the necessary dependencies for Pi-Hole:
sudo apt install -y curl libatomic1 git
  1. Clone the Pi-hole repository from GitHub and change to the cloned directory:
cd /opt && git clone --depth 1 https://github.com/pi-hole/pi-hole.git pihole
cd pihole
  1. Run the Pi-Hole installation script with the following command (replace ‘example.com’ with your domain name):
sudo bash install.sh --unattended --domain example.com
  1. Once the installation is complete, you’ll be prompted to reboot your Raspberry Pi. Type y and enter:
sudo reboot
  1. After the reboot, open a web browser on any device connected to your network and navigate to http://pi.hole. You should see the Pi-Hole admin interface.
  2. Log in with the default credentials:
    • Username: pihole
    • Password: raspberry
  3. Change the password for added security and configure other settings as desired.

Setup Your Devices to Use Pi-Hole

To make your devices use Pi-Hole as their DNS server, you’ll need to set the IP address of your Raspberry Pi as the primary DNS in your network settings. Here’s how:

  1. Find the IP address of your Raspberry Pi by running hostname -I on the command line interface.
  2. On each device that you want to use Pi-Hole, open the network settings and set the following DNS servers:
    • Preferred DNS: The IP address of your Raspberry Pi
    • Alternate DNS: 8.8.8.8.8 (or any other public DNS server for backup)
  3. Save the changes and test your internet connection. You should see a significant improvement in speed and reduced ads on your devices.

Conclusion

Congratulations! You’ve successfully installed Pi-Hole on your Raspberry Pi and set it up to block ads for your entire network. With this powerful tool, you can now enjoy an uninterrupted internet experience, free from unwanted ads and pop-ups. To further optimize your Pi-Hole setup, consider installing the Admin Web Interface or Whitelisting important domains that you don’t want blocked.