Thursday, February 15, 2007

DNS: installing DJB DNS (tinydns) on fresh CentOS

Setup tinydns on CentOS or Debian



As a user of vpsland.com I've got a VPS with CentOS (which have packaging structure very simular to Debian) with bind installed.
This is not the best solution - because bind in both insecure and uses too much memory.

Here it is a small script to install tinyDNS to the VPS server.

Cut it here, paste into some file on your server, make that file executable (chmod 755 filename) and run it.


#!/bin/sh
#Create the following directories:
mkdir -p /usr/local/djb/build
mkdir -p /usr/local/djb/patches

# Download and extract the three patches:
# //get the patches:
cd /usr/local/djb/patches
#//Download the following (small download, still ... be kind to his bandwidth .. :) ):
wget http://www.thedjbway.org/patches/djb_errno_patches.tgz
#//Extract:
tar -xzvf djb*.tgz
#//Several .patch files should output

#Download and extract the three packages:

#//Change directories and download the main packages:
cd /usr/local/djb/build
wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
wget http://cr.yp.to/djbdns/djbdns-1.05.tar.gz

#Extract and patch each of the three packages:
#(you should still be in the /usr/local/djb/build directory for all three of the following)

#Extract and Patch ucspi:

cd /usr/local/djb/build

#//ucspi
gunzip ucspi-tcp-0.88.tar
tar -xf ucspi-tcp-0.88.tar
cd ucspi-tcp-0.88
patch -p1 < ../../patches/ucspi-tcp-0.88.errno.patch
#//[output from patch...]
patch -p1 < ../../patches/ucspi-tcp-0.88.a_record.patch
#//[output from patch...]
patch -p1 < ../../patches/ucspi-tcp-0.88.nobase.patch
#//[output from patch...]
make setup check
./install
./instcheck

#Extract and Patch daemontools:

cd /usr/local/djb/build

#//daemontools
gunzip daemontools-0.76.tar
tar -xpf daemontools-0.76.tar
rm daemontools-0.76.tar
cd admin/daemontools-0.76
patch -p1 < ../../../patches/daemontools-0.76.errno.patch
#//[output from patch...]
package/install


# Extract and Patch djbdns:

cd /usr/local/djb/build

#//djbdns
gunzip djbdns-1.05.tar
tar -xf djbdns-1.05.tar
cd djbdns-1.05
patch -p1 < ../../patches/djbdns-1.05.errno.patch
#//[output from patch...]
make
make setup check
./install
./instcheck

#Next, you'll add the necessary user accounts and use the tinydns-conf script to create an installation based on the IP of your box:
#xx.xx.xx.xx represents the IP address represented with the output of "ifconfig" on your box.

echo "Input your ip address, (ifconfig output follows)"
ifconfig
read IP

#//create the group and users -- modify if needed
groupadd -g 91 dns
useradd -g 91 -u 91 -d /nonexistent -c "tinydns" -s /sbin/nologin Gtinydns
useradd -g 91 -u 92 -d /nonexistent -c "tinydns" -s /sbin/nolodin Gdnslog

#//here the tinydns-conf script copies files and creates the useable IP-based installation
cd /usr/local/bin
tinydns-conf Gtinydns Gdnslog /etc/tinydns $IP

#Once that's done, you'll set a symbolic link to the svcscan application to keep tinydns running if crashed:

#//create the symbolic link of djbdns under the symbolic link of the svcscan application
cd /
mkdir /service
ln -s /etc/tinydns /service
#//force us to be patient and wait for the service to start
sleep 5
#//check to make sure the service is running
svstat /service/tinydns
#//should return something like "/service/tinydns: up (pid 24957) 4870 seconds"



These instructions were taken from forum.

Keywords: dns, djb dns, cent os, tinydns, daemontools, svstat, setting up dns, system administration
Author: Gaspar Chilingarov

No comments: