Skip to content

Instantly share code, notes, and snippets.

@basoro
Created May 26, 2019 21:05
Show Gist options
  • Save basoro/fea57dc9b5077d73f9d086ca4f115d98 to your computer and use it in GitHub Desktop.
Save basoro/fea57dc9b5077d73f9d086ca4f115d98 to your computer and use it in GitHub Desktop.
Installer djbdns on centos 6
#!/bin/bash
yum install wget gcc make -y
mkdir -p /usr/local/src/tinydns
# Compile and install daemontools:
cd /usr/local/src/tinydns
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
tar -xzf daemontools-0.76.tar.gz
cd admin/daemontools-0.76/
echo gcc -O2 -include /usr/include/errno.h > src/conf-cc
package/install
# Compile and install djbdns server
cd /usr/local/src/tinydns
wget http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
tar -xzf djbdns-1.05.tar.gz
cd djbdns-1.05/
echo gcc -O2 -include /usr/include/errno.h > conf-cc
make setup check
# Create user account to run tinydns service and logging
/usr/sbin/useradd -s /bin/false tinydns
/usr/sbin/useradd -s /bin/false dnslog
ipaddr=$(curl -s http://whatismyip.akamai.com/)
sleep 3
tinydns-conf tinydns dnslog /etc/tinydns $ipaddr
ln -s /etc/tinydns /service
cat > /etc/init/svscan.conf <<END
start on runlevel [12345]
respawn
exec /command/svscanboot
END
initctl reload-configuration
initctl start svscan
cd /service/tinydns/root
cat > /service/tinydns/root/data <<END
Zyaski.or.id:ns1.yaski.or.id:hostmaster.yaski.or.id
&yaski.or.id::ns1.yaski.or.id
&yaski.or.id::ns2.yaski.or.id
#define mx for domain
@yaski.or.id::mail.yaski.or.id.:10
#define A for ns1, ns2, amail and www for our dns
+ns1.yaski.or.id:$ipaddr
+ns2.yaski.or.id:$ipaddr
+yaski.or.id:$ipaddr
+*.yaski.or.id:$ipaddr
+www.yaski.or.id:$ipaddr
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment