pi-hole

by kschildmann
15 deployments · 13 still active · last rev. 5 months ago

Installs Pi-Hole.
Default password: "password"
Change password with: "pihole -a -p"

Compatible with: CentOS 7, Debian 8, Debian 9, Ubuntu 16.04 LTS, Ubuntu 18.04 LTS, Ubuntu 18.10, Ubuntu 14.04 LTS
						#!/bin/bash

# Pi-Hole setupVars.conf Variables
PIHOLE_INTERFACE="$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')"
IPV4_ADDRESS="$(ip -4 address ls | grep inet | grep global | grep -Po '(?<=inet )(\S+)')"
IPV6_ADDRESS="$(ip -6 address ls | grep inet | grep global | grep -Po '(?<=inet6 )(\S+)')"
QUERY_LOGGING=true
INSTALL_WEB_SERVER=true
INSTALL_WEB_INTERFACE=true
LIGHTTPD_ENABLED=true
BLOCKING_ENABLED=true
DNSMASQ_LISTENING=single
PIHOLE_DNS_1=1.1.1.1
PIHOLE_DNS_2=1.0.0.1
PIHOLE_DNS_3=2606:4700:4700::1111
PIHOLE_DNS_4=2606:4700:4700::1001
DNS_FQDN_REQUIRED=true
DNS_BOGUS_PRIV=true
DNSSEC=false
CONDITIONAL_FORWARDING=false
WEBPASSWORD=113459eb7bb31bddee85ade5230d6ad5d8b2fb52879e00a84ff6ae1067a210d3

# Create pihole directory
sudo mkdir /etc/pihole

# Write variables to setupVars.conf file
sudo echo -e "PIHOLE_INTERFACE=$PIHOLE_INTERFACE\nIPV4_ADDRESS=$IPV4_ADDRESS\nIPV6_ADDRESS=$IPV6_ADDRESS\nQUERY_LOGGING=$QUERY_LOGGING\nINSTALL_WEB_SERVER=$INSTALL_WEB_SERVER\nINSTALL_WEB_INTERFACE=$INSTALL_WEB_INTERFACE\nLIGHTTPD_ENABLED=$LIGHTTPD_ENABLED\nBLOCKING_ENABLED=$BLOCKING_ENABLED\nDNSMASQ_LISTENING=$DNSMASQ_LISTENING\nPIHOLE_DNS_1=$PIHOLE_DNS_1\nPIHOLE_DNS_2=$PIHOLE_DNS_2\nPIHOLE_DNS_3=$PIHOLE_DNS_3\nPIHOLE_DNS_4=$PIHOLE_DNS_4\nDNS_FQDN_REQUIRED=$DNS_FQDN_REQUIRED\nDNS_BOGUS_PRIV=$DNS_BOGUS_PRIV\nDNSSEC=$DNSSEC\nCONDITIONAL_FORWARDING=$CONDITIONAL_FORWARDING\nWEBPASSWORD=$WEBPASSWORD" >> /etc/pihole/setupVars.conf 

# Download basic.-install.sh from https://install.pi-hole.net
wget -O /tmp/basic-install.sh https://install.pi-hole.net
chmod +x /tmp/basic-install.sh

# Run pi-hole unattended installation
sudo /tmp/basic-install.sh --unattended

exit