apt-get install djbdns.adduser --system --no-create-home dnscachednscache-conf $(id -un) $(id -un)
/tmp/dnscache (dnscache is intended to run under runit or daemontools, so
environment dir is full of extra stuff which we do not need at all).cp -a /tmp/dnscache/root
/etc/dnscache.Create upstart rule in file /etc/event.d/dnscache:
description "Starts dnscache from djbdns package"
start on runlevel 2
start on runlevel 3
stop on runlevel 0
stop on runlevel 1
stop on runlevel 4
stop on runlevel 5
stop on runlevel 6
stop on shutdown
respawn
console none
script
export CACHESIZE=$((2*1024*1024))
export DATALIMIT=$((32*1024*1024))
export IP=127.0.0.1
export IPSEND=0.0.0.0
export ROOT=/etc/dnscache
export UID=$(id -u dnscache)
export GID=$(id -g dnscache)
TMPFILE=$(tempfile -m0600)
head -c128 /dev/urandom > $TMPFILE
exec <$TMPFILE
rm -f $TMPFILE
exec /usr/bin/dnscache
end script
Make sure dnscache is started: initctl list. If not, start it by running
start dnscache.
There's a packaged version of these actions: dnscache-upstart package.