Installing a standard Bind DNS server on an VPS (openvz)

All of our name servers I use are virtual servers and we add them into our network as OpenVZ VPS systems.  Here is the setup I use for setting up a Bind server on an OpenVZ VPS with CentOS 5.

Setup the Open VZ VPS and get into the VPS:

vzctl create 1031 --ostemplate centos-5-i386-default --config vps.basic
vzctl set 1031 --hostname --save
vzctl set 1031 --ipadd --save
vzctl set 1031 --nameserver --save
vzctl start 1020
vzctl enter 1020

Now that you are in the VPS update the OS and get Bind updated:

yum -y erase bind* caching-nameserver
rm -rf /var/named
yum -y install bind*
yum -y update

Get the DNS key through dns-keygen (copy the key):


Start the DNS Setup:

touch /var/named/chroot/etc/named.external.zones
touch /var/named/chroot/etc/named.internal.zones
cp /usr/share/doc/bind-9.3.4/sample/etc/named.* /var/named/chroot/etc/
cp /usr/share/doc/bind-9.3.4/sample/var/named/named.root /var/named/chroot/var/named/
chown named:named /var/named/chroot/var/named/named.root

I am not going to get into details on how to setup your named.conf – as mainly this is a command reference for myself in the future (aren’t I selfish). However, here is my list:

vi /var/named/chroot/etc/named.conf
[ linux centos ]