Arch Linux ARM Install Pi-Hole On A Raspberry Pi¶
Note
Pi-Hole is not officially supported on the Arch Linux operating system.
Prerequisites¶
- Installed and configured Arch Linux Arm operating system
- Set a static IP address via DHCP or statically on the device
-
Installed Arch Linux Install Aur Helper
Note
Required to install package "pi-hole-server".
Environment¶
- Tested on to a Raspberry Pi 2 Model B
- Using Nginx to serve Pi-Hole's web interface
- Using pi-hole-server package for local area network (LAN)
Install Pi-Hole¶
-
Install required packages.
# pikaur -Syu pi-hole-server nginx-mainline php-fpm php-sqlite inetutils
Info
Pi-Hole Chronometer (pihole -c) utilizes the command "hostname" and therefore the package "inetutils" is required.
-
Set Pi-Hole web interface administrator password.
# pihole -a -p
- Enable PHP required extensions.
# nano /etc/php/php.ini
extension=curl extension=pdo_sqlite extension=sockets extension=sqlite3
-
Set PHP read permissions.
With the use of PHP v7.0 or newer, the PHP open_basedir directive defaults to empty. This means that PHP can therefore access every directory and file that can be read by the web server's user ID. For best security practice, the open_basedir directive will be intentionally set for the Pi-hole administrative web interface.
$ nano /etc/php/php.ini
1. Create Nginx directory for site config.open_basedir = /srv/http/pihole:/run/pihole-ftl/pihole-FTL.port:/run/log/pihole/pihole.log:/run/log/pihole-ftl/pihole-FTL.log:/etc/pihole:/etc/hosts:/etc/hostname:/etc/dnsmasq.d/02-pihole-dhcp.conf:/etc/dnsmasq.d/03-pihole-wildcard.conf:/etc/dnsmasq.d/04-pihole-static-dhcp.conf:/var/log/lighttpd/error-pihole.log:/proc/loadavg:/proc/meminfo:/proc/cpuinfo:/sys/class/thermal/thermal_zone0/temp:/tmp
1. Set Nginx general settings.# mkdir /etc/nginx/conf.d
# nano /etc/nginx/nginx.conf
1. Create Nginx site config.worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; gzip on; gzip_min_length 1000; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain application/xml application/json application/javascript application/octet-stream text/css; include /etc/nginx/conf.d/*.conf; }
1. Edit Nginx site config and change fastcgi_pass.# cp /usr/share/pihole/configs/nginx.example.conf /etc/nginx/conf.d/pi-hole.conf
# nano /etc/nginx/conf.d/pi-hole.conf
1. Set system hosts correctly.fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
# nano /etc/hosts
1. Stop and disable "systemd-resolved.service".127.0.0.1 localhost ip.address.of.pihole pi.hole myhostname
# systemctl stop systemd-resolved.service # systemctl disable systemd-resolved.service
Note
This is done because port 53 is used by "systemd-resolved.service" which will conflict with "pihole-FTL.service" port 53.
-
Set php-fpm.service overrides.
# systemctl edit php-fpm.service
### Anything between here and the comment below will become the new contents of the file [Service] ReadWritePaths = /srv/http/pihole ReadWritePaths = /run/pihole-ftl/pihole-FTL.port ReadWritePaths = /run/log/pihole/pihole.log ReadWritePaths = /run/log/pihole-ftl/pihole-FTL.log ReadWritePaths = /etc/pihole ReadWritePaths = /etc/hosts ReadWritePaths = /etc/hostname ReadWritePaths = /etc/dnsmasq.d/01-pihole.conf ReadWritePaths = /proc/meminfo ReadWritePaths = /proc/cpuinfo ReadWritePaths = /sys/class/thermal/thermal_zone0/temp ReadWritePaths = /tmp ### Lines below this comment will be discarded
Note
This step is required to grant Pi-Hole web interface access to the necessary files/directories.
-
Enable web services.
# systemctl enable nginx.service # systemctl enable php-fpm.service
- Start web services.
# systemctl start nginx.service # systemctl start php-fpm.service
- Start Pi-hole services.
$ pihole restartdns