#!/bin/bash
# Install PowerDNS and PowerDNS Admin web GUI
ROOT_MYSQL_PASSWORD="penguin"
POWER_DNS_MYSQL_PASSWORD="penguin"
POWERDNS_VERSION="3.8.1"
URL_FOR_POWERDNS="https://codeload.github.com/poweradmin/poweradmin/tar.gz/refs/tags/v$POWERDNS_VERSION"
domain_name="tuxmail.io"
wireguard_static_ip=94.158.244.150
time_zone="America/New_York"
zone_info="US/Eastern"
# Set a time zone
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
ln -fs /usr/share/zoneinfo/$zone_info /etc/localtime
echo "$time_zone" > /etc/timezone
# Systemd's resolver interferes with PowerDNS so disable it
systemctl stop systemd-resolved
systemctl disable systemd-resolved
# Switch to Quad9's DNS server
echo nameserver 9.9.9.9 > /etc/resolv.conf
# Install mysql if not installed
apt update
apt install apache2 mariadb-server -y
# Sere mysql
script -q -c 'mysql_secure_installation' < "/etc/apache2/sites-enabled/powerdns.conf"
ServerName powerdns.$domain_name
DocumentRoot /var/www/powerdns
Options FollowSymLinks
AllowOverride All
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
EOF
# Restart apache2
systemctl restart apache2