The purpose of the script is to automate the inital configuration of Raspberry Pi OS and the subeseqent instalation of Pi-Hole, dnscrypt-proxy and log2ram with suffictient configuration to run using Cloudflare as the upstream resolver.
This script is intended to be run on a fresh installation of Raspberry Pi OS Some checks exist, in order to prevent the script from breaking an already configured Pi, but none of them can be considered bulletproof, so running on a Pi with some existing configuration is a risk.
Follow these steps to install and configure Pi-Hole on your Raspberry Pi:
- Install the Raspberry Pi OS Lite (minimal) image to the MicroSD card
- If the Raspberry Pi will connect to the network wirelessly, create a wpa_supplicant.conf file in the boot directory. Use the tmpl file and fill the necessary information
- Create an empty text file named "ssh" (no file extension) in the boot directory
- Insert the SD card into the Pi and connect power
- SSH into the Pi with username
pi
and passwordraspberry
- Copy the script
Initial_Setup.sh
to a temporary directory on the Raspberry Pi - Open the script with a text editor and fill the first section
- Execute the script as
root
(or sudo) - Reboot
- Login as
pi
and becomeroot
. Use the new IP address when connecting - Create a password for the new user
- Exit and login as the new user
sudo userdel pi
- After the installation the password for the Pi-Hole Web UI is "pihole". Execute
pihole -a -p
in order to set a new password. - (optional) Add more blocklists and configure the correct timezone
The following guides were used as a reference:
https://blog.alexellis.io/hardened-raspberry-pi-nas/ - for the initial OS config and partial hardening
https://www.smarthomebeginner.com/pi-hole-setup-guide/ - sequence of the steps
https://blog.sean-wright.com/dns-with-pi-hole-dnscrypt/ - setting up dnscrypt-proxy
https://github.com/pi-hole/pi-hole/wiki/DNSCrypt-2.0 - setting up dnscrypt-proxy