How to Install and Configure ‘PowerDNS’ (with MariaDB) and ‘PowerAdmin’ in RHEL/CentOS 7

Step 2: Installing PowerAdmin to Manage PowerDNS

11. Now we will install PowerAdmin – a friendly web interface designed to manager PowerDNS servers. Since it is written in PHP, we will need to install PHP and a web server (Apache):

# yum install httpd php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mhash gettext
Install Apache PHP
Install Apache PHP

PowerAdmin also requires two PEAR packages:

# yum -y install php-pear-DB php-pear-MDB2-Driver-mysql 
Install Pear
Install Pear

You can also refer to the following article for complete instructions how to install LAMP stack in CentOS 7:

  1. Install LAMP in CentOS 7

Once the install is complete, we will need to start and set Apache to start at system boot:

# systemctl enable httpd.service
# systemctl start httpd.service
Enable Start Apache System Boot
Enable Start Apache System Boot

12. Now that all system requirements for running PowerAdmn are met, we can proceed and download the package. Since the default web directory for Apache is /var/www/html/, we will download the package in there.

# cd /var/www/html/
# wget http://downloads.sourceforge.net/project/poweradmin/poweradmin-2.1.7.tgz 
# tar xfv poweradmin-2.1.7.tgz
Download PowerAdmin
Download PowerAdmin

13. Now, we can now start the web installer of PowerAdmin. Simply open:

http://192.168.0.102/poweradmin-2.1.7/install/

This should bring the first step of the installation:

Select Installation Language
Select Installation Language

The above page will ask you to choose the language for your PowerAdmin. Select the one you wish to use and click the “Go to step 2” button.

14. The installer will expect you to have a PowerDNS database:

PowerDNS Database
PowerDNS Database

15. Since we already created one, we can proceed to the next step. You will be asked to enter the database details you setup earlier. You will also need to setup Poweradmin administrator password:

Enter PowerDNS Database Settings
Enter PowerDNS Database Settings

16. Once you have input those, go to step 4. You will create a new user with a limited rights for Poweradmin. The fields that you need to enter here are:

  1. Username – username for the PowerAdmin.
  2. Password – password for the above user.
  3. Hostmaster – When creating SOA records and you have not specified hostmaster, this value will be used.
  4. Primary nameserver – the value will be used as primary name server when creating new DNS zones.
  5. Secondary nameserver – the value will be used as primary name server when creating new DNS zones.
PowerDNS Configuration Settings
PowerDNS Configuration Settings

17. On the next step Poweradmin will ask you to create new database user with limited rights on the database tables. It will provide you with the code that you will need to put in a MySQL console:

Create New Database User
Create New Database User

18. Now open a terminal and run:

# mysql -u root -p

Provide your password and execute the code provided by Poweradmin:

MariaDB [(none)]> GRANT SELECT, INSERT, UPDATE, DELETE
ON powerdns.*
TO 'powermarin'@'localhost'
IDENTIFIED BY '123qweasd';
Grant Mysql Permissions to User
Grant Mysql Permissions to User

19. Now go back to your browser and proceed to the next step. The installer will attempt to create its configuration file in /var/www/html/poweradmin-2.1.7/inc.

The file name is config.inc.php. In case the script is not able to write that file you can create it manually by copying the text and putting it in above mentioned file:

Configuration Settings of PowerDNS
Configuration Settings of PowerDNS

20. Now go to the last page where you will be informed that the installation is complete and will receive information how to access your Poweradmin install:

PowerDNS Installation Completed
PowerDNS Installation Completed

You can enable URLs used by other dynamic DNS providers by running:

# cp install/htaccess.dist .htaccess 

For that purpose you will need to have mod_rewrite enabled in Apache’s configuration.

21. Now it is important to remove the “install” folder from Poweradmin’s root directory with the following command:

# rm -fr /var/www/html/poweradmin/install/

After that you can access your poweradmin at:

http://192.168.0.102/poweradmin-2.1.7/
PowerDNS Login
PowerDNS Login

After logging you should see the Poweradmin main page:

PowerDNS Dashboard
PowerDNS Dashboard

At this point your installation is complete and you are now ready to start managing your DNS zones.

Step 3: How to Add, Edit and Delete DNS Zones in PowerDNS

22. To add new master zone, simply click on the “Add master zone”:

Add Master Zone
Add Master Zone

On the next page there are few things that you need to fill:

  1. Domain – domain for which you will be adding the zone.
  2. Owner – sets the owner of the DNS zone.
  3. Template – DNS template – leave to none.
  4. DNSSEC – Donany Name System Security Extensions (optional -check if you need it).

Click the “Add zone” button to add the DNS zone.

Master DNS Zone
Master DNS Zone

Now you can go back to the index page of Poweradmin by clicking the “Index” link. To review all existing DNS zones simply go to “List zones”:

Check List of Zones
Check List of Zones

You should now see a list of available DNS zones:

Check List of DNS Zones
Check List of DNS Zones

23. To edit an existing DNS zone or add new records click the edit icon:

Edit DNS Zone
Edit DNS Zone

On the next page you will see the entries for the DNS zone you have chosen:

Domain DNS Zone Entries
Domain DNS Zone Entries

24. In here to add new DNS zone you will need to set the following information:

  1. Name – name for the entry. Only add the first part of the domain/subdomain, the rest will be added by Poweradmin.
  2. Type – choose the record type.
  3. Priority – priority of the record.
  4. TTL – Time To Live in seconds.

For the purpose of this article, I will add an A record for subdomain new.example.com that will resolve on IP address 192.168.0.102 with time to live 14400 seconds:

Add New DNS Record
Add New DNS Record

Finally click the “Add record” button.

25. If you wish to delete a DNS zone you can go back to the “List zone” page and click on the “Trash” icon next to the DNS zone which you wish to delete:

Delete DNS Zone
Delete DNS Zone

Poweradmin will ask you if you are sure you want to delete the DNS zone. Simply click “Yes” to finish the deletion.

For more detailed instructions how to create, edit and delete zones you can refer to Poweradmin’s documentation at:

https://github.com/poweradmin/poweradmin/wiki/Documentation

I hope you have find this article interesting and useful. As always if you have any questions or comments please do not hesitate to submit them in the comment section below.

Marin Todorov
I am a bachelor in computer science and a Linux Foundation Certified System Administrator. Currently working as a Senior Technical support in the hosting industry. In my free time I like testing new software and inline skating.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

16 thoughts on “How to Install and Configure ‘PowerDNS’ (with MariaDB) and ‘PowerAdmin’ in RHEL/CentOS 7”

  1. Excellent article. Unlike anything, I was able to find anywhere else. Thanks so much!

    One suggestion I would give to everyone is to determine what PDNS version you have by paying attention to the version number after the yum command. If you are already past that point, run the following command:

    # pdns_control version
    

    Then go to the official website to download the schema that matches the same version that is installed on your system. In my case, I kept using the wrong schema and caused me more frustration than necessary. The schema seems to change between each incremental release and is not forward or backward compatible.

    Reply
  2. I have error when I connect MySQL with pdns with this databases, for fixed I create the format of databases from the official website of powerdns.

    CREATE TABLE domains (
      id                    INT AUTO_INCREMENT,
      name                  VARCHAR(255) NOT NULL,
      master                VARCHAR(128) DEFAULT NULL,
      last_check            INT DEFAULT NULL,
      type                  VARCHAR(6) NOT NULL,
      notified_serial       INT DEFAULT NULL,
      account               VARCHAR(40) DEFAULT NULL,
      PRIMARY KEY (id)
    ) Engine=InnoDB;
    
    CREATE UNIQUE INDEX name_index ON domains(name);
    
    
    CREATE TABLE records (
      id                    BIGINT AUTO_INCREMENT,
      domain_id             INT DEFAULT NULL,
      name                  VARCHAR(255) DEFAULT NULL,
      type                  VARCHAR(10) DEFAULT NULL,
      content               VARCHAR(64000) DEFAULT NULL,
      ttl                   INT DEFAULT NULL,
      prio                  INT DEFAULT NULL,
      change_date           INT DEFAULT NULL,
      disabled              TINYINT(1) DEFAULT 0,
      ordername             VARCHAR(255) BINARY DEFAULT NULL,
      auth                  TINYINT(1) DEFAULT 1,
      PRIMARY KEY (id)
    ) Engine=InnoDB;
    
    CREATE INDEX nametype_index ON records(name,type);
    CREATE INDEX domain_id ON records(domain_id);
    CREATE INDEX recordorder ON records (domain_id, ordername);
    
    
    CREATE TABLE supermasters (
      ip                    VARCHAR(64) NOT NULL,
      nameserver            VARCHAR(255) NOT NULL,
      account               VARCHAR(40) NOT NULL,
      PRIMARY KEY (ip, nameserver)
    ) Engine=InnoDB;
    
    
    CREATE TABLE comments (
      id                    INT AUTO_INCREMENT,
      domain_id             INT NOT NULL,
      name                  VARCHAR(255) NOT NULL,
      type                  VARCHAR(10) NOT NULL,
      modified_at           INT NOT NULL,
      account               VARCHAR(40) NOT NULL,
      comment               VARCHAR(64000) NOT NULL,
      PRIMARY KEY (id)
    ) Engine=InnoDB;
    
    CREATE INDEX comments_domain_id_idx ON comments (domain_id);
    CREATE INDEX comments_name_type_idx ON comments (name, type);
    CREATE INDEX comments_order_idx ON comments (domain_id, modified_at);
    
    
    CREATE TABLE domainmetadata (
      id                    INT AUTO_INCREMENT,
      domain_id             INT NOT NULL,
      kind                  VARCHAR(32),
      content               TEXT,
      PRIMARY KEY (id)
    ) Engine=InnoDB;
    
    CREATE INDEX domainmetadata_idx ON domainmetadata (domain_id, kind);
    
    
    CREATE TABLE cryptokeys (
      id                    INT AUTO_INCREMENT,
      domain_id             INT NOT NULL,
      flags                 INT NOT NULL,
      active                BOOL,
      content               TEXT,
      PRIMARY KEY(id)
    ) Engine=InnoDB;
    
    CREATE INDEX domainidindex ON cryptokeys(domain_id);
    
    
    CREATE TABLE tsigkeys (
      id                    INT AUTO_INCREMENT,
      name                  VARCHAR(255),
      algorithm             VARCHAR(50),
      secret                VARCHAR(255),
      PRIMARY KEY (id)
    ) Engine=InnoDB;
    
    CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm);
    
    Reply
  3. Hi Ravi,

    I installed powerdns and login in to the poweradmin,but my dns is not resolving.

    [root@server1 ~]# nslookup server2
    ;; Got SERVFAIL reply from 192.168.1.17, trying next server
    ;; Got SERVFAIL reply from 192.168.1.17, trying next server
    ;; Got SERVFAIL reply from 192.168.1.17, trying next server
    Server: 192.168.1.1
    Address: 192.168.1.1#53

    ** server can’t find server2: NXDOMAIN

    Reply
    • @Sanjay,

      Have you tried PowerDNS using default EPEL repository using Yum package manager? if not, try it or compile it from source to get latest version of PowerDNS.

      Reply
  4. I installed powerdns, follow the link https://www.tecmint.com/install-powerdns-poweradmin-mariadb-in-centos-rhel/ .
    When I do dig command into self LAN of the pdns I always receive:

    ;; WARNING: recursion requested but not available

    anything is default setting… where is the log file?

    how can I understand how resolve?

    pdns.conf
    setuid=pdns
    setgid=pdns
    launch=bind

    launch=gmysql
    gmysql-host=localhost
    gmysql-user=powerdns
    gmysql-password=XXXX
    gmysql-dbname=powerdns

    recursor=8.8.8.8

    from my machine to pdns:

    nmap -v -sT 192.168.1.123
    PORT STATE SERVICE
    22/tcp open ssh
    53/tcp open domain
    80/tcp open http
    3306/tcp open mysql

    nmap -v -sU 192.168.1.123
    PORT STATE SERVICE
    53/udp open|filtered domain

    ; <> DiG 9.8.3-P1 <> gs.mydomain.com @192.168.1.123
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 58633
    ;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
    ;; WARNING: recursion requested but not available

    ;; QUESTION SECTION:
    ;gs.mydomain.com. IN A

    ;; Query time: 1 msec
    ;; SERVER: 192.168.1.123#53(192.168.1.123)
    ;; WHEN: Fri Jul 22 18:15:12 2016
    ;; MSG SIZE rcvd: 31

    no firewall, selinux disabled

    thanks a lot

    Reply
  5. I get “Authentication failed! ” error in GUI , Once i launched the GUI, When i try logging in to the GUI with my admin user and password. Can you help.

    Reply
  6. Actually correct way to create tables would be to use: /usr/share/doc/pdns-backend-mysql-3.X.X folder which consists from database schema files. In case you want to deploy powerdns with DNSSEC, schema will be there.
    mysql -uroot -p powerdns < /usr/share/doc/pdns-backend-mysql-3.X.X/schema.mysql.sql

    Reply
  7. Please update your directions:
    GRANT ALL ON powerdns.* TO ‘powerdns’@’localhost’ IDENTIFIED BY ‘passWord1’;
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘‘passWord1’’ at line 1

    Reply

Leave a Reply to Jay Cancel reply

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.