- Vixual - http://www.vixual.net/blog -

CentOS 6.x 安裝 nslookup 的步驟 (與 yum 如何查詢套件)

Linode VPS 佈署的 CentOS 6.x 已經沒有 nslookup 這個工具程式了!!

以下將藉由安裝 nslookup 的同時,順便也復習一下 yum 的查詢套件功能...

安裝步驟

1. 執行 nslookup,系統回應「沒有這個指令」:

$ nslookup
-bash: nslookup: command not found

2. 直覺地用 yum 安裝 nslookup,結果跟你說「套件不存在」:

$ yum install nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.kernel.org
 * elrepo: ftp.osuosl.org
 * epel: mirrors.kernel.org
 * extras: mirrors.kernel.org
 * rpmforge: mirror.hmc.edu
 * updates: mirrors.kernel.org
Setting up Install Process
No package nslookup available.
Error: Nothing to do

3. 我們可以加 provides 參數查詢 nslookup 存在哪個套件中:

$ yum provides nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirror.prgmr.com
* extras: mirrors.linode.com
* rpmforge: mirror.hmc.edu
* 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

4. 雖然第一時間也是查不到,不過在上面遺留的訊息中, yum 有進一步顯示說檔案可能藏在 bin 目錄中。我們依樣畫葫蘆:

$ yum provides *bin/nslookup
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.linode.com
* epel: mirror.prgmr.com
* extras: mirrors.linode.com
* rpmforge: mirror.hmc.edu
* updates: mirrors.linode.com
32:bind-utils-9.8.2-0.17.rc1.el6_4.6.x86_64 : Utilities for querying DNS name
                                            : servers
Repo        : base
Matched from:
Filename    : /usr/bin/nslookup

皇天不負苦心人,原來是藏在 bind-utils 套件中。

5. 事不宜遲,咱們快點安裝吧:

$ yum install bind-utils

PS. 連帶的 dighost 也存在於 bind-utils 套件裡

參考網頁