一分一秒真剣勝負!

Ruby, Railsなど。Web系の技術ネタを充実させたい・・が、そうなるかは分からない。

yumのまとめ - 3.yumプラグインの説明とインストール手順

目次に戻る
 必須だと思っているプラグインのみ紹介します。他のプラグイン/ユーティリティはYumUtilsGuides参照。

yum-fastestmirror

速いリポジトリを自動的に選択するプラグイン
[インストール]

$ sudo yum -y install yum-fastestmirror

[使用方法]
 yum list等のコマンド実行時に自動的に動いてくれます。

yum-security

RPMパッケージの更新時に、セキュリティアップデートのみを対象とするオプションを追加するプラグイン
[インストール]

$ sudo yum -y install yum-security

[使用方法]
yumコマンドを「--security」オプション付きで実行する。

$ sudo yum --security check-update
〜更新対象のパッケージリストが表示される〜
$ sudo yum --security update
〜更新対象のパッケージをセキュリティのアップデートのみ更新〜

versionlock

 yum update実行時に、versionlock.listファイルに登録されたパッケージのバージョンアップを禁止するプラグイン
[インストール]

$ sudo yum -y install yum-versionlock
versionlock.list(設定ファイル)は自動生成されない場合があるので、以下のディレクトリに作成する
$ sudo touch /etc/yum/pluginconf.d/versionlock.list

[設定ファイルの編集]
 versionlock.listにアップデートを除外したいパッケージ名を記述していけばいい。例えばyumをアップデートから除外したい場合は、以下のコマンドを実行する。

$ sudo rpm -qa yum
yum-3.2.8-9.el5.centos.2.1

 この結果をversionlock.listにvimエディタ等を使用して追加する。

設定ファイルの確認
$ cat /etc/yum/pluginconf.d/versionlock.list
yum-3.2.8-9.el5.centos.2.1
#gcc-4.1.2-42.el5 ←先頭に'#'を付加すればコメントアウト行になる

[使用方法]
 update系のコマンドを実行時に、設定ファイルに記述されたパッケージがスキップされるようになります。

yum-priorities

 サードパーティリポジトリを追加した場合に、各リポジトリの優先度を設定できるようにするプラグイン

[インストール]

$ sudo yum -y install yum-priorities

[設定ファイルの編集]
 yum-prioritiesを有効か無効に設定できます。通常はenabled=1になっているはず。

$ cat /etc/yum/pluginconf.d/priorities.conf
[main]
enabled = 1 #プラグインの有効/無効(0:無効 1:有効)

[レポジトリ優先度の設定]
 /etc/yum.repos.d 配下のファイルを編集し、各レポジトリの優先度を設定する。例えば、CentOSで標準的に使用するレポジトリの優先度を設定する場合、/etc/yum.repos.d/CentOS-Base.repoを編集する。

# cat CentOS-Base.repo
# CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
priority=1
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
priority=1
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
priority=1
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
priority=1
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
priority=1
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

 「priority=優先度」の形式で設定する。数値は1〜99で、値が小さいほど優先度が高い。priorityが未設定のレポジトリは99が設定されているものとして動作する。