At first buy a Raspberry Pi (I recommend Zero edition for minimum cost) with casing (official one is enough for Zero). My configuration:
- Rapberry Pi Zero with Official Casing (used the Cover with Center Hole)
- MicroSD card
- Micro-USB to LAN converter (can be replaced with OTG Cable + USB to LAN converter)
- Micro-USB power cable
- LAN connection cable
Download Raspberry Pi Image from official site. Follow instruction for OS specific installation. Afterward write the Raspberry Pi Lite Edition (recommended but you can also use other editions as well) to your MicroSD card. Before clicking on Write
check the details by clicking on Gear
icon and modify as required (hostname, timezone, user credentials, ...).
After writing is complete and safe ejection, insert the card in Pi put them in casing connect all the cables (the casing even on the board have indication, which port is for what). Plug into power and connect with Router LAN port.
If your router don't use DHCP you can omit this section!
As our router provides IP through DHCP, we need to specify an IP for our Pi module. Set up your router to provide Static IP (by searching the Module through Router's client interface)
Login via SSH to your Pi module.
- You should look into primary configurations of your Pi OS. Type in
sudo raspi-config
. Go through the menu & check (& change if required) the configurations. - Up next, type in
sudo nano /etc/dhcpcd.conf
. Change following lines (you can find near the end of file)
interface eth0
static ip_address=[IP address with subnet mask, This is static standalone IP for the Pi Module]
static routers=[router gateway address]
static domain_name_servers=[router DNS or other preferred DNS server]
Save the file (CTRL + O) and Reboot (sudo reboot
).
Install Pi-hole using following command:
sudo curl -sSL https://install.pi-hole.net | bash
Afterwards, you will go through several options, select options as you need (obviously must install all the modules of Pi-hole specially Web GUI). Once installation is complete you'll get the credentials (password) for dashboard login.
- Now login to your Pi-hole dashboard using <assigned_IP>/admin. Go through dashboard options, check all and tweak as you need.
- Don't forget to check the DNS servers.
- Login to your router and change the DNS server to your Pi module IP.
- Youtube and some site may still show Ads (as these links are adaptive) but you can manually block them by tracking the URL and blocking via Web interface.
- Update Gravity atleast every month to keep your tracking DB updated!
- Change password:
pihole -a -p
- Update Pi-Hole:
sudo pihole -up