Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

Installing MyDNS-NG & MyDNSConfig On Debian Squeeze


This tutorial will describe how to install and configure MyDNS-NG and MyDNSConfig 3 on Debian Squeeze. MyDNS-NG (based on MyDNS originally writen by Don Moore – http://mydns.bboy.net/) is a DNS server that uses a MySQL database as backend instead of configuration files. 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 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:

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-mpm-prefork imagemagick mcrypt php5 php-auth php5-gd php5-imagick php5-imap php5-mcrypt php5-mysql php-pear phpmyadmin 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

Restart Apache afterwards:

/etc/init.d/apache2 restart

You can now access phpMyAdmin under http://server1.example.com/phpmyadmin/ or http://192.168.0.100/phpmyadmin/.

 

4 Installing MyDNS

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

aptitude install build-essential libmysqlclient-dev

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

cd /tmp
wget http://sourceforge.net/projects/mydns-ng/files/mydns/1.2.8.31/mydns-1.2.8.31.tar.gz
tar xfz mydns-1.2.8.31.tar.gz
cd mydns-1.2.8.31/
./configure
make
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 <phil@philkern.de>.
#               Based upon skeleton 1.9.4 by Miquel van Smoorenburg
#               <miquels@cistron.nl> and Ian Murdock <imurdock@gnu.ai.mit.edu>.
#

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/sbin/mydns
NAME=mydns
DESC="DNS server"

SCRIPTNAME=/etc/init.d/$NAME

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

case "$1" in
  start)
        echo -n "Starting $DESC: $NAME"
        start-stop-daemon --start --quiet \
                --exec $DAEMON -- -b
        echo "."
        ;;
  stop)
        echo -n "Stopping $DESC: $NAME"
        start-stop-daemon --stop --oknodo --quiet \
                --exec $DAEMON
        echo "."
        ;;
  reload|force-reload)
        echo -n "Reloading $DESC configuration..."
        start-stop-daemon --stop --signal HUP --quiet \
                --exec $DAEMON
        echo "done."
        ;;
  restart)
        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
        ;;
esac

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

5 Installing MyDNSConfig 3

We can install MyDNSConfig 3 as follows:

cd /tmp
wget http://downloads.sourceforge.net/mydnsconfig/MyDNSConfig-3.0.1.tar.gz
tar xvfz MyDNSConfig-3.0.1.tar.gz
cd mydnsconfig/

We need to edit the /tmp/mydnsconfig/install/lib/install.lib.php file and add the following lines after line 77:

 $distbaseid = 'debian';
             swriteln("Operating System: Debian Lenny/Sid or compatible\n");
         }
+        if(trim(file_get_contents('/etc/debian_version')) == '6.0' || trim(file_get_contents('/etc/debian_version')) == 'squeeze/sid') {
+            $distname = 'Debian';
+            $distver = 'Squeeze/Sid';
+            $distid = 'debian40';
+            $distbaseid = 'debian';
+            swriteln("Operating System: Debian Squeeze/Sid or compatible\n");
+        }
+
     }

     //** OpenSuSE

This will start the MyDNSConfig 3 installer:

cd install/
php -q install.php


——————————————————————————–
__  __       _____  _   _  _____  _____             __ _
|  \/  |     |  __ \| \ | |/ ____|/ ____|           / _(_)
| \  / |_   _| |  | |  \| | (___ | |     ___  _ __ | |_ _  __ _
| |\/| | | | | |  | | . ` |\___ \| |    / _ \| ‘_ \|  _| |/ _` |
| |  | | |_| | |__| | |\  |____) | |___| (_) | | | | | | | (_| |
|_|  |_|\__, |_____/|_| \_|_____/ \_____\___/|_| |_|_| |_|\__, |
__/ |                                             __/ |
|___/                                             |___/
——————————————————————————–

>> Initial configuration

Operating System: Debian Squeeze/Sid or compatible

Following will be a few questions for primary configuration so be careful.
Default values are in [brackets] and can be accepted with <ENTER>.
Tap in “quit” (without the quotes) to stop the installer.

Select language (en,de) [en]: <– ENTER

Installation mode (standard,expert) [standard]: <– ENTER

Full qualified hostname (FQDN) of the server, eg server1.domain.tld  [server1.example.com]: <– ENTER

MySQL server hostname [localhost]: <– ENTER

MySQL root username [root]: <– ENTER

MySQL root password []: <– yourrootsqlpassword

MySQL database to create [dbmydnsconfig]: <– ENTER

MySQL charset [utf8]: <– ENTER

Configuring MyDNS
Configuring Apache
Configuring Firewall
Installing MyDNSConfig
MyDNSConfig Port [8080]:
 <– ENTER

Installing Crontab
no crontab for root
Restarting services …
Restarting web server: apache2 … waiting .
Installation completed.
server1:/tmp/mydnsconfig/install#

The installer automatically configures all underlying services, so no manual configuration is needed.

Afterwards you can access MyDNSConfig 3 under http://server1.example.com:8080/ or http://192.168.0.100:8080/. Log in with the username admin and the password admin (you should change the default password after your first login):

1

6 Using MyDNSConfig 3

The DNS tab is the most important part of MyDNSConfig because that’s where you can create zones and records, so I will focus on that tab.

To create a new zone, click on the Add new DNS Zone (SOA) button:

2

Now you can fill in the details of the zone, e.g. the domain name, the primary nameserver, and the email address of the zone administrator (please note that you must replace the @ sign with a dot!); these three details must end

with a dot! You can leave the other details as they are. You can now save the zone or go directly to the Records tab (this will save the zone details automatically):

3

On the records tab, you can now create all kinds of DNS records (A, CNAME, MX, NS, TXT, etc.) – just click on the appropriate button:

4

For example, here’s the form for creating NS records (please keep in mind that if you write full hostnames, they must end with a dot!):

5

Here’s the overview – as you see, I’ve created some more records:

6

7 Updating MyDNSConfig 3

Whenever there’s a newer MyDNSConfig 3 release, you can update your MyDNSConfig 3 installation as follows:

mydnsconfig_update.sh

This will bring up the update wizard. PLEASE NOTE: you can upgrade to the latest stable version and to the svn version. It is highly recommended to upgrade to the latest stable version as the svn version is used for development and might contain bugs. YOU HAVE BEEN WARNED!!!

 

  • MyDNS-NG: http://www.mydns.pl/
  • MyDNSConfig: http://www.mydnsconfig.org/
  • Debian: http://www.debian.org/

Comments

comments