nslookup: command not found – Install nslookup on CentOS 7

How to install nslookup Command on Centos 7 / Redhat 7 Server

Follow the below steps to install nslookup Command on Centos 7 / Redhat 7 Server.

ERROR : :

root@server [/]# nslookup
-bash: nslookup: command not found

FIX :

On CentOS and Redhat 7 server, nslookup command is provided by bind-utils package.

1. Log into your Linux Server via SSH as root usser

2. Check whether bind-utils package is installed.

Run the below command to check whether bind-utils is installed or not :

# rpm -qa | grep bind-utils
 

root@server [/]# rpm -qa | grep bind-utils
root@server [/]#

 
bind-utils package is not installed on the above server.

3 You can install bind-utils package using yum command

command to install bind-utils : #yum install bind-utils
 

root@server [/]# rpm -qa | grep bind-utils

root@server [/]# yum install bind-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.linux.ncsu.edu
* extras: mirror.ash.fastserv.com
* updates: centos.mirror.nac.net
Resolving Dependencies
–> Running transaction check
—> Package bind-utils.x86_64 32:9.9.4-29.el7_2.3 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
bind-utils x86_64 32:9.9.4-29.el7_2.3 updates 200 k

Transaction Summary
========================================================================================================================================================================
Install 1 Package

Total download size: 200 k
Installed size: 434 k
Is this ok [y/d/N]: y
Downloading packages:
bind-utils-9.9.4-29.el7_2.3.x86_64.rpm | 200 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 32:bind-utils-9.9.4-29.el7_2.3.x86_64 1/1
Verifying : 32:bind-utils-9.9.4-29.el7_2.3.x86_64 1/1

Installed:
bind-utils.x86_64 32:9.9.4-29.el7_2.3

Complete!

 

root@server [/]# nslookup globedrill.com
Server: 4.2.2.1
Address: 4.2.2.1#53

Non-authoritative answer:
Name: globedrill.com
Address: 108.161.135.182

 
bind-utils package is now installed on the server and nslookup command works fine.
 

How to Download and install bind-utils rpm

1. Log into your CentOS 7 / RHEL 7 server as root user

2. Download bind-utils package from CentOS website using wget command

# wget http://mirror.centos.org/centos/7/os/x86_64/Packages/bind-utils-9.11.4-16.P2.el7.x86_64.rpm

3. Install the downloaded rpm file by using yum or rpm command

# yum install bind-utils-9.11.4-16.P2.el7.x86_64.rpm

yum will install bind-utils package and the required dependencies

# rpm -ivh bind-utils-9.11.4-16.P2.el7.x86_64.rpm

You must first download and install the required dependencies if you’re installing the package using rpm command.

Important: Install the below dependencies only if it is not installed

The below dependencies are required :


bind-libs(x86-64) = 32:9.11.4-16.P2.el7_8.3
bind-libs-lite(x86-64) = 32:9.11.4-16.P2.el7_8.3
libGeoIP.so.1()(64bit)
libbind9.so.160()(64bit)
libc.so.6()(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libcap.so.2()(64bit)
libcom_err.so.2()(64bit)
libcrypto.so.10()(64bit)
libcrypto.so.10(libcrypto.so.10)(64bit)
libdl.so.2()(64bit)
libdns.so.1102()(64bit)
libgssapi_krb5.so.2()(64bit)
libidn.so.11()(64bit)
libidn.so.11(LIBIDN_1.0)(64bit)
libirs.so.160()(64bit)
libisc.so.169()(64bit)
libisccfg.so.160()(64bit)
libk5crypto.so.3()(64bit)
libkrb5.so.3()(64bit)
libkrb5.so.3(krb5_3_MIT)(64bit)
liblwres.so.160()(64bit)
libm.so.6()(64bit)
libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.2.5)(64bit)
libxml2.so.2()(64bit)
libz.so.1()(64bit)
rpmlib(CompressedFileNames) - 3.0.4-1
rpmlib(FileDigests) - 4.6.0-1
rpmlib(PayloadFilesHavePrefix) - 4.0-1
rtld(GNU_HASH)
rpmlib(PayloadIsXz) - 5.2-1