pihole-install.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. systemctl stop systemd-resolved
  22. echo "DNSStubListener=no" >>/etc/systemd/resolved.conf
  23. ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
  24. mkdir -p /etc/pihole/
  25. cat <<EOF >/etc/pihole/setupVars.conf
  26. PIHOLE_INTERFACE=eth0
  27. PIHOLE_DNS_1=8.8.8.8
  28. PIHOLE_DNS_2=8.8.4.4
  29. QUERY_LOGGING=true
  30. INSTALL_WEB_SERVER=true
  31. INSTALL_WEB_INTERFACE=true
  32. LIGHTTPD_ENABLED=true
  33. CACHE_SIZE=10000
  34. DNS_FQDN_REQUIRED=true
  35. DNS_BOGUS_PRIV=true
  36. DNSMASQ_LISTENING=local
  37. WEBPASSWORD=$(openssl rand -base64 48)
  38. BLOCKING_ENABLED=true
  39. EOF
  40. $STD bash <(curl -fsSL https://install.pi-hole.net) /dev/stdin --unattended
  41. msg_ok "Installed Pi-hole"
  42. motd_ssh
  43. root
  44. msg_info "Cleaning up"
  45. $STD apt-get autoremove
  46. $STD apt-get autoclean
  47. msg_ok "Cleaned"