Wednesday, July 3, 2013

MyDNS for Debian Wheezy

The complete MyDNS install for Debian Wheezy



#Check your hostname:
hostname
hostname -f

#Set your hostname
echo HOSTNAME > /etc/hostname
echo HOSTNAME > /etc/mailname
/etc/init.d/hostname.sh start

#Update the system
aptitude update

# Always for all that is fucking holy install a base system with enough tools to troubleshoot and protect the server:
aptitude install rkhunter binutils sudo gamin build-essential autoconf automake1.9 libtool flex bison debhelper sysstat iotop sysfsutils fail2ban iptraf strace

#Install Mysql and client
aptitude install mysql-client mysql-server

#Install Apache and PhpMyAdmin for those who dont need to sit through a console MySQL interface
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

#Enable some apache modules and restart the service:
a2enmod suexec rewrite ssl actions include
/etc/init.d/apache2 restart

#Install the mysql library for use with MAKE
aptitude install libmysqlclient-dev

#Download the tarball for MyDNS
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/

#Run the configure with the supplied parameter and make the source ready for your distrobution
./configure --without-pgsql --with-mysql-lib=/usr/lib/x86_64-linux-gnu --with-mysql-include=/usr/include/mysql --includedir=/usr/lib/x86_64-linux-gnu --with-zlib=/usr/lib/x86_64-linux-gnu
make
make install

#Create a startup scritp:
nano /etc/init.d/mydns

####################################################################################################
#! /bin/sh

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
####################################################################################################

#Make sure the script runs at start:
chmod +x /etc/init.d/mydns
update-rc.d mydns defaults

# Download and install MyDNS
cd /tmp
wget http://downloads.sourceforge.net/mydnsconfig/MyDNSConfig-3.0.1.tar.gz
tar xvfz MyDNSConfig-3.0.1.tar.gz
cd mydnsconfig/

#Edit the MyDNS install php library file and edit the $dist variable to match your installed OS
nano /tmp/mydnsconfig/install/lib/install.lib.php

# Continue to install MyDNS
cd install/
php -q install.php

#Complete The steps required and your server should be installed.

You can login to your machine from the following if you chose the defaults:
http://IP:8080

2 comments:

  1. Hi, I have this error message when ./configure : configure: error: No supported database found. Either MySQL or PostgreSQL is required.

    I install libmysqlclient15-dev etc... i already have multiple mysql database. I dont know why i dint detect mysql.

    Thanks

    ReplyDelete
  2. Hi Pierre,

    My apologies for the late response, I have been on a sabbatical for the last 3 months :) Good old needed vacation. The above error certainly sounds like a library issue. However you should consider that the latest library version may not exactly be the required one. Please keep in mind that during the time of the post MyDNS and the required library version may not if been the current. I will look into the required library you need to facilitate the build if you reply to my comment given that you did post yours a while ago.

    ReplyDelete