Installing MyDNS & MyDNSConfig 3 On Fedora 10
Author: Falko Timme
In this tutorial I will describe how to install and configure MyDNS and MyDNSConfig 3 on Fedora 10. MyDNS is a DNS server that uses a MySQL database as backend instead of configuration files like, for example, Bind or djbdns. The advantage is that MyDNS simply reads the records from the database, and it does not have to be restarted/reloaded when DNS records change or zones are created/edited/deleted. A secondary nameserver can be easily set up by installing a second instance of MyDNS that accesses the same database or, to be more redundant, uses the MySQL master / slave replication features to replicate the data to the secondary nameserver.
MyDNSConfig is an easy to use web-based interface to MyDNS. MyDNSConfig can create all types of DNS records that are available in MyDNS and adds features like user management and access privileges.
I do not issue any guarantee that this will work for you!
1 Preliminary Note
In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. These settings might differ for you, so you have to replace them where appropriate.
2 Installing MySQL
We can install MySQL as follows:
yum install mysql mysql-server
Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:
chkconfig --levels 235 mysqld on
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!).
If the last command throws an error at you...
[root@server1 named]# mysqladmin -h server1.example.com -u root password yourrootsqlpassword
mysqladmin: connect to server at 'server1.example.com' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
... we can set the password as follows: connect to MySQL:
mysql -u root -p
Type in the password for the MySQL root user. Then, on the MySQL shell, do this:
mysql> USE mysql;
mysql> UPDATE user SET Password = password('yourrootsqlpassword') WHERE Host = 'server1.example.com' AND User = 'root';
mysql> UPDATE user SET Password = password('yourrootsqlpassword') WHERE Host = '127.0.0.1' AND User = 'root';
mysql> SELECT * FROM user;
to make sure that all rows where the user is root have a password.
If everything is looking ok, run
mysql> FLUSH PRIVILEGES;
... and leave the MySQL shell:
3 Installing Apache2, PHP, phpMyAdmin
MyDNSConfig needs a web server with PHP support; therefore I install Apache2. I also install phpMyAdmin so that I can access the database later on over a web interface (although this is optional):
yum install httpd php php-mysql php-mbstring php php-devel php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-mcrypt php-mhash php-mssql php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl ImageMagick libxml2 php-cli phpMyAdmin
We also have to install vlogger which isn't available as a Fedora package:
tar xvfz vlogger-1.3.tar.gz
mv vlogger-1.3/vlogger /usr/sbin/
rm -rf vlogger*
Now we configure phpMyAdmin. We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the <Directory /usr/share/phpmyadmin> stanza):
# phpMyAdmin - Web based MySQL browser written in php # # Allows only localhost by default # # But allowing phpMyAdmin to anyone other than localhost should be considered # dangerous unless properly secured by SSL Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin #<Directory /usr/share/phpMyAdmin/> # order deny,allow # deny from all # allow from 127.0.0.1 #</Directory> # This directory does not require access over HTTP - taken from the original # phpMyAdmin upstream tarball # <Directory /usr/share/phpMyAdmin/libraries> Order Deny,Allow Deny from All Allow from None </Directory> # This configuration prevents mod_security at phpMyAdmin directories from # filtering SQL etc. This may break your mod_security implementation. # #<IfModule mod_security.c> # <Directory /usr/share/phpMyAdmin> # SecRuleInheritance Off # </Directory> #</IfModule>
Then we create the system startup links for Apache and start it:
chkconfig --levels 235 httpd on
Now you can direct your browser to http://server1.example.com/phpmyadmin/ or http://192.168.0.100/phpmyadmin/ and log in with the user name root and your new root MySQL password.
4 Installing MyDNS
We can install MyDNS as follows:
rpm -ivh mydns-mysql-1.1.0-1.i386.rpm
When the system boots, MyDNS must be started after MySQL. The MySQL startup link has the priority 64 on Fedora 10, so the MyDNS startup link must have a priority between 65 and 99. Therefore we open the MyDNS init script...
... and change
[...] # chkconfig: 345 52 50 [...]
[...] # chkconfig: 345 65 50 [...]
Then we create the startup links:
chkconfig --levels 235 mydns on
We don't start MyDNS now because it must be configured first - this will be done automatically by the MyDNSConfig 3 installer later on.