How to set up Pi-Hole on Raspberry Pi Zero W

How to set up Pi-Hole on Raspberry Pi Zero W
Photo by La-Rel Easter / Unsplash

Intro

Pi-Hole on raspberry pi zero was my Sunday project. I like to build home automation. I saw this application the first time on https://www.raspberrypi.org/blog/pi-hole-raspberry-pi/ and decided to implement it for my home.

Pi-Hole is a Network-wide Ad Blocking application. Pi-hole is also known as Linux network-level advertisement and Internet tracker blocking the application. Click for more details.

Requirements

Here is the shopping list;

  1. Raspberry Pi ZERO W: https://amzn.to/2KgPWUi
  2. Sandisk Ultra 64GB MicroSDXC card: https://amzn.to/389iqZL
  3. Power adapter 5V 2.5A https://amzn.to/35ZIROQ
  4. Official Case https://amzn.to/3nqNBox

Flashing OS

There are many options when you want to flash OS to a USB drive. In this setup, I preferred Raspberry Pi Imager. Download the latest version of Raspberry Pi Imager and install it.

First is first, don't forget to format your sd card. Open Raspberry Pi Imager and choose the Raspbian lite from the list presented and click ‘WRITE’ to begin writing data to the SD card.

After the flashing, add a text file named "ssh" in the boot partition.

In macOS;

sudo touch /Volumes/boot/ssh

Setup of the Raspberry Pi

To connect to RP;

ssh [email protected]

When asked to enter a password, type "raspberry". (RP default password).

To config our RP and change to the hostname or other related settings;

sudo raspi-config

At this point, you need to decide how you connect your raspberry pi zero w after installation. Password or SSH key? I'll go with a password but I strongly recommend using SSH.

After changing the default password, you may want need to change the hostname and IP addresses. To assign a static IP address to RP, we need to edit dhcpcd.conf file;

sudo nano /etc/dhcpcd.conf

and;

interface wlan0
static ip_address=10.0.0.61/8
static routers=10.0.0.1
static domain_name_servers=1.1.1.1 1.0.0.1

Pi-Hole Setup

All we need is 1 line script.

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

Check Status

pihole status

Update

In case you need to update;

pihole -up

Ad Lists

Pi-hole comes with a pre-defined two advertisement block list. If you want to extend these lists, you can find them on the internet.

The End

We completed the Pi-Hole installation on RPZW's. Feel free to discover your newly created homemade Pi-hole.

PS: This screenshot is from my setup;

final pi-hole screen