一馬力のメモ帳

MVSからLinuxまで。基盤屋さんは眠らない

コマンドが含まれるパッケージをyumコマンドで探す方法

毎度。一馬力です。
インストール直後のCentOSでいつも使うコマンドが無い!!
ってとき。どのパッケージにコマンド含まれているのかなー?
って事ありますよね?

そんなわけで、今回は「コマンドが含まれるパッケージをyumコマンドで探す方法」です。

f:id:htbariki:20161203173233p:plain

目次


今回はミニマムインストールしたCentOS6で
”scp”コマンドがどのパッケージに含まれるのか探してみたいと思います。

利用するコマンドは”yum”。
yumコマンドはオプションの使い方をマスターすると心強いツールです。

yum searchで探す→NG

yumコマンドで探しものするときは”yum search”コマンドを利用しますが

searchオプションは

  • パッケージ名
  • サマリー

しか検索してくれない。今回はパッケージに含まれるコマンドを知りたいのでNG

試しに”yum search scp"してみると
“trilead-ssh2”パッケージが表示された。↓

root@centos66 ~]# yum search scp
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
===================================================================== 一致: scp ======================================================================
trilead-ssh2.noarch : SSH-2 protocol implementation in pure Java

追加で”yum info”コマンドで内容を見てみるが,scpコマンドが含まれる気配はない、、、。
そもそも”scp”のキーワードがどの部分に引っかかったのか不明。

[root@centos66 ~]# yum info trilead-ssh2.noarch
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
利用可能なパッケージ
名前                : trilead-ssh2
アーキテクチャ      : noarch
バージョン          : 213
リリース            : 6.2.el6
容量                : 248 k
リポジトリー        : base
要約                : SSH-2 protocol implementation in pure Java
URL                 : http://www.trilead.com/Products/Trilead_SSH_for_Java/
ライセンス          : BSD
説明                : Trilead SSH-2 for Java is a library which implements the SSH-2 protocol in pure
                    : Java (tested on J2SE 1.4.2 and 5.0). It allows one to connect to SSH servers
                    : from within Java programs. It supports SSH sessions (remote command execution
                    : and shell access), local and remote port forwarding, local stream forwarding,
                    : X11 forwarding and SCP. There are no dependencies on any JCE provider, as all
                    : crypto functionality is included.

[root@centos66 ~]#

 yum providesで探す → 怒られる

本命の検索方法 “yum provides”で “scp”を検索してみると
警告を頂いてしまった(汗)

[root@centos66 ~]# yum provides scp
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
警告: yum のバージョン 3.0.x は、誤ってファイル名に対して一致するでしょう。
その振る舞いをするには「*/scp」もしくは「*bin/scp」が使用できます。
No Matches found
[root@centos66 ~]#

ご指摘の通り"「/scp」もしくは「bin/scp」”で探しみます。
yum先生すいませんでした。

 yum providesで探す → 成功

yum先生に怒られたので,”yum provides */scp”で再検索してみると
scpコマンドは"openssh-clients”パッケージに含まれる事が分かりました。

[root@centos66 ~]# yum provides */scp
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
openssh-clients-5.3p1-117.el6.x86_64 : An open source SSH client applications
リポジトリー        : base
一致          :
ファイル名    : /usr/bin/scp



openssh-clients-5.3p1-118.1.el6_8.x86_64 : An open source SSH client applications
リポジトリー        : updates
一致          :
ファイル名    : /usr/bin/scp



[root@centos66 ~]#

念のため”yum info openssh-clients”で確認してみるとそれらしい記述
(yum先生を疑っているわけでは無いのですが念のためです)

[root@centos66 ~]# yum info openssh-clients
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
利用可能なパッケージ
名前                : openssh-clients
アーキテクチャ      : x86_64
バージョン          : 5.3p1
リリース            : 118.1.el6_8
容量                : 442 k
リポジトリー        : updates
要約                : An open source SSH client applications
URL                 : http://www.openssh.com/portable.html
ライセンス          : BSD
説明                : OpenSSH is a free version of SSH (Secure SHell), a program for logging
                    : into and executing commands on a remote machine. This package includes
                    : the clients necessary to make encrypted connections to SSH servers.

[root@centos66 ~]#

無事にコマンドに含まれるパッケージを見つけられれました。

みなさんも,困ったときはこの記事を参考にyum先生に聞いて見て下さい

参考資料

試した環境

HW

Product Name
  ProLiant DL160 Gen8
CPU
  4 CPUs x Intel(R) Xeon(R) CPU E5-2603 0 @ 1.80GHz
Memory
  16GB
iLO Firmware Version
  2.44 Jul 19 2016

仮想化基盤

vmware ESXi 6.0.0 (Build 3620759)

ゲストOS

[root@centos66 ~]# cat /etc/redhat-release
CentOS release 6.6 (Final)
[root@centos66 ~]# uname -a
Linux centos66 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@centos66 ~]#