dig: command not found – How to Install Dig command on Linux
How to install Dig command (Bind Utils) on CentOS 7 / RHEL 7 / cPanel Servers
ERROR :
-bash: dig: command not found
bash: /usr/bin/dig: No such file or directory
FIX :
root@server [/]# dig +trace google.com
-bash: dig: command not found
Error shows there is no dig command found on the server.
On CentOS and redhat servers dig command is provided by bind-utils package.
1. Log into your Linux Server via SSH as root user
2. Check whether bind-utils package is already installed on your Linux Server.
root@server [/]#
Bind-utils package was not installed on the above server and that is the reason why dig command shows not found error.
3. On CentOS and Redhat servers, you can install bind-utils package using yum
Command to install bind-utils :
# yum install bind-utils
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 [/]#
4. Run the following command to verify installation by checking dig version
DiG 9.9.4-RedHat-9.9.4-29.el7_2.3
How to Download and Install bind-utils package
1. You must log into your CentOS 7 server via SSH as ‘root’ user to download bind-utils package
2. Download bind-utils package from centos website using wget command
3. Install the downloaded rpm file using yum command or rpm command
The above command will install bind-utils package and the required dependencies.
You must install the required dependencies if you are installing using rpm command.