Awesome Open Source
Awesome Open Source

Personal Raspberry Pi 4 and Pi-hole settings

🔹 Raspberry Pi OS Lite

Install

  • Create a new empty file ssh inside /boot directory.

Configuration

Disable all interfaces, sound, and video:

sudo nano /boot/config.txt
# disable Audio
dtparam=audio=off

# disable WiFi and Bluetooth
dtoverlay=disable-wifi
dtoverlay=disable-bt

# disable HDMI
# On the Raspberry Pi 4, setting hdmi_blanking=1 will not cause the HDMI output to be switched off,
# since this feature has not yet been implemented.
hdmi_blanking=1
max_framebuffers=0

# give more RAM to the CPU
# only for console using
gpu_mem=1

# disable Serial Port
enable_uart=0

# disable External interfaces
dtparam=i2c=off
dtparam=i2s=off
dtparam=spi=off

Disable IPv6:

sudo nano /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1
net.ipv6.conf.wlan0.disable_ipv6 = 1

Set time zone:

sudo timedatectl set-timezone Europe/Minsk

🔹 Pi-hole

Install

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

🔹 pihole-updatelists

Install

sudo apt install php-cli php-sqlite3 php-intl php-curl && \
wget -O - https://raw.githubusercontent.com/jacklul/pihole-updatelists/master/install.sh | sudo bash

Configuration

Clear all preinstalled Pi-hole ad-lists:

sudo sqlite3 /etc/pihole/gravity.db "delete from domainlist where type=0;" # whitelist
sudo sqlite3 /etc/pihole/gravity.db "delete from domainlist where type=1;" # blacklist
sudo sqlite3 /etc/pihole/gravity.db "delete from domainlist where type=2;" # regex whitelist
sudo sqlite3 /etc/pihole/gravity.db "delete from domainlist where type=3;" # regex blacklist
sudo sqlite3 /etc/pihole/gravity.db "delete from adlist where enabled=0;"  # disabled adlists
sudo sqlite3 /etc/pihole/gravity.db "delete from adlist where enabled=1;"  # enabled adlists

Set new ad-lists:

sudo nano /etc/pihole-updatelists.conf
ADLISTS_URL="https://raw.githubusercontent.com/denis-g/rpi4-pihole-settings/master/adlist.txt"
WHITELIST_URL="https://raw.githubusercontent.com/EnergizedProtection/unblock/master/basic/formats/domains.txt https://raw.githubusercontent.com/anudeepND/whitelist/master/domains/whitelist.txt https://raw.githubusercontent.com/denis-g/rpi4-pihole-settings/master/whitelist.txt"
REGEX_WHITELIST_URL="https://raw.githubusercontent.com/denis-g/rpi4-pihole-settings/master/whitelist_regex.txt"
BLACKLIST_URL="https://raw.githubusercontent.com/denis-g/rpi4-pihole-settings/master/blacklist.txt"
REGEX_BLACKLIST_URL="https://raw.githubusercontent.com/mmotti/pihole-regex/master/regex.list https://raw.githubusercontent.com/denis-g/rpi4-pihole-settings/master/blacklist_regex.txt"

🔹 DNSCrypt

Install

Copy URL to latest ARM release from this page:

sudo wget https://github.com/DNSCrypt/dnscrypt-proxy/releases/download/2.1.0/dnscrypt-proxy-linux_arm-2.1.0.tar.gz
sudo tar -xvzf ./dnscrypt-proxy-linux_arm-2.1.0.tar.gz
sudo rm dnscrypt-proxy-linux_arm-2.1.0.tar.gz

sudo mv ./linux-arm ./dnscrypt-proxy
sudo cp ./dnscrypt-proxy/example-dnscrypt-proxy.toml ./dnscrypt-proxy/dnscrypt-proxy.toml

Configuration

Set servers and port for service:

sudo nano ./dnscrypt-proxy/dnscrypt-proxy.toml
server_names = ['cloudflare-family', 'cloudflare']

# don't use 53 or 5353 port
listen_addresses = ['127.0.0.1:54']

Install and start service:

sudo ./dnscrypt-proxy/dnscrypt-proxy -service install && \
sudo ./dnscrypt-proxy/dnscrypt-proxy -service start

Set service as custom DNS on Pi-hole admin panel - Settings > DNS:

Custom 1 (IPv4):
127.0.0.1#54

🔹 Update system

sudo apt update && \
sudo apt upgrade && \
sudo apt clean && \
sudo apt autoclean && \
sudo apt autoremove && \
sudo pihole-updatelists --update && \
sudo pihole-updatelists && \
sudo pihole -up && \
sudo rpi-update && \
sudo reboot

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Raspberry Pi (7,342) 
Boilerplate (5,663) 
Settings (512) 
Rpi (450) 
Pi Hole (367) 
Related Projects
Advertising 📦 9
All Projects
Application Programming Interfaces 📦 120
Applications 📦 181
Artificial Intelligence 📦 72
Blockchain 📦 70
Build Tools 📦 111
Cloud Computing 📦 79
Code Quality 📦 28
Collaboration 📦 30
Command Line Interface 📦 48
Community 📦 81
Companies 📦 60
Compilers 📦 60
Computer Science 📦 74
Configuration Management 📦 39
Content Management 📦 167
Control Flow 📦 197
Data Formats 📦 77
Data Processing 📦 266
Data Storage 📦 132
Economics 📦 60
Frameworks 📦 198
Games 📦 122
Graphics 📦 103
Hardware 📦 148
Integrated Development Environments 📦 47
Learning Resources 📦 147
Legal 📦 28
Libraries 📦 119
Lists Of Projects 📦 21
Machine Learning 📦 336
Mapping 📦 61
Marketing 📦 15
Mathematics 📦 55
Media 📦 228
Messaging 📦 97
Networking 📦 304
Operating Systems 📦 84
Operations 📦 120
Package Managers 📦 52
Programming Languages 📦 229
Runtime Environments 📦 96
Science 📦 42
Security 📦 375
Social Media 📦 26
Software Architecture 📦 70
Software Development 📦 68
Software Performance 📦 57
Software Quality 📦 127
Text Editors 📦 45
Text Processing 📦 131
User Interface 📦 310
User Interface Components 📦 465
Version Control 📦 29
Virtualization 📦 68
Web Browsers 📦 38
Web Servers 📦 25
Web User Interface 📦 194