{"id":11016,"date":"2021-11-28T10:27:58","date_gmt":"2021-11-28T07:27:58","guid":{"rendered":"https:\/\/kifarunix.com\/?p=11016"},"modified":"2024-03-18T08:03:43","modified_gmt":"2024-03-18T05:03:43","slug":"easily-install-powerdns-admin-on-debian-11-debian-10","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/easily-install-powerdns-admin-on-debian-11-debian-10\/","title":{"rendered":"Easily Install PowerDNS Admin on Debian 11\/Debian 10"},"content":{"rendered":"\n
In this tutorial, you will learn how to easily install PowerDNS Admin on Debian 11\/Debian 10. PowerDNS Admin<\/a> is a web administrative interface for PowerDNS. It enables you to easily create and manage DNS zones from a web browser.<\/p>\n\n\n\n PowerDNS Admin provides advanced features for managing PowerDNS. These include;<\/p>\n\n\n\n Follow the link below to install PowerDNS on Debian 11\/Debain 10:<\/p>\n\n\n\n Easily Install and Setup PowerDNS on Debian 11\/Debian 10<\/a><\/p>\n\n\n\n NOTE: We installed PowerDNS Admin on the same server with PowerDNS already installed.<\/p>\n\n\n\n Install Python 3 library and development tools<\/p>\n\n\n\n Install various required build tools and package dependencies.<\/p>\n\n\n\n Install NodeJS on Debian 10\/Debian 11;<\/p>\n\n\n\n Install Yarn on Debian 11\/Debian 10<\/p>\n\n\n\n Install Nginx HTTP Server Debian 10\/Debian 11<\/p>\n\n\n\n Clone PowerDNS Admin git source code to your Nginx web root directory.<\/p>\n\n\n\n In this setup, we use, Navigate to the PowerDNS Admin web root directory and create a virtualenv.<\/p>\n\n\n\n Next, active your Python 3 Virtual environment and install required Python 3 libraries<\/p>\n\n\n\n Exit the virtualenv.<\/p>\n\n\n\n Edit the default PowerDNS admin configuration file, Replace the $WEB_ROOT with the path to your web root directory.<\/p>\n\n\n\n On the basic App configs, you can replace the SALT and SECRET_KEY keys, set the bind address and port;<\/p>\n\n\n\n On the database configs, configure your PowerDNS database connection details. Note that we are using the details already created while setting up PowerDNS as defined in our guide<\/a>.<\/p>\n\n\n\n Save and exit the configuration.<\/p>\n\n\n\n Next, reactivate the virtualenv run the DB migration;<\/p>\n\n\n\n Once the command above completes, generate asset files with yarn;<\/p>\n\n\n\n Deactivate virtual environment.<\/p>\n\n\n\n Once it is setup, you can run PowerDNS admin in standalone mode, by executing the In this setup, we will be using Nginx web server to access the PowerDNS Admin.<\/p>\n\n\n\n \u201cThe PowerDNS Authoritative Server features a built-in webserver that exposes a JSON\/REST API. This API allows for controlling several functions, reading statistics and modifying zone content, metadata and DNSSEC key material<\/em>\u201c.<\/p>\n\n\n\n Save and exit the file and restart PowerDNS;<\/p>\n\n\n\n Create PowerDNS Admin Nginx site with the contents below. Replace web root directory accordingly.<\/p>\n\n\n\n Save and exit the file.<\/p>\n\n\n\n Remove the default Nginx default site.<\/p>\n\n\n\n Run config syntax check.<\/p>\n\n\n\n Set ownership of Pdns Admin web root directory to web user;<\/p>\n\n\n\n Restart Nginx;<\/p>\n\n\n\n To be able to run PowerDNS Admin as a systemd service, create a unit file by running the command below;<\/p>\n\n\n\n Reload System Configurations and start and enable PowerDNS Admin service to run on system boot;<\/p>\n\n\n\n Check the status;<\/p>\n\n\n\n Open Nginx on firewall to allow external access;<\/p>\n\n\n\n As per our configuration above, you can access PowerDNS Admin web interface via the address Click Create an account<\/strong> to create the very first PowerDNS Admin admin user. Enter the user details.<\/p>\n\n\n\n Click Register<\/strong> to create an account.<\/p>\n\n\n\n After that, login using the user details you provided. Upon successful login, you should land on PowerDNS Admin interface.<\/p>\n\n\n\n You will see an error asking you to complete the API setup.<\/p>\n\n\n\n For PowerDNS Admin to be able to connect to PowerDNS and manage it, you need to provide:<\/p>\n\n\n\n Click Update<\/strong> and the error should just disappear.<\/p>\n\n\n\n Click on the Dashboard<\/strong> to go to PowerDNS Admin dashboard.<\/p>\n\n\n\n As you can see, we already added the DNS records in our previous guide.<\/p>\n\n\n\n If you click on the domain name under Hosted Domains<\/strong> (highlighted on the screenshot above), you should the records we already added;<\/p>\n\n\n\n That is the forward zone records.<\/p>\n\n\n\n If you click on the reverse zone under the Dashboard<\/strong> > Hosted Domains in-addr<\/strong>, you should see the reverse zone records.<\/p>\n\n\n\n You can now manage your DNS records easily.<\/p>\n\n\n\n That concludes our tutorial.<\/p>\n\n\n\n Easily Install and Setup PowerDNS Admin on Ubuntu 20.04<\/a><\/p>\n\n\n\n Easily Install and Setup PowerDNS on Ubuntu 20.04<\/a><\/p>\n\n\n\n\n
Installing PowerDNS Admin on Debian 11\/Debian 10<\/h2>\n\n\n\n
Install and Setup PowerDNS on Debian 11\/Debian 10<\/h3>\n\n\n\n
Install Required Package Dependencies<\/h3>\n\n\n\n
apt install python3-dev<\/code><\/pre>\n\n\n\n
apt install libsasl2-dev libldap2-dev libssl-dev libxml2-dev libxslt1-dev libxmlsec1-dev libffi-dev pkg-config apt-transport-https virtualenv build-essential libmariadb-dev git python3-flask -y<\/code><\/pre>\n\n\n\n
apt install curl sudo git -y<\/code><\/pre>\n\n\n\n
curl -sL https:\/\/deb.nodesource.com\/setup_17.x | sudo -E bash -<\/code><\/pre>\n\n\n\n
apt install -y nodejs<\/code><\/pre>\n\n\n\n
curl -sL https:\/\/dl.yarnpkg.com\/debian\/pubkey.gpg | gpg --dearmor | sudo tee \/usr\/share\/keyrings\/yarnkey.gpg >\/dev\/null<\/code><\/pre>\n\n\n\n
echo \"deb [signed-by=\/usr\/share\/keyrings\/yarnkey.gpg] https:\/\/dl.yarnpkg.com\/debian stable main\" | sudo tee \/etc\/apt\/sources.list.d\/yarn.list<\/code><\/pre>\n\n\n\n
apt update\napt install yarn -y<\/code><\/pre>\n\n\n\n
apt install nginx -y<\/code><\/pre>\n\n\n\n
Clone PowerDNS Admin Source Code to Web Root Directory<\/h3>\n\n\n\n
\/var\/www\/html\/pdns<\/strong><\/code>, as our PowerDNS Admin web root directory. It can be different for your case.<\/p>\n\n\n\n
git clone https:\/\/github.com\/ngoduykhanh\/PowerDNS-Admin.git \/var\/www\/html\/pdns<\/code><\/pre>\n\n\n\n
Create PowerDNS Admin Virtualenv<\/h3>\n\n\n\n
cd \/var\/www\/html\/pdns\/<\/code><\/pre>\n\n\n\n
virtualenv -p python3 flask<\/code><\/pre>\n\n\n\n
source .\/flask\/bin\/activate<\/code><\/pre>\n\n\n\n
pip install -r requirements.txt<\/code><\/pre>\n\n\n\n
Configure PowerDNS Admin Database Connection<\/h3>\n\n\n\n
deactivate<\/code><\/pre>\n\n\n\n
$WEB_ROOT\/powerdnsadmin\/default_config.py<\/code>, to define the database connection details.<\/p>\n\n\n\n
vim \/var\/www\/html\/pdns\/powerdnsadmin\/default_config.py<\/code><\/pre>\n\n\n\n
\n### BASIC APP CONFIG\nSALT = 'xohDoozee8Zuneekooch9ohrieghei'\nSECRET_KEY = 'hohru1aethaeyahpheH7Gaathaikah'\nBIND_ADDRESS = '192.168.58.22'\nPORT = 9191\nHSTS_ENABLED = False\nOFFLINE_MODE = False\n<\/code><\/pre>\n\n\n\n
\n### DATABASE CONFIG\nSQLA_DB_USER = 'pdnsadmin'\nSQLA_DB_PASSWORD = 'PdnSPassW0rd'\nSQLA_DB_HOST = '127.0.0.1'\nSQLA_DB_NAME = 'kifarunixdemopdns'\nSQLALCHEMY_TRACK_MODIFICATIONS = True\n<\/code><\/pre>\n\n\n\n
cd \/var\/www\/html\/pdns\/<\/code><\/pre>\n\n\n\n
source .\/flask\/bin\/activate<\/code><\/pre>\n\n\n\n
export FLASK_APP=powerdnsadmin\/__init__.py<\/code><\/pre>\n\n\n\n
flask db upgrade<\/code><\/pre>\n\n\n\n
yarn install --pure-lockfile<\/code><\/pre>\n\n\n\n
flask assets build<\/code><\/pre>\n\n\n\n
deactivate<\/code><\/pre>\n\n\n\n
Running PowerDNS Admin<\/h3>\n\n\n\n
run.py<\/strong><\/code> in the web root directory.<\/p>\n\n\n\n
Enable PowerDNS API access<\/h4>\n\n\n\n
\n
vim \/etc\/powerdns\/pdns.conf<\/code><\/pre>\n\n\n\n
\n#################################\n# api Enable\/disable the REST API (including HTTP listener)\n#\n# api=no\napi=yes\n\n#################################\n# api-key Static pre-shared authentication key for access to the REST API\n#\n# api-key=\napi-key=ahqu4eiv2vaideep8AQu9nav5Aing0\n<\/code><\/pre>\n\n\n\n
systemctl restart pdns<\/code><\/pre>\n\n\n\n
Create PowerDNS Admin Nginx Site<\/h4>\n\n\n\n
vim \/etc\/nginx\/conf.d\/pdns-admin.conf<\/code><\/pre>\n\n\n\n
\nserver {\n listen\t*:80;\n server_name pdnsadmin.kifarunix-demo.com;\n\n index index.html index.htm index.php;\n root \/var\/www\/html\/pdns;\n access_log \/var\/log\/nginx\/pdnsadmin_access.log combined;\n error_log \/var\/log\/nginx\/pdnsadmin_error.log;\n\n client_max_body_size 10m;\n client_body_buffer_size 128k;\n proxy_redirect off;\n proxy_connect_timeout 90;\n proxy_send_timeout 90;\n proxy_read_timeout 90;\n proxy_buffers 32 4k;\n proxy_buffer_size 8k;\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n proxy_headers_hash_bucket_size 64;\n\n location ~ ^\/static\/ {\n include \/etc\/nginx\/mime.types;\n root \/var\/www\/html\/pdns\/powerdnsadmin;\n\n location ~* \\.(jpg|jpeg|png|gif)$ {\n expires 365d;\n }\n\n location ~* ^.+.(css|js)$ {\n expires 7d;\n }\n }\n\n location \/ {\n proxy_pass http:\/\/unix:\/run\/pdnsadmin\/socket;\n proxy_read_timeout 120;\n proxy_connect_timeout 120;\n proxy_redirect off;\n }\n\n}\n<\/code><\/pre>\n\n\n\n
mv \/etc\/nginx\/sites-enabled\/default{,.old}<\/code><\/pre>\n\n\n\n
nginx -t<\/code><\/pre>\n\n\n\n
nginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/code><\/pre>\n\n\n\n
chown -R www-data: \/var\/www\/html\/pdns<\/code><\/pre>\n\n\n\n
systemctl restart nginx<\/code><\/pre>\n\n\n\n
Create PowerDNS Admin Systemd Service Unit<\/h3>\n\n\n\n
\ncat > \/etc\/systemd\/system\/pdnsadmin.service << 'EOL' \n[Unit]\nDescription=PowerDNS-Admin\nRequires=pdnsadmin.socket\nAfter=network.target\n\n[Service]\nPIDFile=\/run\/pdnsadmin\/pid\nUser=pdns\nGroup=pdns\nWorkingDirectory=\/var\/www\/html\/pdns\nExecStart=\/var\/www\/html\/pdns\/flask\/bin\/gunicorn --pid \/run\/pdnsadmin\/pid --bind unix:\/run\/pdnsadmin\/socket 'powerdnsadmin:create_app()'\nExecReload=\/bin\/kill -s HUP $MAINPID\nExecStop=\/bin\/kill -s TERM $MAINPID\nPrivateTmp=true\n\n[Install]\nWantedBy=multi-user.target\nEOL\n<\/code><\/pre>\n\n\n\n
\ncat > \/etc\/systemd\/system\/pdnsadmin.socket << 'EOL'\n[Unit]\nDescription=PowerDNS-Admin socket\n\n[Socket]\nListenStream=\/run\/pdnsadmin\/socket\n\n[Install]\nWantedBy=sockets.target\nEOL\n<\/code><\/pre>\n\n\n\n
echo \"d \/run\/pdnsadmin 0755 pdns pdns -\" >> \/etc\/tmpfiles.d\/pdnsadmin.conf<\/code><\/pre>\n\n\n\n
mkdir \/run\/pdnsadmin\/<\/code><\/pre>\n\n\n\n
chown -R pdns: \/run\/pdnsadmin\/<\/code><\/pre>\n\n\n\n
chown -R pdns: \/var\/www\/html\/pdns\/powerdnsadmin\/<\/code><\/pre>\n\n\n\n
systemctl enable --now pdnsadmin.service pdnsadmin.socket<\/code><\/pre>\n\n\n\n
systemctl status pdnsadmin.service pdnsadmin.socket<\/code><\/pre>\n\n\n\n
\n\u25cf pdnsadmin.service - PowerDNS-Admin\n Loaded: loaded (\/etc\/systemd\/system\/pdnsadmin.service; enabled; vendor preset: enabled)\n Active: active (running) since Sun 2021-11-28 02:00:51 EST; 10s ago\n Main PID: 13859 (gunicorn)\n Tasks: 2 (limit: 2359)\n Memory: 65.7M\n CGroup: \/system.slice\/pdnsadmin.service\n \u251c\u250013859 \/var\/www\/html\/pdns\/flask\/bin\/python3 \/var\/www\/html\/pdns\/flask\/bin\/gunicorn --pid \/run\/pdnsadmin\/pid --bind unix:\/run\/pdnsadmin\/socket powerdnsadmin:creat\n \u2514\u250013862 \/var\/www\/html\/pdns\/flask\/bin\/python3 \/var\/www\/html\/pdns\/flask\/bin\/gunicorn --pid \/run\/pdnsadmin\/pid --bind unix:\/run\/pdnsadmin\/socket powerdnsadmin:creat\n\nNov 28 02:00:51 debian systemd[1]: Started PowerDNS-Admin.\nNov 28 02:00:51 debian gunicorn[13859]: [2021-11-28 02:00:51 -0500] [13859] [INFO] Starting gunicorn 20.0.4\nNov 28 02:00:51 debian gunicorn[13859]: [2021-11-28 02:00:51 -0500] [13859] [INFO] Listening at: unix:\/run\/pdnsadmin\/socket (13859)\nNov 28 02:00:51 debian gunicorn[13859]: [2021-11-28 02:00:51 -0500] [13859] [INFO] Using worker: sync\nNov 28 02:00:51 debian gunicorn[13859]: [2021-11-28 02:00:51 -0500] [13862] [INFO] Booting worker with pid: 13862\n\n\u25cf pdnsadmin.socket - PowerDNS-Admin socket\n Loaded: loaded (\/etc\/systemd\/system\/pdnsadmin.socket; enabled; vendor preset: enabled)\n Active: active (running) since Sun 2021-11-28 02:00:51 EST; 10s ago\n Listen: \/run\/pdnsadmin\/socket (Stream)\n CGroup: \/system.slice\/pdnsadmin.socket\n\nNov 28 02:00:51 debian systemd[1]: Listening on PowerDNS-Admin socket.\n<\/code><\/pre>\n\n\n\n
Accessing PowerDNS Admin Web Interface<\/h3>\n\n\n\n
ufw allow \"Nginx Full\"<\/code><\/pre>\n\n\n\n
http:\/\/server-hostname<\/strong><\/code>. You should be able to see the PowerDNS Admin login screen. (if not, check status of the PowerDNS admin service or Nginx error logs for hints<\/em><\/strong>).<\/p>\n\n\n
<\/figure><\/div>\n\n\n
Create PowerDNS Admin administrative user account<\/h4>\n\n\n\n
<\/figure>\n\n\n\n
\n
http:\/\/127.0.0.1:8081<\/code><\/strong> by default<\/li>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
Other tutorials<\/h3>\n\n\n\n