场景

当我们希望安装 wget 命令,而包的名字也是wget,这时使用yum install wget即可,很多软件安装包均是如此。但也有很多不同,比如 nslookup 命令所在的包就是 bind-utils ,安装包名就不同,实际上 yum 提供了很多命令可以进行搜索,比如 yum provides 或者 yum whatprovides。

yum provides 和 yum whatprovides 很类似,因此这里只介绍 yum provides。

查询 nslookup 所在的安装包:

[root@host1 golang]# yum provides nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.ustc.edu.cn
* extras: mirrors.ustc.edu.cn
* updates: mirrors.ustc.edu.cn
WANdisco-git/7/x86_64/filelists_db | 172 kB 00:00:01
base/7/x86_64/filelists_db | 7.2 MB 00:00:01
extras/7/x86_64/filelists_db | 277 kB 00:00:00
updates/7/x86_64/filelists_db | 9.4 MB 00:00:01
32:bind-utils-9.11.4-26.P2.el7.x86_64 : Utilities for querying DNS name servers
Repo : base
Matched from:
Filename : /usr/bin/nslookup



32:bind-utils-9.11.4-26.P2.el7_9.2.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup



32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup



32:bind-utils-9.11.4-26.P2.el7_9.4.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup



32:bind-utils-9.11.4-26.P2.el7_9.5.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup



32:bind-utils-9.11.4-26.P2.el7_9.7.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup



32:bind-utils-9.11.4-26.P2.el7_9.8.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup



32:bind-utils-9.11.4-26.P2.el7_9.9.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/nslookup



[root@host1 golang]#

可以看到,nslookup 命令在 bind-utils 包中,因此需要使用 nslookup 命令就得安装 bind-utils 包:

yum install -y bind-utils