How to Install DNS Service in Linux Ubuntu 18.04

Posted on

Introduction

This article is showing how to install DNS Service in Linux Ubuntu 18.04. DNS Service is very useful primarily to resolve domain name so it will give the real IP Address of that domain name. The installation processes are available in this article with the following sections. Those sections are exist as follows :

1. Preparation process for the Installation of DNS Service in Linux Ubuntu 18.04

2. The Installation process of DNS Service in Linux Ubuntu 18.04

So, proceed to the following sections to read each of them in details.

 

Preparation Process

The following are steps taken for installing a local DNS Service in Linux Ubuntu 18.04 :

1. Make sure that the package for the Internet Domain Name Server is not exist in the operating system. In order to search whether it exist or not, just execute the command for searching installed package with the name of ‘bind’. The command execution pattern exists as follows :

dpkg -l | grep ^ii | awk {print $2} | grep pattern

Execute it by changing the pattern with the regular expression pattern of the package name. The following is the command execution :

root@hostname# dpkg -l | grep ^ii | awk '{print $2}' | grep ^bind*
binutils
binutils-common:amd64
binutils-x86-64-linux-gnu
root@hostname# 

2. In the previous output, there is no package with the name of ‘bind’. Another way to make sure if there are no DNS service is running currently, just type the following command :

root@hostname# systemctl -l --type service --all | grep bind*                                                            
root@hostname# 

3. Since the output doesn’t show any occurrences of any services with the pattern name of ‘bind’, install the bind package. But before the installation begins, search the appropriate package name which has the function of Internet Domain Name Server resolver. Type the following command to search it :

apt-cache pkgnames | grep pattern

Using the above command pattern, execute the following command to search the Internet Domain Name Server’s package installation :

root@hostname# apt-cache pkgnames | grep ^bind.*
bindgraph
bind9-host
bindfs
bind9utils
bind9-dyndb-ldap
bindechexascii
bind9
bind9-doc
root@hostname# 

4. After retrieving the list of packages where it will have high possibility of the package name, using the above command pattern, retrieve the information of the package with the name of ‘bind9’ as follows :

apt-cache show package_name

The command pattern above will show the output of the execution using ‘bind9’ as the package name for an example :

root@hostname# apt-cache show bind9
Package: bind9
Architecture: amd64
Version: 1:9.11.3+dfsg-1ubuntu1.8
Priority: optional
Section: net
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian DNS Packaging <pkg-dns-devel@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1873
Depends: adduser, bind9utils (= 1:9.11.3+dfsg-1ubuntu1.8), debconf (>= 0.5) | debconf-2.0, libbind9-160 (= 1:9.11.3+dfsg-1ubuntu1.8), libdns1100 (= 1:9.11.3+dfsg-1ubuntu1.8), libisc169 (= 1:9.11.3+dfsg-1ubuntu1.8), libisccc160 (= 1:9.11.3+dfsg-1ubuntu1.8), libisccfg160 (= 1:9.11.3+dfsg-1ubuntu1.8), liblwres160 (= 1:9.11.3+dfsg-1ubuntu1.8), lsb-base (>= 3.2-14), net-tools, netbase, libc6 (>= 2.4), libcap2 (>= 1:2.10), libgeoip1, libjson-c3 (>= 0.11), libssl1.1 (>= 1.1.0), libxml2 (>= 2.7.4), zlib1g (>= 1:1.1.4)
Suggests: bind9-doc, dnsutils, resolvconf, ufw
Filename: pool/main/b/bind9/bind9_9.11.3+dfsg-1ubuntu1.8_amd64.deb
Size: 397832
MD5sum: b339dd77fab9f265d27644377f6efd2d
SHA1: 85d84a168fd51bda247aec6ca56c39d79be003c1
SHA256: 07978e43207afdb4144e733ff0db101061f33ad8b70a4236fe903c857ee48778
Homepage: https://www.isc.org/downloads/bind/
Description-en: Internet Domain Name Server
 The Berkeley Internet Name Domain (BIND) implements an Internet domain
 name server.  BIND is the most widely-used name server software on the
 Internet, and is supported by the Internet Software Consortium, www.isc.org.
 .
 This package provides the server and related configuration files.
Description-md5: afd61d02df1ec6f856b928dfbf6fd201
Task: dns-server
Supported: 5y

Package: bind9
Architecture: amd64
Version: 1:9.11.3+dfsg-1ubuntu1
Priority: optional
Section: net
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian DNS Packaging <pkg-dns-devel@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1872
Depends: adduser, bind9utils (= 1:9.11.3+dfsg-1ubuntu1), debconf (>= 0.5) | debconf-2.0, libbind9-160 (= 1:9.11.3+dfsg-1ubuntu1), libdns1100 (= 1:9.11.3+dfsg-1ubuntu1), libisc169 (= 1:9.11.3+dfsg-1ubuntu1), libisccc160 (= 1:9.11.3+dfsg-1ubuntu1), libisccfg160 (= 1:9.11.3+dfsg-1ubuntu1), liblwres160 (= 1:9.11.3+dfsg-1ubuntu1), lsb-base (>= 3.2-14), net-tools, netbase, libc6 (>= 2.4), libcap2 (>= 1:2.10), libgeoip1, libjson-c3 (>= 0.11), libssl1.1 (>= 1.1.0), libxml2 (>= 2.7.4), zlib1g (>= 1:1.1.4)
Suggests: bind9-doc, dnsutils, resolvconf, ufw
Filename: pool/main/b/bind9/bind9_9.11.3+dfsg-1ubuntu1_amd64.deb
Size: 395912
MD5sum: 5170b8c95e60be7e07c18558428b3094
SHA1: 383d913b4a21aa2bbdd26b33e7a25559505b68f4
SHA256: 98af31a7ba8f617fd9395bee79da5b5c9d523e2f6776303bc52b4c79145f6143
Homepage: https://www.isc.org/downloads/bind/
Description-en: Internet Domain Name Server
 The Berkeley Internet Name Domain (BIND) implements an Internet domain
 name server.  BIND is the most widely-used name server software on the
 Internet, and is supported by the Internet Software Consortium, www.isc.org.
 .
 This package provides the server and related configuration files.
Description-md5: afd61d02df1ec6f856b928dfbf6fd201
Task: dns-server
Supported: 5y

root@hostname#

Installation Process

After checking  that the package for the Internet Domain Name Server is not exist in the operating system, perform the installation. In order to execute the command for installing the selected package with the name of ‘bind’, the following is the command pattern :

apt-get -y install package_name

Execute the above command with the package name of ‘bind9’ according to the above output after searching the correct package name.

root@hostname# apt-get -y install bind9
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  bind9utils
Suggested packages:
  bind9-doc
The following NEW packages will be installed:
  bind9 bind9utils
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 614 kB of archives.
After this operation, 3,277 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 bind9utils amd64 1:9.11.3+dfsg-1ubuntu1.8 [216 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 bind9 amd64 1:9.11.3+dfsg-1ubuntu1.8 [398 kB]
Fetched 614 kB in 3s (208 kB/s)
Preconfiguring packages ...
Selecting previously unselected package bind9utils.
(Reading database ... 390052 files and directories currently installed.)
Preparing to unpack .../bind9utils_1%3a9.11.3+dfsg-1ubuntu1.8_amd64.deb ...
Unpacking bind9utils (1:9.11.3+dfsg-1ubuntu1.8) ...
Selecting previously unselected package bind9.
Preparing to unpack .../bind9_1%3a9.11.3+dfsg-1ubuntu1.8_amd64.deb ...
Unpacking bind9 (1:9.11.3+dfsg-1ubuntu1.8) ...
Setting up bind9utils (1:9.11.3+dfsg-1ubuntu1.8) ...
Setting up bind9 (1:9.11.3+dfsg-1ubuntu1.8) ...
Adding group `bind' (GID 152) ...
Done.
Adding system user `bind' (UID 143) ...
Adding new user `bind' (UID 143) with group `bind' ...
Not creating home directory `/var/cache/bind'.
wrote key file "/etc/bind/rndc.key"
Created symlink /etc/systemd/system/multi-user.target.wants/bind9.service → /lib/systemd/system/bind9.service.
bind9-pkcs11.service is a disabled or a static unit, not starting it.
bind9-resolvconf.service is a disabled or a static unit, not starting it.
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ufw (0.36-0ubuntu0.18.04.1) ...
Rules updated for profile 'OpenSSH'
Firewall reloaded
Processing triggers for ureadahead (0.100.0-21) ...
ureadahead will be reprofiled on next reboot
Processing triggers for systemd (237-3ubuntu10.25) ...
root@hostname# 

As it shows in the above output command, the installation process is a success. Perform the following command to enable and to start the DNS service locally :

root@hostname# systemctl enable bind9
root@hostname#
root@hostname# systemctl start bind9
root@hostname#
root@hostname# systemctl status bind9
● bind9.service - BIND Domain Name Server
   Loaded: loaded (/lib/systemd/system/bind9.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-08-27 22:50:30 WIB; 1 day 5h ago
     Docs: man:named(8)
  Process: 14951 ExecStop=/usr/sbin/rndc stop (code=exited, status=0/SUCCESS)
 Main PID: 14954 (named)
    Tasks: 11 (limit: 4915)
   CGroup: /system.slice/bind9.service
           └─14954 /usr/sbin/named -f -u bind

Aug 29 04:15:20 hostname named[14954]: resolver priming query complete
Aug 29 04:28:17 hostname named[14954]: clients-per-query decreased to 16
root@hostname#


Finally, the process for installing DNS service according to the above output is a success and it is actually finished.


One thought on “How to Install DNS Service in Linux Ubuntu 18.04

Leave a Reply