En:PowerDNS with Poweradmin Interface
(→Installation - Copied and modified the CentOS pattern) |
(→Installation - Added images (All Rights reserved -> Please replace ASAP), completed the article) |
||
| Line 20: | Line 20: | ||
and start the MySQL server: | and start the MySQL server: | ||
<pre> | <pre> | ||
| − | chkconfig --levels 235 | + | chkconfig --levels 235 mysql on # couldn't find the pendant on Sabayon |
/etc/init.d/mysql start | /etc/init.d/mysql start | ||
</pre> | </pre> | ||
| Line 44: | Line 44: | ||
and restart your MySQL server: | and restart your MySQL server: | ||
<pre> | <pre> | ||
| − | /etc/init.d/ | + | /etc/init.d/mysql restart |
</pre> | </pre> | ||
Run | Run | ||
| Line 182: | Line 182: | ||
</pre> | </pre> | ||
Now open a browser and launch the web-based Poweradmin installer (http://server1.example.com/poweradmin/install or http://192.168.0.100/poweradmin/install). | Now open a browser and launch the web-based Poweradmin installer (http://server1.example.com/poweradmin/install or http://192.168.0.100/poweradmin/install). | ||
| − | + | [[File:Pdns_pic1.png|right]] | |
Select your language (English or Dutch): | Select your language (English or Dutch): | ||
| − | < | + | <br clear=all> |
| + | [[File:Pdns_pic2.png|right]] | ||
Click on the Go to step 3 button to proceed: | Click on the Go to step 3 button to proceed: | ||
| − | < | + | <br clear=all> |
| + | [[File:Pdns_pic3.png|right]] | ||
Now fill in your database details. It is important that you fill in the details for the MySQL root user, not the powerdns MySQL user we created earlier! Also provide a password for the admin user for the Poweradmin web interface (that's the password that the user admin will use to log in to Poweradmin later on): | Now fill in your database details. It is important that you fill in the details for the MySQL root user, not the powerdns MySQL user we created earlier! Also provide a password for the admin user for the Poweradmin web interface (that's the password that the user admin will use to log in to Poweradmin later on): | ||
| − | < | + | <br clear=all> |
| + | [[File:Pdns_pic4.png|right]] | ||
On the next page, fill in the details for the power_admin MySQL user that we created in chapter 3. Also fill in the two default nameservers that will be used in your zones unless you provide different nameservers when you create a zone (typically these are the names of the current system and of the slave server (for which you can set up MySQL replication, see my preliminary notes in chapter 1)): | On the next page, fill in the details for the power_admin MySQL user that we created in chapter 3. Also fill in the two default nameservers that will be used in your zones unless you provide different nameservers when you create a zone (typically these are the names of the current system and of the slave server (for which you can set up MySQL replication, see my preliminary notes in chapter 1)): | ||
| − | <!-- | + | <br clear=all> |
| + | |||
| + | [[File:Pdns_pic5.png|right]] | ||
| + | On the next screen the installer asks you to execute a MySQL query. We don't have to do that because we've done something similar in chapter 3 already (the two ''GRANT'' statements) so we are set. Click on ''Go to step 6'': | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic6.png|right]] | ||
| + | Click on ''Go to step 7'': | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic7.png|right]] | ||
| + | The installation is now finished... | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic8.png|right]] | ||
| + | ... but for security reasons we must delete the install directory: | ||
| + | <pre> | ||
| + | rm -fr /var/www/html/poweradmin/install/ | ||
| + | </pre> | ||
| + | Now you can go to ''http://server1.example.com/poweradmin'' or ''http://192.168.0.100/poweradmin'' and log in with the username ''admin'' and the password you created during the installation: | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic9.png|right]] | ||
| + | This is how the Poweradmin web interface looks: | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic10.png|right]] | ||
| + | To create a zone, go to ''Add master zone'' and fill in the domain name (e.g. ''example.com''). You can already fill in the IP addresses for the www A record ("webserver") and the MX record ("mailserver") for that zone. If you leave the ''Create zone without applying records-template'' checkbox unchecked, Poweradmin will automatically create some NS, A (e.g. www) and MX records for that zone: | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic11.png|right]] | ||
| + | Go to ''List zones'' afterwards. You should now see the new zone there, and it already has eight records. Click on the edit icon to see these eight records: | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic12.png|right]] | ||
| + | These are the records that are created automatically unless you check the ''Create zone without applying records-template'' checkbox when you create a zone. You can now edit them or add and delete records: | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic13.png|right]] | ||
| + | Of course, you can as well create all records one-by-one manually - just leave the IP address fields empty and check the ''Create zone without applying records-template'' checkbox on the ''Add master zone'' page: | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic14.png|right]] | ||
| + | On the List zones page you will see that the new zone has just one record (the SOA record). Click on the edit icon... | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic15.png|right]] | ||
| + | ... and then on ''Add record'' to add further records, ... | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic16.png|right]] | ||
| + | ..., e.g. NS records... | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic17.png|right]] | ||
| + | ... and A records (e.g. for ''mydomain.com'' (leave the ''Name'' field empty!) and ''www.mydomain.com'')... | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic18.png|right]] | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic19.png|right]] | ||
| + | ... and MX records: | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic20.png|right]] | ||
| + | To create PTR records, go to the ''Add master zone'' page and create a zone called ''in-addr.arpa'' (leave the IP address fields empty and check the ''Create zone without applying records-template'' checkbox): | ||
| + | <br clear=all> | ||
| + | |||
| + | [[File:Pdns_pic21.png|right]] | ||
| + | To create a PTR record that points from the IP ''1.2.3.4'' to ''server1.example.com'', create a record under ''List zones'' and fill in ''4.3.2.1'' in the Name field (that's the IP in reverse order) and ''server1.example.com'' in the ''Content'' field: | ||
| + | <br clear=all> | ||
| + | |||
| + | After you've created your records, you can check them with the ''dig'' command (see | ||
| + | <pre> | ||
| + | man dig | ||
| + | </pre> | ||
| + | for more details), e.g. as follows: | ||
| + | <pre> | ||
| + | dig @localhost mx example.com | ||
| + | </pre> | ||
| + | <pre> | ||
| + | [root@server1 ~]# dig @localhost mx example.com | ||
| + | |||
| + | ; <<>> DiG 9.3.4-P1 <<>> @localhost mx example.com | ||
| + | ; (1 server found) | ||
| + | ;; global options: printcmd | ||
| + | ;; Got answer: | ||
| + | ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46586 | ||
| + | ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 | ||
| + | |||
| + | ;; QUESTION SECTION: | ||
| + | ;example.com. IN MX | ||
| + | |||
| + | ;; ANSWER SECTION: | ||
| + | example.com. 86400 IN MX 10 mail.example.com. | ||
| + | |||
| + | ;; ADDITIONAL SECTION: | ||
| + | mail.example.com. 86400 IN A 1.2.3.4 | ||
| + | |||
| + | ;; Query time: 44 msec | ||
| + | ;; SERVER: 127.0.0.1#53(127.0.0.1) | ||
| + | ;; WHEN: Thu Jan 15 18:54:35 2009 | ||
| + | ;; MSG SIZE rcvd: 66 | ||
| + | |||
| + | [root@server1 ~]# | ||
| + | </pre> | ||
= Responsible person = | = Responsible person = | ||
Revision as of 21:00, 17 January 2013
Contents |
Description
PowerDNS is a DNS server, written in C++ and licensed under the GPL. The current version in entropy is 3.1. It's a product of the Dutch company PowerDNS.COM BV, with numerous contributions from the Open Source community. There are many independent projects to create management interfaces for PowerDNS, including PowerAdmin, PDNSOps, PowerDNS on rails and JPower Admin and even a drupal module called PowerAdmin. The following instructing describes, how you can install the PowerDNS nameserver with MySQL backend and the Poweradmin control panel for PowerDNS.
Installation
The following instruction is a modifying of this example for CentOS.
Preliminary Note
In this example, the hostname is server1.example.com and the IP address is 192.168.0.100. Just one PowerDNS server (a master) will be set up. PowerDNS slave(s) can easily be achieved by using MySQL database replication from the master to the slave(s), therefore no zone transfers are needed. MySQL database replication can be set up according to this tutorial: How To Set Up Database Replication In MySQL (PowerDNS also supports native zone transfers (for scenarios where you cannot use MySQL replication) - see http://downloads.powerdns.com/documentation/html/replication.html).
Installing MySQL
To install MySQL v5, do the following as root:
equo install dev-db/mysql
Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) (this is a FIXME) and start the MySQL server:
chkconfig --levels 235 mysql on # couldn't find the pendant on Sabayon /etc/init.d/mysql start
Now check that networking is enabled. Run
netstat -tap | grep mysql
It should show something like this (*:mysql means that MySQL is listening on all interfaces which is important for MySQL replication!):
[root@server1 ~]# netstat -tap | grep mysql tcp 0 0 *:mysql *:* LISTEN 2439/mysql [root@server1 ~]#
If it does not, edit /etc/mysql/my.cnf and comment out the option skip-networking:
nano -w /etc/mysql/my.cnf
[...] #skip-networking [...]
and restart your MySQL server:
/etc/init.d/mysql restart
Run
mysqladmin -u root --password yourrootsqlpassword mysqladmin -h server1.example.com -u root --password yourrootsqlpassword
to set a password for the user root (otherwise anybody can access your MySQL database!).
Installing PowerDNS
To install PowerDNS, run as root:
equo install net-dns/pdns # FIXME: Check for a pendant to pdns-backend-mysql
The PowerDNS configuration is located in the /etc/pdns directory - I'll come to that in a moment.
Now we connect to MySQL:
mysql -u root -p
Type in your MySQL root password, and you should be on the MySQL shell. On the MySQL shell, we create a database for PowerDNS:
CREATE DATABASE powerdns;
Next we create a database user (powerdns) for PowerDNS:
GRANT ALL ON powerdns.* TO 'power_admin'@'localhost' IDENTIFIED BY 'power_admin_password'; GRANT ALL ON powerdns.* TO 'power_admin'@'localhost.localdomain' IDENTIFIED BY 'power_admin_password'; FLUSH PRIVILEGES;
(Replace power_admin_password with a password of your choice.)
Now we create the tables needed by PowerDNS...
USE 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) );
CREATE UNIQUE INDEX name_index ON domains(name);
CREATE TABLE records ( id INT auto_increment, domain_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, type VARCHAR(6) DEFAULT NULL, content VARCHAR(255) DEFAULT NULL, ttl INT DEFAULT NULL, prio INT DEFAULT NULL, change_date INT DEFAULT NULL, primary key(id) );
CREATE INDEX rec_name_index ON records(name); CREATE INDEX nametype_index ON records(name,type); CREATE INDEX domain_id ON records(domain_id);
CREATE TABLE supermasters ( ip VARCHAR(25) NOT NULL, nameserver VARCHAR(255) NOT NULL, account VARCHAR(40) DEFAULT NULL );
... and finally leave the MySQL shell:
quit;
Now we must configure PowerDNS so that it uses the MySQL backend:
nano -w /etc/pdns/pdns.conf # FIXME: Check the correct location. I have no pdns installed.
Add the following lines to pdns.conf:
[...] ################################# # launch Which backends to launch and order to query them in # # launch= launch=gmysql gmysql-host=127.0.0.1 gmysql-user=power_admin gmysql-password=power_admin_password gmysql-dbname=powerdns [...]
Then create the system startup links for PowerDNS and start it:
chkconfig --levels 235 pdns on # FIXME: Check for Sabayon's pendant to chkconfig /etc/init.d/pdns start
That's it, PowerDNS is now ready to be used. To learn more about it, please refer to its documentation: http://downloads.powerdns.com/documentation/html/index.html
Installing Poweradmin
Now let's install Poweradmin, a web-based control panel for PowerDNS. Poweradmin is written in PHP, so we must install a web server (I'm using Apache2 in this example) and PHP:
equo install httpd php pear gettext # FIXME: Search for pendants of php-devel php-gd php-imap php-ldap php-mysql php-odbc php-xml php-xmlrpc php-mbstring php-mcrypt php-mhash echo "php-ldap is Sabayon's net-nds/phpldapadmin?"
Create the system startup links for Apache2 and start it:
chkconfig --levels 235 httpd on # FIXME: Look for the pendant of chkconfig /etc/init.d/httpd start
Poweradmin also requires the following two PEAR packages:
equo install php-pear-DB php-pear-MDB2-Driver-mysql # FIXME: Find the correct packages
Now all prerequisites for Poweradmin are installed, and we can begin with the Poweradmin installation (I will install it in a subdirectory of /var/www/html - /var/www/html is the document root of Apache's default web site on Sabayon; if you've created a vhost with a different document root, please adjust the paths).
Go to https://www.poweradmin.org/trac/wiki/GettingPoweradmin and download the latest Poweradmin package, e.g. as follows:
cd /tmp wget https://www.poweradmin.org/download/poweradmin-2.1.2.tgz
Then install it to the /var/www/html/poweradmin directory as follows:
tar xvfz poweradmin-2.1.2.tgz mv poweradmin-2.1.2 /var/www/html/poweradmin touch /var/www/html/poweradmin/inc/config.inc.php chown -R apache:apache /var/www/html/poweradmin/
Now open a browser and launch the web-based Poweradmin installer (http://server1.example.com/poweradmin/install or http://192.168.0.100/poweradmin/install).
Select your language (English or Dutch):
Click on the Go to step 3 button to proceed:
Now fill in your database details. It is important that you fill in the details for the MySQL root user, not the powerdns MySQL user we created earlier! Also provide a password for the admin user for the Poweradmin web interface (that's the password that the user admin will use to log in to Poweradmin later on):
On the next page, fill in the details for the power_admin MySQL user that we created in chapter 3. Also fill in the two default nameservers that will be used in your zones unless you provide different nameservers when you create a zone (typically these are the names of the current system and of the slave server (for which you can set up MySQL replication, see my preliminary notes in chapter 1)):
On the next screen the installer asks you to execute a MySQL query. We don't have to do that because we've done something similar in chapter 3 already (the two GRANT statements) so we are set. Click on Go to step 6:
Click on Go to step 7:
The installation is now finished...
... but for security reasons we must delete the install directory:
rm -fr /var/www/html/poweradmin/install/
Now you can go to http://server1.example.com/poweradmin or http://192.168.0.100/poweradmin and log in with the username admin and the password you created during the installation:
This is how the Poweradmin web interface looks:
To create a zone, go to Add master zone and fill in the domain name (e.g. example.com). You can already fill in the IP addresses for the www A record ("webserver") and the MX record ("mailserver") for that zone. If you leave the Create zone without applying records-template checkbox unchecked, Poweradmin will automatically create some NS, A (e.g. www) and MX records for that zone:
Go to List zones afterwards. You should now see the new zone there, and it already has eight records. Click on the edit icon to see these eight records:
These are the records that are created automatically unless you check the Create zone without applying records-template checkbox when you create a zone. You can now edit them or add and delete records:
Of course, you can as well create all records one-by-one manually - just leave the IP address fields empty and check the Create zone without applying records-template checkbox on the Add master zone page:
On the List zones page you will see that the new zone has just one record (the SOA record). Click on the edit icon...
... and then on Add record to add further records, ...
..., e.g. NS records...
... and A records (e.g. for mydomain.com (leave the Name field empty!) and www.mydomain.com)...
... and MX records:
To create PTR records, go to the Add master zone page and create a zone called in-addr.arpa (leave the IP address fields empty and check the Create zone without applying records-template checkbox):
To create a PTR record that points from the IP 1.2.3.4 to server1.example.com, create a record under List zones and fill in 4.3.2.1 in the Name field (that's the IP in reverse order) and server1.example.com in the Content field:
After you've created your records, you can check them with the dig command (see
man dig
for more details), e.g. as follows:
dig @localhost mx example.com
[root@server1 ~]# dig @localhost mx example.com ; <<>> DiG 9.3.4-P1 <<>> @localhost mx example.com ; (1 server found) ;; global options: printcmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46586 ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; QUESTION SECTION: ;example.com. IN MX ;; ANSWER SECTION: example.com. 86400 IN MX 10 mail.example.com. ;; ADDITIONAL SECTION: mail.example.com. 86400 IN A 1.2.3.4 ;; Query time: 44 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Thu Jan 15 18:54:35 2009 ;; MSG SIZE rcvd: 66 [root@server1 ~]#
Responsible person
If you're interested, please ask BlackNoxis on the forums. He wants to engage Gentoo/Sabayon users in this project. At the moment he plans on supporting this project on RogentOS, a Sabayon fork. You can get the latest poweradmin version there, too. See Link section below for further details.
Further reading
- Wikipedia article: http://en.wikipedia.org/wiki/Poweradmin
- PowerDNS and Poweradmin: http://www.howtoforge.com/installing-powerdns-with-mysql-backend-and-poweradmin-on-centos-5.2
- Latest poweradmin for RogentOS: http://pkg.rogentos.ro/~rogentos/distro/
- Poweradmin: http://drupal.org/project/poweradmin
- PowerDNS page: http://www.powerdns.com/content/home-powerdns.html
- PowerDNS manual: http://rtfm.powerdns.com/
- PowerDNS wiki: http://wiki.powerdns.com/trac
- PowerDNS hosting: https://www.powerdns.net/en/default.aspx
- PowerDNS geo backend: http://doc.powerdns.com/geo.html




















