Skip to content

Instantly share code, notes, and snippets.

@jniltinho
Last active September 6, 2024 12:56
Show Gist options
  • Save jniltinho/7ef1c3e13e5d2789b53a161e21b8ad17 to your computer and use it in GitHub Desktop.
Save jniltinho/7ef1c3e13e5d2789b53a161e21b8ad17 to your computer and use it in GitHub Desktop.
Install PowerDNS Ubuntu
#!/bin/bash
#
# https://www.howtoforge.com/how-to-install-powerdns-on-ubuntu-22-04/
# https://www.cloudwizard.nl/powerdns-part-1-master-server-installation-ubuntu/
# https://sempreupdate.com.br/linux/tutoriais/como-instalar-o-powerdns-e-o-powerdns-admin-no-ubuntu/
# https://kifarunix.com/install-and-setup-powerdns-admin-on-ubuntu-22-04/
# https://www.reddit.com/r/dns/comments/yzxk12/independent_powerdns_authoritative_and_two/
# https://gist.github.com/maxivak/1daa03229493e22a7263c83dd52af76f (pdns-recursor)
apt update
apt dist-upgrade
apt install -y mariadb-server
apt install -y pdns-server pdns-backend-mysql
systemctl disable --now systemd-resolved
rm -rf /etc/resolv.conf
echo "nameserver 8.8.8.8" > /etc/resolv.conf
cat <<EOF > /tmp/user_pdns.sql
CREATE DATABASE pdns;
GRANT ALL ON pdns.* TO pdnsadmin@localhost identified by 'password';
EOF
mysql -p < /tmp/user_pdns.sql
mysql -u pdnsadmin -p pdns < /usr/share/pdns-backend-mysql/schema/schema.mysql.sql
cat <<EOF > /etc/powerdns/pdns.d/pdns.local.gmysql.conf
# MySQL Configuration
# Launch gmysql backend
launch+=gmysql
# gmysql parameters
gmysql-host=127.0.0.1
gmysql-port=3306
gmysql-dbname=pdns
gmysql-user=pdnsadmin
gmysql-password=password
gmysql-dnssec=yes
# gmysql-socket=
EOF
chmod 640 /etc/powerdns/pdns.d/pdns.local.gmysql.conf
chown pdns:pdns /etc/powerdns/pdns.d/pdns.local.gmysql.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment