Installing MyDNS-NG & MyDNSConfig 3 On Debian Lenny

Version 1.0
Author: Falko Timme

In this tutorial I will describe how to install and configure MyDNS-NG and MyDNSConfig 3 on Debian Lenny. MyDNS-NG (based on MyDNS originally writen by Don Moore - 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-NG. 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 with the IP address These settings might differ for you, so you have to replace them where appropriate.


2 Installing MySQL

We can install MySQL as follows:

aptitude install mysql-client mysql-server

You will be asked the following questions:

New password for the MySQL "root" user: <-- yourrootsqlpassword
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword


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):

aptitude install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick vlogger

You will see the following question:

Web server to reconfigure automatically: <-- apache2

Then run the following command to enable the Apache modules suexec, rewrite, ssl, actions, and include:

a2enmod suexec rewrite ssl actions include

Secure phpMyAdmin by deleting the /etc/phpmyadmin/htpasswd.setup file...

rm -f /etc/phpmyadmin/htpasswd.setup

... and remove or comment out the following section in /etc/phpmyadmin/apache.conf:

vi /etc/phpmyadmin/apache.conf

#       # Authorize for setup
#       <Files setup.php>
#           # For Apache 1.3 and 2.0
#           <IfModule mod_auth.c>
#               AuthType Basic
#               AuthName "phpMyAdmin Setup"
#               AuthUserFile /etc/phpmyadmin/htpasswd.setup
#           </IfModule>
#           # For Apache 2.2
#           <IfModule mod_authn_file.c>
#               AuthType Basic
#               AuthName "phpMyAdmin Setup"
#               AuthUserFile /etc/phpmyadmin/htpasswd.setup
#           </IfModule>
#           Require valid-user
#       </Files>

Restart Apache afterwards:

/etc/init.d/apache2 restart

You can now access phpMyAdmin under or


4 Installing MyDNS

Before we install MyDNS, we need to install a few prerequisites:

aptitude install g++ libc6 gcc gawk make texinfo libmysqlclient15-dev

MyDNS is not available in the Debian Lenny repositories, therefore we have to build it ourselves as follows:

cd /tmp
tar xvfz mydns-
cd mydns-1.2.8
make install

Next we create the start/stop script for MyDNS:

vi /etc/init.d/mydns

#! /bin/sh
# mydns         Start the MyDNS server
# Author:       Philipp Kern <[email protected]>.
#               Based upon skeleton 1.9.4 by Miquel van Smoorenburg
#               <[email protected]> and Ian Murdock <[email protected]>.

set -e

DESC="DNS server"


# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

case "$1" in
        echo -n "Starting $DESC: $NAME"
        start-stop-daemon --start --quiet \
                --exec $DAEMON -- -b
        echo "."
        echo -n "Stopping $DESC: $NAME"
        start-stop-daemon --stop --oknodo --quiet \
                --exec $DAEMON
        echo "."
        echo -n "Reloading $DESC configuration..."
        start-stop-daemon --stop --signal HUP --quiet \
                --exec $DAEMON
        echo "done."
        echo -n "Restarting $DESC: $NAME"
        start-stop-daemon --stop --quiet --oknodo \
                --exec $DAEMON
        sleep 1
        start-stop-daemon --start --quiet \
                --exec $DAEMON -- -b
        echo "."
        echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        exit 1

exit 0

Then we make the script executable and create the system startup links for it:

chmod +x /etc/init.d/mydns
update-rc.d mydns defaults

Share this page:

Suggested articles

0 Comment(s)

Add comment


From: falko