yum
- RPM パッケージを操作するためのコマンド
- rpm との違い
- 複数のパッケージをまとめてダウンロード
- 依存関係を考慮したパッケージ操作
- アップデートパッケージの管理
アップデート確認
# yum list updates # yum check-update
パッケージ情報の更新
# yum makecache
ライブラリ名からパッケージを検索
# yum provides ライブラリ名
changelog の導入
パッチ等がリリースされたときに更新情報を確認する
インストール
# yum install yum-plugin-changelog
httpd のチェンジログを確認
# yum update --changelog httpd
自身でインストールしたりアップデートしたパッケージを洗い出す
# yum history list all
history list で得られた番号を指定するとそのトランザクションで何をしたかが分かる
# yum history info 10
パッケージ検索
# yum search キーワード
情報
# yum info パッケージ名
モジュールがどのパッケージに所属しているか表示
# yum provides /lib64/libwrap.so.0
依存関係の検索
# yum deplist dovecot
グループの一覧表示
# yum grouplist
指定したグループのインストール
# yum groupinstallall グループ名
インストール済
# yum list installed
全ての重複バージョンの検索
list と search に対して有効
# yum --showduplicates search httpd Loaded plugins: fastestmirror, ovl Loading mirror speeds from cached hostfile * base: www.ftp.ne.jp * extras: www.ftp.ne.jp * updates: www.ftp.ne.jp =================================== N/S matched: httpd =================================== keycloak-httpd-client-install-0.6-1.el7.noarch : Tools to configure Apache HTTPD as : Keycloak client libmicrohttpd-devel-0.9.33-2.el7.i686 : Development files for libmicrohttpd libmicrohttpd-devel-0.9.33-2.el7.x86_64 : Development files for libmicrohttpd libmicrohttpd-doc-0.9.33-2.el7.noarch : Documentation for libmicrohttpd python2-keycloak-httpd-client-install-0.6-1.el7.noarch : Tools to configure Apache HTTPD : as Keycloak client httpd-2.4.6-67.el7.centos.x86_64 : Apache HTTP Server httpd-2.4.6-67.el7.centos.2.x86_64 : Apache HTTP Server httpd-2.4.6-67.el7.centos.5.x86_64 : Apache HTTP Server httpd-2.4.6-67.el7.centos.6.x86_64 : Apache HTTP Server httpd-devel-2.4.6-67.el7.centos.x86_64 : Development interfaces for the Apache HTTP server httpd-devel-2.4.6-67.el7.centos.2.x86_64 : Development interfaces for the Apache HTTP : server httpd-devel-2.4.6-67.el7.centos.5.x86_64 : Development interfaces for the Apache HTTP : server httpd-devel-2.4.6-67.el7.centos.6.x86_64 : Development interfaces for the Apache HTTP : server httpd-manual-2.4.6-67.el7.centos.noarch : Documentation for the Apache HTTP server httpd-manual-2.4.6-67.el7.centos.2.noarch : Documentation for the Apache HTTP server httpd-manual-2.4.6-67.el7.centos.5.noarch : Documentation for the Apache HTTP server httpd-manual-2.4.6-67.el7.centos.6.noarch : Documentation for the Apache HTTP server httpd-tools-2.4.6-67.el7.centos.x86_64 : Tools for use with the Apache HTTP Server httpd-tools-2.4.6-67.el7.centos.2.x86_64 : Tools for use with the Apache HTTP Server httpd-tools-2.4.6-67.el7.centos.5.x86_64 : Tools for use with the Apache HTTP Server httpd-tools-2.4.6-67.el7.centos.6.x86_64 : Tools for use with the Apache HTTP Server libmicrohttpd-0.9.33-2.el7.i686 : Lightweight library for embedding a webserver in : applications libmicrohttpd-0.9.33-2.el7.x86_64 : Lightweight library for embedding a webserver in : applications mod_auth_mellon-0.11.0-4.el7.x86_64 : A SAML 2.0 authentication module for the Apache : Httpd Server mod_dav_svn-1.7.14-10.el7.x86_64 : Apache httpd module for Subversion server mod_dav_svn-1.7.14-11.el7_4.x86_64 : Apache httpd module for Subversion server Name and summary matches only, use "search all" for everything.
Tips
特定のパッケージを更新対象としない(kernel,sudoとつくもの) 場合には、
/etc/yum.conf
に下記を追加exclude=kernel* sudo*
特定のリポジトリを使用する(例は、remi)
# yum --enablerepo=remi install httpd
その他コマンド
- yum-builddep
- yum-config-manager
- yum-debug-dump
- yum-debug-restore
- yum-groups-manager
- yumdownloader
- yum-complete-transaction
- yumdb
- yum-utils
設定ファイル
/etc/yum.repos.d/CentOS-Base.repo
item contents base リポジトリID mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os 自動的にミラーサイトを探し出す gpgcheck=1 GPG による署名のチェックが指定される gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 enabled=1 このリポジトリを使用する
エラー
Warning: RPMDB altered outside of yum
yum 以外のコマンドやソフトで RPMDB が変更されたときに表示される
解消するには下記を実行する
# yum clean all
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
yum 実行中に接続が切れたりすると yum トランザクションが残っていることがある
解消方法
$ sudo yum instal yum-utils $ sudo yum-complete-transaction
The following packages have pending transactions
Ansible 実行中に遭遇
解消
# yum-complete-transaction --cleanup-only