{"id":85,"date":"2021-06-30T00:40:43","date_gmt":"2021-06-30T05:40:43","guid":{"rendered":"https:\/\/sourceopen.com\/?p=85"},"modified":"2021-08-17T15:26:46","modified_gmt":"2021-08-17T20:26:46","slug":"install-djbdns-in-2021-on-ubuntu-20-04-or-other-modern-linux","status":"publish","type":"post","link":"https:\/\/sourceopen.com\/index.php\/install-djbdns-in-2021-on-ubuntu-20-04-or-other-modern-linux\/","title":{"rendered":"Install djbdns in 2021 on Ubuntu 20.04 or Other Modern Linux"},"content":{"rendered":"\n<p>On a recent server install I needed to put djbdns onto an Ubuntu 20.04 system. djbdns is no longer support by Bernstein, but it has been in the public domain for a few years now. Note that djbdns is not really supported any more. So anyone setting up a new dns server should likely look at other options. If you are an old djbdns user and need other servers to use it to maintain compatibility or your sanity then this should get you where you want to be.<\/p>\n\n\n\n<p>The author of another DNS package, <a href=\"https:\/\/maradns.samiam.org\/\" data-type=\"URL\" data-id=\"https:\/\/maradns.samiam.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">MaraDNS,<\/a>has kindly taken it upon himself to maintain (minimally) djbdns as outlined <a href=\"https:\/\/maradns.samiam.org\/ndjbdns\/\" data-type=\"URL\" data-id=\"https:\/\/maradns.samiam.org\/ndjbdns\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p>He put the <strong>updated djbdns package on GitHUB<\/strong> here: <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/samboy\/ndjbdns\" target=\"_blank\">https:\/\/github.com\/samboy\/ndjbdns<\/a> Note this is based on a fork on the more modern ndjbdns.<\/p>\n\n\n\n<p>So why do you need this blog posting? Well, the directions there are not quite up to date. Here is my take on it:<\/p>\n\n\n\n<p><strong>How-to Install djbdns in 2021 on Ubuntu 20.04<\/strong><\/p>\n\n\n\n<p>Grab the source from the GitHUB page. Either use git or svn to check out the <a href=\"https:\/\/github.com\/samboy\/ndjbdns\" data-type=\"URL\" data-id=\"https:\/\/github.com\/samboy\/ndjbdns\" target=\"_blank\" rel=\"noreferrer noopener\">sources<\/a>, or download the Zip file&#8211; direct link <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/samboy\/ndjbdns\/archive\/refs\/heads\/master.zip\" data-type=\"URL\" data-id=\"https:\/\/github.com\/samboy\/ndjbdns\/archive\/refs\/heads\/master.zip\" target=\"_blank\">here<\/a>.<\/p>\n\n\n\n<p>Expand the zip file, cd into the directory, and then run:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">.\/configure<br>make<br>sudo make install<\/pre>\n\n\n\n<p>By default configure will set you up to install into \/usr\/local\/. This works fine.<br><strong>Note<\/strong>: I had to install g++ to appease configure (apt install g++) even though djb uses C.<\/p>\n\n\n\n<p>Now you have both the dnscache caching server and the tinydns authoritative server installed, but not set to actually run. This is where the instructions on the GitHUB page fell apart.<\/p>\n\n\n\n<p><strong>Configure tinydns<\/strong><\/p>\n\n\n\n<p>Go ahead and configure tinydns settings using the conf file (unlike the old djbdns where you touch files to control settings this new version has conf files):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nano \/usr\/local\/etc\/ndjbdns\/tinydns.conf<\/pre>\n\n\n\n<p>Note that the GitHUB package has the UID and GID set to number 2, attempting to run as the user daemon. On my Ubuntu install the daemon users is uid\/gid number 1. So I had to change these both to 1. (<em>grep daemon \/etc\/passwd<\/em> and <em>grep daemon \/etc\/group<\/em> to see what yours are.) You may also opt to create your own user and group specifically for djb.<\/p>\n\n\n\n<p>Don&#8217;t forget to put your <em>data <\/em>file and make your <em>data.cdb<\/em> file in the directory specified in the conf file (by default they go in <em>\/usr\/local\/etc\/ndjbdns\/<\/em> ). Make sure these are readable and writable by the user you specified in the conf file (daemon).<\/p>\n\n\n\n<p><strong>Make tinydns run from systemd<\/strong><\/p>\n\n\n\n<p>If you want to run tinydns, the authoritative nameserver you need to set it to run with systemd. The GitHUB package does include service settings for systemd. It puts them in <em>\/usr\/local\/lib\/systemd\/system\/<\/em>. So you need to create a symlink to actually activate the service:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ln -s \/usr\/local\/lib\/systemd\/system\/tinydns.service \/etc\/systemd\/system\/tinydns.service<\/pre>\n\n\n\n<p>Now reload systemd:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl daemon-reload<\/pre>\n\n\n\n<p>Enable tinydns service in systemd:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl enable tinydns<\/pre>\n\n\n\n<p>And start it up:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl start tinydns<\/pre>\n\n\n\n<p>Check the status to make sure it is running:<\/p>\n\n\n\n<pre id=\"block-97bcda61-5066-403c-b680-2d34b93866c2\" class=\"wp-block-preformatted\">sudo systemctl status tinydns<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Configure dnscache<\/strong><\/p>\n\n\n\n<p>Go ahead and configure dnscache settings using the conf file (unlike the old djbdns where you touch files to control settings this new version has conf files):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo nano \/usr\/local\/etc\/ndjbdns\/dnscache.conf<\/pre>\n\n\n\n<p>Note that the GitHUB package has the UID and GID set to number 2, attempting to run as the user daemon. On my Ubuntu install the daemon users is uid\/gid number 1. So I had to change these both to 1. (<em>grep daemon \/etc\/passwd<\/em> and <em>grep daemon \/etc\/group<\/em> to see what yours are.) You may also opt to create your own user and group specifically for djb.<\/p>\n\n\n\n<p><strong>Make <strong>dnscache<\/strong><\/strong> <strong>run from systemd<\/strong><\/p>\n\n\n\n<p>If you want to run dnscache, the caching name server you need to set it to run with systemd. The GitHUB package does include service settings for systemd. It puts them in <em>\/usr\/local\/lib\/systemd\/system\/<\/em>. So you need to create a symlink to actually activate the service:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo ln -s \/usr\/local\/lib\/systemd\/system\/dnscache.service \/etc\/systemd\/system\/dnscache.service<\/pre>\n\n\n\n<p>Now reload systemd:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl daemon-reload<\/pre>\n\n\n\n<p>Enable dnscache service in systemd:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl enable dnscache<\/pre>\n\n\n\n<p>And start it up:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl start dnscache<\/pre>\n\n\n\n<p>Check the status to make sure it is running:<\/p>\n\n\n\n<pre id=\"block-97bcda61-5066-403c-b680-2d34b93866c2\" class=\"wp-block-preformatted\">sudo systemctl status dnscache<\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>For anyone needing to run djbdns on modern Ubuntu like 20.04 hopefully this got you going. For anyone considering setting up a new machine with djbdns&#8211; don&#8217;t. It is barely supported at this stage. You are better off with BIND (I know) or other more <a href=\"https:\/\/maradns.samiam.org\/dns_software.html\" data-type=\"URL\" data-id=\"https:\/\/maradns.samiam.org\/dns_software.html\" target=\"_blank\" rel=\"noreferrer noopener\">modern name servers<\/a>.<\/p>\n\n\n\n<p>Thank you to Sam Trenholme, the author of MaraDNS, and the kind soul who has decided to keep djbdns on life support for the community.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On a recent server install I needed to put djbdns onto an Ubuntu 20.04 system. djbdns is no longer support by Bernstein, but it has been in the public domain for a few years now. Note that djbdns is not &hellip; <a href=\"https:\/\/sourceopen.com\/index.php\/install-djbdns-in-2021-on-ubuntu-20-04-or-other-modern-linux\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/posts\/85"}],"collection":[{"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/comments?post=85"}],"version-history":[{"count":3,"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/posts\/85\/revisions"}],"predecessor-version":[{"id":90,"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/posts\/85\/revisions\/90"}],"wp:attachment":[{"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/media?parent=85"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/categories?post=85"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sourceopen.com\/index.php\/wp-json\/wp\/v2\/tags?post=85"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}