Table of Contents
In this article, I will take you through 6 Easy Steps to Install dig and nslookup command on RHEL / CentOS 8. Sometimes you might have noticed the error "dig command not found" when you are trying to use dig command in your Server. This is because dig tool will be available by default in RHEL/CentOS 8. You need to install it manually.
dig is known as Domain Information Groper. It is used to query DNS Nameservers. Oftenly this tool is used by the DNS Administrators for troubleshooting purposes. This tool is part of the bind-utils package in RHEL/CentOS based systems. You can check more about this tool on dig Man Page.
nslookup is an open source tool in Linux used for querying Internet Name Servers. This tool is also a part of bind-utils package in RHEL/CentOS based Systems. You can check more about this tool on nslookup Man Page.
Since both of the tools are part of the bind-utils package so installing this package will make both the dnf and nslookup tools available in your Server.
Install dig and nslookup command on RHEL/CentOS 8
Also Read: 12 Easy Steps to Install NVM for Node.js on Ubuntu 20.04
Step 1: Prerequisites
a) You need to have a running RHEL/CentOS 8
Server.
b) You should have dnf
tool installed in your Server. You can check 31 Useful DNF Command Examples for RPM Package Management in Fedora/RHEL/CentOS to know more about dnf
command.
c) You should have sudo
access to run privileged commands. You can Check How to Add User to Sudoers to know more about providing sudo
access to the User.
Step 2: Update Your System
Before going through the steps to install dig
and nslookup
command you need to first update your Server using dnf update -y
command as shown below. This will download and install all the latest available updates from enabled Repo. Sometimes installing a new package requires dependencies to be updated with the latest version hence it is always recommended to run an update first. This is particularly required if you have not updated your Server from long time.
[root@localhost ~]# dnf update -y Last metadata expiration check: 0:17:57 ago on Sat 12 Sep 2020 02:25:56 PM EDT. Dependencies resolved. ======================================================================================================================================================================== Package Architecture Version Repository Size ======================================================================================================================================================================== Installing: kernel-core x86_64 4.18.0-193.14.2.el8_2 BaseOS 28 M Upgrading: alsa-lib x86_64 1.2.1.2-3.el8 AppStream 441 k container-selinux noarch 2:2.124.0-1.module_el8.2.0+305+5e198a41 AppStream 47 k containers-common x86_64 1:0.1.40-11.module_el8.2.0+377+92552693 AppStream 50 k fribidi x86_64 1.0.4-8.el8 install dig command AppStream 89 k fuse-overlayfs x86_64 0.7.2-5.module_el8.2.0+305+5e198a41 AppStream 60 k git x86_64 2.18.4-2.el8_2 install nslookup command AppStream 186 k git-core x86_64 2.18.4-2.el8_2 install dig tool AppStream 4.0 M git-core-doc noarch 2.18.4-2.el8_2 install dig tool AppStream 2.3 M gtk-update-icon-cache x86_64 3.22.30-5.el8 install dig AppStream 32 k gtk3 x86_64 3.22.30-5.el8 install nslookup tool AppStream 4.5 M java-1.8.0-openjdk-headless x86_64 1:1.8.0.262.b10-0.el8_2 AppStream 34 M java-11-openjdk x86_64 1:11.0.8.10-0.el8_2 install dig AppStream 249 k java-11-openjdk-devel x86_64 1:11.0.8.10-0.el8_2 AppStream 3.4 M java-11-openjdk-headless x86_64 1:11.0.8.10-0.el8_2 AppStream 40 M libdrm x86_64 2.4.100-1.el8 install dig command AppStream 164 k libepoxy x86_64 1.5.3-1.el8 install nslookup command AppStream 225 k libmaxminddb x86_64 1.2.0-7.el8 AppStream 25 k libtiff x86_64 4.0.9-17.el8 AppStream 188 k libvncserver x86_64 0.9.11-15.el8_2.1 AppStream 275 k libwayland-client x86_64 1.17.0-1.el8 AppStream 39 k libwayland-cursor x86_64 1.17.0-1.el8 AppStream 26 k
Step 3: Install Dig and nslookup command
Now you can install bind-utils package using dnf install bind-utils -y command as shown below.
[root@localhost ~]# dnf install bind-utils -y CentOS-8 - AppStream 3.8 kB/s | 4.3 kB 00:01 CentOS-8 - Base 5.7 kB/s | 3.9 kB 00:00 CentOS-8 - Extras 2.0 kB/s | 1.5 kB 00:00 CentOS-8 - PowerTools 6.7 kB/s | 4.3 kB 00:00 Extra Packages for Enterprise Linux Modular 8 - x86_64 7.7 kB/s | 8.4 kB 00:01 Extra Packages for Enterprise Linux 8 - x86_64 9.1 kB/s | 7.6 kB 00:00 Extra Packages for Enterprise Linux 8 - x86_64 165 kB/s | 8.0 MB 00:49 Google Cloud SDK 271 B/s | 454 B 00:01 RPM Fusion for EL 8 - Free - Updates 4.8 kB/s | 3.7 kB 00:00 Dependencies resolved. ======================================================================================================================================================================== Package Architecture Version Repository Size ======================================================================================================================================================================== Installing: bind-utils x86_64 32:9.11.13-5.el8_2 AppStream 443 k Installing dependencies: bind-libs x86_64 32:9.11.13-5.el8_2 AppStream 171 k bind-libs-lite x86_64 32:9.11.13-5.el8_2 AppStream 1.2 M bind-license noarch 32:9.11.13-5.el8_2 AppStream 100 k python3-bind noarch 32:9.11.13-5.el8_2 AppStream 148 k Transaction Summary ======================================================================================================================================================================== Install 5 Packages Total download size: 2.0 M Installed size: 4.7 M Downloading Packages: (1/5): bind-license-9.11.13-5.el8_2.noarch.rpm 366 kB/s | 100 kB 00:00 (2/5): bind-libs-9.11.13-5.el8_2.x86_64.rpm 572 kB/s | 171 kB 00:00 (3/5): bind-utils-9.11.13-5.el8_2.x86_64.rpm 1.8 MB/s | 443 kB 00:00 (4/5): bind-libs-lite-9.11.13-5.el8_2.x86_64.rpm 1.8 MB/s | 1.2 MB 00:00 (5/5): python3-bind-9.11.13-5.el8_2.noarch.rpm 375 kB/s | 148 kB 00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Total 1.7 MB/s | 2.0 MB 00:01 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : bind-license-32:9.11.13-5.el8_2.noarch 1/5 Installing : bind-libs-lite-32:9.11.13-5.el8_2.x86_64 2/5 Installing : bind-libs-32:9.11.13-5.el8_2.x86_64 3/5 Installing : python3-bind-32:9.11.13-5.el8_2.noarch 4/5 Installing : bind-utils-32:9.11.13-5.el8_2.x86_64 5/5 Running scriptlet: bind-utils-32:9.11.13-5.el8_2.x86_64 5/5 Verifying : bind-libs-32:9.11.13-5.el8_2.x86_64 1/5 Verifying : bind-libs-lite-32:9.11.13-5.el8_2.x86_64 2/5 Verifying : bind-license-32:9.11.13-5.el8_2.noarch 3/5 Verifying : bind-utils-32:9.11.13-5.el8_2.x86_64 4/5 Verifying : python3-bind-32:9.11.13-5.el8_2.noarch 5/5 Installed: bind-utils-32:9.11.13-5.el8_2.x86_64 bind-libs-32:9.11.13-5.el8_2.x86_64 bind-libs-lite-32:9.11.13-5.el8_2.x86_64 bind-license-32:9.11.13-5.el8_2.noarch python3-bind-32:9.11.13-5.el8_2.noarch Complete!
Step 4: Check dig and nslookup version
If you want to check dig
command version then you need to use dig -v
command as shown below. You can also see you are not getting any "dig command not found"
error.
[root@localhost ~]# dig -v DiG 9.11.13-RedHat-9.11.13-5.el8_2
If you want to check nslookup
command version then you need to use nslookup -version
command as shown below.
[root@localhost ~]# nslookup -version nslookup 9.11.13-RedHat-9.11.13-5.el8_2
Step 5: Test Dig Command
You can test the dig command by simply quering the DNS Nameservers about google.com
using dig google.com
command as shown below.
[root@localhost ~]# dig google.com ; <<>> DiG 9.11.13-RedHat-9.11.13-5.el8_2 <<>> google.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11200 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;google.com. IN A ;; ANSWER SECTION: google.com. 296 IN A 216.58.197.78 ;; Query time: 3 msec ;; SERVER: 192.168.0.1#53(192.168.0.1) ;; WHEN: Sat Sep 12 14:27:11 EDT 2020 ;; MSG SIZE rcvd: 55
Step 6: Test nslookup command
Like above, you can test the nslookup
command by simply querying Internet Name Servers about google.com
using nslookup google.com
command as shown below.
[root@localhost ~]# nslookup google.com Server: 192.168.0.1 Address: 192.168.0.1#53 Non-authoritative answer: Name: google.com Address: 216.58.197.78 Name: google.com Address: 2404:6800:4007:800::200e
Recommended Posts:-
8 Easy Ways to check Ubuntu Version using Bash Command Line
5 Easy Steps to Install Openssh-Server on Ubuntu 20.04 to Enable SSH
15 Practical Bash For Loop Examples in Linux/Unix for Professionals
How to Install Rust Programming Language in Linux Using 6 Best Steps
10 Useful iproute2 tools examples to Manage Network Connections in Linux
6 Popular Methods to List All Running Services Under Systemd in Linux
Unix/Linux Find Files and Directories Owned By a Particular User(5 Useful Examples)
33 Practical Examples of ulimit command in Linux/Unix for Professionals
How to Limit CPU Limit of a Process Using CPULimit in Linux (RHEL/CentOS 7/8)