Pi Hole
This article covers the consolidated steps to install Pi Hole on a Raspberry Pi 4 via Mac OS X.
Download disk image
Get the headless Raspberry Pi OS Lite image.
Install onto flash card
Based on the official install instructions copy the image onto the disk, summarised below:
sudo diskutil list (List all disks)
sudo diskutil unmountDisk /dev/diskN (Where diskN is the SD card)
sudo dd bs=1m if=2020-12-02-raspios-buster-armhf-lite.img of=/dev/rdiskN; sync
sudo diskutil eject /dev/rdiskN
NOTE: You will need to replace the image name with the one you downloaded
Setup headless SSH
As we won’t be connecting a monitory / keyboard, setup headless SSH. This will allow you to SSH in once DHCP has assigned an IP.
Mount the new image, and create a file called ssh
in the root directory. e.g.
touch /Volumes/boot/ssh
Power-on
Eject the SD card, insert into the Raspberry Pi. Connect to Ethernet and power-on.
Locate the IP address. This may be shown on your router (depending on it’s capabilities) or can be located with nmap
, e.g.
nmap -v -sn <subnet>/24
Configure SSH
Connect to the Pi with SSH
ssh pi@<ip>
The default password is currently raspberry
First of all add your SSH key to the authorized_keys
file
mkdir ~/.ssh
cat > ~/.ssh/authorized_keys <<EOF
# paste your key here
EOF
Log-out of the SSH session and log-in to check that the password is no-longer required. Once confirmed, disable password login in /etc/ssh/sshd_config
.
PasswordAuthentication no
Finally restart the ssh daemon with systemctl restart sshd
(You may have to be root - sudo su -
)
Install pi-hole
Follow the instructions on the pi-hole github page
curl -sSL https://install.pi-hole.net | bash
Install by accepting defaults and make a note of the admin password on the last screen.
Configure clients
You can now configure clients (or router / DHCP server to use the raspberry pi for DNS)