Raspberry Pi with Pi-Hole Setup Instructions
I recently upgraded my Pi-Hole OS from Buster (v10) to Bookworm (v12). Even though I did this a few years back, it is hard to remember the steps needed to accomplish the goal. Especially for those that are more versed in Windows OS than Linux type OS. This time I decided to document the procedure.1. SD Card Setup
Updates the system and configures basic settings on the SD card.
sudo apt update && sudo apt full-upgrade -y sudo raspi-config # Timezone, SSH, expand filesystem sudo reboot
2. Fix SSH
Removes old SSH key from Windows to reconnect after reinstall.
ssh-keygen -R 192.168.1.4 # On Windows, adjust IP
3. Overclock (Fix Flickering)
Boosts CPU/GPU speeds to fix screen flicker, later optimized.
sudo nano /boot/firmware/config.txt # Initial: over_voltage=6, arm_freq=2100, gpu_freq=750 # Optimized: over_voltage=4, arm_freq=1800, gpu_freq=750 sudo reboot
4. USB SSD Boot
Enables SSD booting and clones SD card to SSD for faster performance.
sudo rpi-eeprom-update -a && sudo reboot lsblk # Verified your source and target drive addresses: SD=/dev/mmcblk0, SSD=/dev/sda sudo dd if=/dev/mmcblk0 of=/dev/sda bs=4M status=progress && sudo sync sudo shutdown -h now sudo raspi-config # Expand filesystem on SSD sudo reboot
5. Swap File Tweaks
Adjusts virtual memory: removed, then set to 1GB, later 512MB.
sudo swapoff -a # Turn off all active swap spaces sudo systemctl stop dphys-swapfile # Stop the swap management service sudo apt remove dphys-swapfile # Uninstall the swap service sudo rm /var/swap # Remove the swap file (optional) free -h # Verify swap is 0B (no reboot needed) # Later: CONF_SWAPSIZE=1024 sudo apt install -y dphys-swapfile sudo nano /etc/dphys-swapfile # CONF_SWAPSIZE=1024 sudo systemctl start dphys-swapfile # Later: CONF_SWAPSIZE=512 sudo systemctl stop dphys-swapfile sudo nano /etc/dphys-swapfile # CONF_SWAPSIZE=512 sudo systemctl start dphys-swapfile
6. Enable RDP
Installs xrdp for remote desktop access from Windows.
sudo apt install -y xrdp sudo systemctl enable xrdp && sudo systemctl start xrdp sudo reboot
7. Install Pi-Hole
Sets up Pi-Hole as a network-wide ad blocker and DNS server.
sudo apt update curl -sSL https://install.pi-hole.net | bash # Follow installer prompts sudo pihole -a -p # Set admin password
That is it, let me know if you have any questions. HLC.