host: command not found – Install Host Command on CentOS

How to Install Host Command on CentOS 7 / Redhat 7 Linux Servers

Follow the below steps to install Host command on CentOS 7 / RHEL 7 server.

ERROR : -bash: host: command not found

FIX :

root@server [~]# host -t A globedrill.com
-bash: host: command not found

On CentOS and Redhat servers, host command is provided by bind-utils package.

1. You must log into your Linux server as ‘root’ user

2. Use rpm query all command to check whether bind-utils package is installed on the server.
 

root@server [~]# host -t A globedrill.com
-bash: host: command not found

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


 
bind-utils package is not installed on the above server and that is the reason why host command shows not found.

3. Install bind-utils using yum command

command to install bind-utils:

# yum install 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!


 
Now try host command and it will work fine.

root@server [~]# host -t A globedrill.com
globedrill.com has address 108.161.135.182
 

How to Download and install bind-utils rpm on centos / redhat 7 server

1. Log into your CentOS 7 / RHEL 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. You can either install the downloaded file using yum command or rpm command

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

The above command will install the bind-utils package and the required dependencies

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

First download and install the required dependencies if you are installing using rpm command.