Set up Tinydns on Fedora

Installing Tinydns (djbdns) on Fedora consists of 4 steps:
1, Install daemontools
2, Install ucspi-tcp
3, Install djbdns
4, configure tinydns

Step 1: Daemontools
First of all, make sure we have all the packages that's needed:
yum install gcc gcc-c++ make flex bison # etc.
This will install all the compilers, kernel-headers, tools and stuff.
mkdir daemontools
cd daemontools
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar xvfz daemontools-0.76.tar.gz
cd admin/daemontools-0.76/
vi compile/conf-cc #add " -include /usr/include/errno.h" at the end of 1st line
cd /command
\rm * #get rid of links, we will use actual excutables here
cp -rp /root/daemontools/admin/daemontools/command/* .
vi /etc/inittab #get rid of that svscanboot line because it's not used from fc9
vi /etc/event.d/svscan #create this new file

The content of this file /etc/event.d/svscan is:
start on runlevel [2345]
stop on runlevel [016]
exec /command/svscanboot
Now daemontools setup is complete. Do a "ps -ef" to see if svscan is running. If not, manually start it, or reboot.

Step 2: ucspi-tcp
This is simple:
mkdir ucspi-tcp
cd ucspi-tcp/
wget http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
tar xvfz ucspi-tcp-0.88.tar.gz
cd ucspi-tcp-0.88
vi conf-cc # put " -include /usr/include/errno.h" at the end of 1st line

Step 3: djbdns
This is quick too:
mkdir djbdns
cd djbdns/
wget http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
tar xvfz djbdns-1.05.tar.gz
cd djbdns-1.05
vi conf-cc # add " -include /usr/include/errno.h" to the 1st line

Step 4: configuration
I will only tinydns here, setting up dnscache is very similiar to setting up tinydns.
useradd –s /bin/false tinydns
useradd –s /bin/false dnslog
tinydns-conf tinydns dnslog /etc/tinydns your_external_ip
ln -s /etc/tinydns /service/
svstat /service/tinydns

That's it, do "svstat /service/tinydns" again, it should show the seconds it's up keep increasing. If not, like for example it stuck at 0 or 1 second, then your setup is not correct.
To debug the problem, do some of these:
Look at /etc/tinydns/log/main/current to see if there's error.
Make sure there's a supervise directory in /etc/tinydns/
Make sure there's No directory under /etc/tinydns/env
remove /service/tinydns link and re-link
remove /etc/tinydns directory and re-create them using tinydns-conf
stop and start the service using "svc" ("svc -d" then "svc_u" or "svc -t" etc.)

Next, just add records to "/etc/tinydns/root/data", and then "make", tinydns should now happily serve any requests from anywhere. If not, use "dig" to debug the problem.

No comments: