2015-06-14 03:14:21 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Pi-hole automated install
|
|
|
|
# Raspberry Pi Ad-blocker
|
|
|
|
#
|
|
|
|
# Install with this command (from the Pi):
|
|
|
|
#
|
|
|
|
# curl -s "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/automated%20install/basic-install.sh" | bash
|
|
|
|
#
|
|
|
|
# Or run the commands below in order
|
|
|
|
|
|
|
|
clear
|
|
|
|
echo " _____ _ _ _ "
|
|
|
|
echo " | __ (_) | | | | "
|
|
|
|
echo " | |__) | __ | |__ ___ | | ___ "
|
|
|
|
echo " | ___/ | |__| | '_ \ / _ \| |/ _ \ "
|
|
|
|
echo " | | | | | | | | (_) | | __/ "
|
|
|
|
echo " |_| |_| |_| |_|\___/|_|\___| "
|
|
|
|
echo " "
|
|
|
|
echo " Raspberry Pi Ad-blocker "
|
|
|
|
echo " "
|
|
|
|
echo "Set a static IP before running this!"
|
|
|
|
echo " "
|
|
|
|
echo " Press Enter when ready "
|
|
|
|
echo " "
|
|
|
|
read
|
|
|
|
|
2015-06-21 12:50:02 +00:00
|
|
|
if [[ -f /etc/dnsmasq.d/adList.conf ]];then
|
|
|
|
echo "Original Pi-hole detected. Initiating sub space transport..."
|
|
|
|
sudo mkdir -p /etc/pihole/original/
|
2015-09-22 20:11:30 +00:00
|
|
|
sudo mv /etc/dnsmasq.d/adList.conf /etc/pihole/original/adList.conf.$(date "+%Y-%m-%d")
|
|
|
|
sudo mv /etc/dnsmasq.conf /etc/pihole/original/dnsmasq.conf.$(date "+%Y-%m-%d")
|
|
|
|
sudo mv /etc/resolv.conf /etc/pihole/original/resolv.conf.$(date "+%Y-%m-%d")
|
|
|
|
sudo mv /etc/lighttpd/lighttpd.conf /etc/pihole/original/lighttpd.conf.$(date "+%Y-%m-%d")
|
|
|
|
sudo mv /var/www/pihole/index.html /etc/pihole/original/index.html.$(date "+%Y-%m-%d")
|
|
|
|
sudo mv /usr/local/bin/gravity.sh /etc/pihole/original/gravity.sh.$(date "+%Y-%m-%d")
|
2015-06-21 12:50:02 +00:00
|
|
|
else
|
|
|
|
:
|
|
|
|
fi
|
|
|
|
|
2015-06-14 03:14:21 +00:00
|
|
|
echo "Updating the Pi..."
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get -y upgrade
|
|
|
|
|
2015-09-22 20:10:33 +00:00
|
|
|
echo "Installing tools..."
|
2015-10-05 21:58:15 +00:00
|
|
|
sudo apt-get -y install dnsutils
|
2015-09-22 20:10:33 +00:00
|
|
|
sudo apt-get -y install bc
|
2015-09-22 20:13:16 +00:00
|
|
|
sudo apt-get -y install toilet
|
|
|
|
|
2015-06-14 03:14:21 +00:00
|
|
|
echo "Installing DNS..."
|
|
|
|
sudo apt-get -y install dnsmasq
|
|
|
|
sudo update-rc.d dnsmasq enable
|
|
|
|
|
|
|
|
echo "Installing a Web server"
|
2015-10-27 21:16:22 +00:00
|
|
|
sudo apt-get -y install lighttpd php5-common php5-cgi php5
|
2015-10-27 21:19:01 +00:00
|
|
|
sudo mkdir /var/www/html
|
|
|
|
sudo chown www-data:www-data /var/www/html
|
|
|
|
sudo chmod 775 /var/www/html
|
2015-06-14 03:14:21 +00:00
|
|
|
sudo usermod -a -G www-data pi
|
|
|
|
|
|
|
|
echo "Stopping services to modify them..."
|
|
|
|
sudo service dnsmasq stop
|
|
|
|
sudo service lighttpd stop
|
|
|
|
|
|
|
|
echo "Backing up original config files and downloading Pi-hole ones..."
|
|
|
|
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
|
|
|
|
sudo mv /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
|
2015-10-27 22:03:48 +00:00
|
|
|
sudo mv /var/www/html/index.lighttpd.html /var/www/html/index.lighttpd.orig
|
2015-09-22 20:10:33 +00:00
|
|
|
sudo curl -o /etc/dnsmasq.conf "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/dnsmasq.conf"
|
|
|
|
sudo curl -o /etc/lighttpd/lighttpd.conf "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/lighttpd.conf"
|
2015-10-27 21:16:22 +00:00
|
|
|
sudo lighty-enable-mod fastcgi fastcgi-php
|
2015-10-27 21:19:01 +00:00
|
|
|
sudo mkdir /var/www/html/pihole
|
|
|
|
sudo curl -o /var/www/html/pihole/index.html "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/index.html"
|
2015-06-14 03:14:21 +00:00
|
|
|
|
2015-10-27 21:21:20 +00:00
|
|
|
echo "Installing the Web interface..."
|
|
|
|
sudo wget https://github.com/jacobsalmela/AdminLTE/archive/master.zip -O /var/www/master.zip
|
|
|
|
sudo unzip /var/www/master.zip -d /var/www/html/
|
2015-10-27 22:03:48 +00:00
|
|
|
sudo mv /var/www/html/AdminLTE-master /var/www/html/admin
|
2015-10-27 21:21:20 +00:00
|
|
|
sudo rm /var/www/master.zip 2>/dev/null
|
|
|
|
sudo touch /var/log/pihole.log
|
|
|
|
sudo chmod 644 /var/log/pihole.log
|
|
|
|
sudo chown dnsmasq:root /var/log/pihole.log
|
|
|
|
|
2015-06-14 03:14:21 +00:00
|
|
|
echo "Locating the Pi-hole..."
|
2015-09-22 20:10:33 +00:00
|
|
|
sudo curl -o /usr/local/bin/gravity.sh "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/gravity.sh"
|
|
|
|
sudo curl -o /usr/local/bin/chronometer.sh "https://raw.githubusercontent.com/jacobsalmela/pi-hole/master/advanced/Scripts/chronometer.sh"
|
2015-06-14 03:14:21 +00:00
|
|
|
sudo chmod 755 /usr/local/bin/gravity.sh
|
|
|
|
sudo chmod 755 /usr/local/bin/chronometer.sh
|
|
|
|
|
|
|
|
echo "Entering the event horizon..."
|
|
|
|
sudo /usr/local/bin/gravity.sh
|
|
|
|
|
|
|
|
echo "Restarting..."
|
2015-10-24 19:55:31 +00:00
|
|
|
sudo reboot
|