pihole-install.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2021-2023 tteck
  3. # Author: tteck (tteckster)
  4. # License: MIT
  5. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  6. source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
  7. color
  8. verb_ip6
  9. catch_errors
  10. setting_up_container
  11. network_check
  12. update_os
  13. msg_info "Installing Dependencies"
  14. $STD apt-get install -y curl
  15. $STD apt-get install -y sudo
  16. $STD apt-get install -y mc
  17. $STD apt-get install -y ufw
  18. $STD apt-get install -y ntp
  19. msg_ok "Installed Dependencies"
  20. msg_info "Installing Pi-hole"
  21. mkdir -p /etc/pihole/
  22. cat <<EOF >/etc/pihole/setupVars.conf
  23. PIHOLE_INTERFACE=eth0
  24. PIHOLE_DNS_1=8.8.8.8
  25. PIHOLE_DNS_2=8.8.4.4
  26. QUERY_LOGGING=true
  27. INSTALL_WEB_SERVER=true
  28. INSTALL_WEB_INTERFACE=true
  29. LIGHTTPD_ENABLED=true
  30. CACHE_SIZE=10000
  31. DNS_FQDN_REQUIRED=true
  32. DNS_BOGUS_PRIV=true
  33. DNSMASQ_LISTENING=local
  34. WEBPASSWORD=$(openssl rand -base64 48)
  35. BLOCKING_ENABLED=true
  36. EOF
  37. # View script https://install.pi-hole.net
  38. $STD bash <(curl -fsSL https://install.pi-hole.net) --unattended
  39. msg_ok "Installed Pi-hole"
  40. motd_ssh
  41. customize
  42. msg_info "Cleaning up"
  43. $STD apt-get autoremove
  44. $STD apt-get autoclean
  45. msg_ok "Cleaned"