[root@linux ~]# dig www.baidu.com
-bash: dig: command not found
解决方法: 安装bind-utils即可:yum -y install bind-utils
[root@linux ~]# yum -y install bind-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.x86_64 32:9.9.4-29.el7_2.4 will be installed
--> Processing Dependency: bind-libs = 32:9.9.4-29.el7_2.4 for package: 32:bind-utils-9.9.4-29.el7_2.4.x86_64
--> Processing Dependency: liblwres.so.90()(64bit) for package: 32:bind-utils-9.9.4-29.el7_2.4.x86_64
--> Processing Dependency: libisccfg.so.90()(64bit) for package: 32:bind-utils-9.9.4-29.el7_2.4.x86_64
--> Processing Dependency: libisccc.so.90()(64bit) for package: 32:bind-utils-9.9.4-29.el7_2.4.x86_64
--> Processing Dependency: libisc.so.95()(64bit) for package: 32:bind-utils-9.9.4-29.el7_2.4.x86_64
--> Processing Dependency: libdns.so.100()(64bit) for package: 32:bind-utils-9.9.4-29.el7_2.4.x86_64
--> Processing Dependency: libbind9.so.90()(64bit) for package: 32:bind-utils-9.9.4-29.el7_2.4.x86_64
--> Running transaction check
---> Package bind-libs.x86_64 32:9.9.4-29.el7_2.4 will be installed
--> Processing Dependency: bind-license = 32:9.9.4-29.el7_2.4 for package: 32:bind-libs-9.9.4-29.el7_2.4.x86_64
--> Finished Dependency Resolution
Error: Package: 32:bind-libs-9.9.4-29.el7_2.4.x86_64 (updates)
Requires: bind-license = 32:9.9.4-29.el7_2.4
Installed: 32:bind-license-9.9.4-72.el7.noarch (@anaconda)
bind-license = 32:9.9.4-72.el7
Available: 32:bind-license-9.9.4-29.el7.noarch (CentOS)
bind-license = 32:9.9.4-29.el7
Available: 32:bind-license-9.9.4-29.el7_2.1.noarch (updates)
bind-license = 32:9.9.4-29.el7_2.1
Available: 32:bind-license-9.9.4-29.el7_2.2.noarch (updates)
bind-license = 32:9.9.4-29.el7_2.2
Available: 32:bind-license-9.9.4-29.el7_2.3.noarch (updates)
bind-license = 32:9.9.4-29.el7_2.3
Available: 32:bind-license-9.9.4-29.el7_2.4.noarch (updates)
bind-license = 32:9.9.4-29.el7_2.4
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
报错信息如上所示:
Resolving Dependencies
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
问题分析: 系统安装自带的bind类rpm包冲突引起的
解决方法: 查找系统已安装的rpm包,卸载后再重装
[root@linux ~]# rpm -qa|grep bind
bind-libs-lite-9.9.4-72.el7.x86_64
bind-license-9.9.4-72.el7.noarch
[root@linux ~]# yum remove bind-libs-lite-9.9.4-72.el7.x86_64
[root@linux ~]# yum remove bind-license-9.9.4-72.el7.noarch
[root@linux ~]# yum -y install bind-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base | 3.6 kB 00:00
epel | 4.7 kB 00:00
extras | 2.9 kB 00:00
........
Installed:
bind-utils.x86_64 32:9.11.4-16.P2.el7_8.6
Dependency Installed:
bind-libs.x86_64 32:9.11.4-16.P2.el7_8.6
bind-libs-lite.x86_64 32:9.11.4-16.P2.el7_8.6
bind-license.noarch 32:9.11.4-16.P2.el7_8.6
Complete!
验证dig是否安装成功:
[root@linux ~]# dig www.baidu.com
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-16.P2.el7_8.6 <<>> www.baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 59160
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.baidu.com. IN A
;; ANSWER SECTION:
www.baidu.com. 1060 IN CNAME www.a.shifen.com.
www.a.shifen.com. 160 IN A 220.181.38.150
www.a.shifen.com. 160 IN A 220.181.38.149
;; Query time: 0 msec
;; SERVER: 103.224.222.222#53(103.224.222.222)
;; WHEN: Fri Aug 28 15:19:29 CST 2020
;; MSG SIZE rcvd: 90