[实践OK]FreeBSD 11.1 的 nslookup 、dig 指令,git和nc命令,CentOS如何只知道命令不知道哪个包,而通过YUM的provides命令反查nslookup所在的软件包的?

jackxiang 2017-10-11 22:29 | |
第一个问题,FreeBSD 10 之後的版本改用unbound 代替了bind
所以已經沒有 nslookup , dig 等指令
可以改用host , drill 等指令
但如果還是習慣 nslookup的話
可以安裝bind-tools 套件

#cd /usr/ports/dns/bind-tools
#make install

安裝完後看看是否真的出現
# which nslookup
/usr/local/bin/nslookup

From:http://blog.sina.com.tw/helloworld/article.php?entryid=651089

cd /usr/ports/devel/git/ && make install clean
nc FreeBSD自带,而netcat需要自己安装,如下:
cd /usr/ports/net/netcat/ && make install clean

第二个问题,关于CentOS如何只知道命令不知道哪个包,而通过YUM的provides命令反查nslookup所在的软件包的?

32:bind-utils-9.9.4-51.el7.x86_64 : Utilities for querying DNS name servers
源    :updates
匹配来源:
文件名    :/usr/bin/nslookup

yum provides *bin/nslookup

32:bind-utils-9.9.4-38.el7_3.3.x86_64 : Utilities for querying DNS name servers
源    :@updates
匹配来源:
文件名    :/usr/bin/nslookup

================================================

nslookup這個指令對於網路除錯來說,應該是很多人都很習慣的工具
如果發現安裝好的Linux系統少了這個指令

[root@example ~]# nslookup myip.pass.tw
-bash: nslookup: command not found

[root@example ~]# which nslookup
/usr/bin/which: no nslookup in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

直接安裝看看咧? 找不到這個套件名稱
[root@example ~]# yum -y install nslookup
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirror.sfo12.us.leaseweb.net
* extras: mirrors.linode.com
* updates: mirrors.linode.com
No package nslookup available.
Error: Nothing to do

試試 yum provides 看看nslookup 是包含在哪個套件中
[root@example ~]# yum provides nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirror.sfo12.us.leaseweb.net
* extras: mirrors.linode.com
* updates: mirrors.linode.com
Warning: 3.0.x versions of yum would erroneously match against filenames.
You can use "*/nslookup" and/or "*bin/nslookup" to get that behaviour
No Matches found

依提示再搜尋一下,可以發現包含在bind-utils 套件中
[root@example ~]# yum provides */nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirror.sfo12.us.leaseweb.net
* extras: mirrors.linode.com
* updates: mirrors.linode.com
base/filelists_db                                                                                                                                                                                                     | 6.4 MB     00:00
epel/filelists_db                                                                                                                                                                                                     | 7.7 MB     00:01
extras/filelists_db                                                                                                                                                                                                   |  25 kB     00:00
updates/filelists_db                                                                                                                                                                                                  | 1.5 MB     00:00
zsh-4.3.11-4.el6.centos.2.x86_64 : A powerful interactive shell
Repo        : base
Matched from:
Filename    : /usr/share/zsh/4.3.11/functions/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6.x86_64 : Utilities for querying DNS name servers
Repo        : base
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.2.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.1.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

[root@example ~]# yum provides *bin/nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirrors.kernel.org
* extras: mirrors.linode.com
* updates: mirrors.linode.com
32:bind-utils-9.8.2-0.62.rc1.el6.x86_64 : Utilities for querying DNS name servers
Repo        : base
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.2.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

32:bind-utils-9.8.2-0.62.rc1.el6_9.1.x86_64 : Utilities for querying DNS name servers
Repo        : updates
Matched from:
Filename    : /usr/bin/nslookup

安裝 bind-utils
[root@example ~]# yum -y install bind-utils
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirrors.kernel.org
* extras: mirrors.linode.com
* updates: mirrors.linode.com
Resolving Dependencies
--> Running transaction check
---> Package bind-utils.x86_64 32:9.8.2-0.62.rc1.el6_9.4 will be installed
--> Processing Dependency: bind-libs = 32:9.8.2-0.62.rc1.el6_9.4 for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: liblwres.so.80()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libisccfg.so.82()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libisccc.so.80()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libisc.so.83()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libdns.so.81()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Processing Dependency: libbind9.so.80()(64bit) for package: 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64
--> Running transaction check
---> Package bind-libs.x86_64 32:9.8.2-0.62.rc1.el6_9.4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
Package                                                Arch                                               Version                                                                 Repository                                           Size
=============================================================================================================================================================================================================================================
Installing:
bind-utils                                             x86_64                                             32:9.8.2-0.62.rc1.el6_9.4                                               updates                                             189 k
Installing for dependencies:
bind-libs                                              x86_64                                             32:9.8.2-0.62.rc1.el6_9.4                                               updates                                             892 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install       2 Package(s)

Total download size: 1.1 M
Installed size: 2.7 M
Downloading Packages:
(1/2): bind-libs-9.8.2-0.62.rc1.el6_9.4.x86_64.rpm                                                                                                                                                                    | 892 kB     00:00
(2/2): bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64.rpm                                                                                                                                                                   | 189 kB     00:00
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                         44 MB/s | 1.1 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : 32:bind-libs-9.8.2-0.62.rc1.el6_9.4.x86_64                                                                                                                                                                                1/2
  Installing : 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64                                                                                                                                                                               2/2
  Verifying  : 32:bind-libs-9.8.2-0.62.rc1.el6_9.4.x86_64                                                                                                                                                                                1/2
  Verifying  : 32:bind-utils-9.8.2-0.62.rc1.el6_9.4.x86_64                                                                                                                                                                               2/2

Installed:
  bind-utils.x86_64 32:9.8.2-0.62.rc1.el6_9.4

Dependency Installed:
  bind-libs.x86_64 32:9.8.2-0.62.rc1.el6_9.4

Complete!

来自:http://blog.sina.com.tw/helloworld/article.php?pbgid=170996&entryid=657249

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/9491/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2017-10-11 23:21
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]