Name server is needed to manage the hostname to ip address matching. Usually, we use BIND in linux. To install it in my vps, I follow the instructions in http://www.howtoforge.com/perfect_setup_debian_etch_p4 :
debian:~# apt-get install bind9
For security reasons, run BIND chrooted:
debian:~# /etc/init.d/bind9 stop
Stopping domain name service...: bind.
debian:~# vim /etc/default/bind9
edit line 1, so become:
OPTIONS="-u bind -t /var/lib/named"
Create some necessary directories under /var/lib:
debian:~# mkdir -p /var/lib/named/etc
debian:~# mkdir /var/lib/named/dev
debian:~# mkdir -p /var/lib/named/var/cache/bind
debian:~# mkdir -p /var/lib/named/var/run/bind/run
Then move the configuration directory from /etc to /var/lib/named/etc:
debian:~# mv /etc/bind /var/lib/named/etc
Create a symbolic link to the new configuration directory from the old location (to avoid problems when bind gets updated in the future):
debian:~# ln -s /var/lib/named/etc/bind /etc/bind
Make null and random devices, and fix permissions of the directories:
debian:~# mknod /var/lib/named/dev/null c 1 3
debian:~# mknod /var/lib/named/dev/random c 1 8
debian:~# chmod 666 /var/lib/named/dev/null /var/lib/named/dev/random
debian:~# chown -R bind:bind /var/lib/named/var/*
debian:~# chown -R bind:bind /var/lib/named/etc/bind
We need to modify /etc/default/syslogd so that we can still get important messages logged to the system logs.
debian:~# vim /etc/default/syslogd
edit line 13, so become:
Restart the logging daemon:
debian:~# /etc/init.d/sysklogd restart
Restarting system log daemon: syslogd.
Start up BIND, and check /var/log/syslog for errors:
debian:~# /etc/init.d/bind9 start
Starting domain name service...: bind.