yumで使用するrepositoryの優先度設定

yumで使用するrepositoryの優先順位を設定したくてググってみたところ、それ用のプラグインがあるらしい。

yum install yum-plugin-priorities

上記コマンドでインストール。

あとは設定したいrepoファイルを開いて、priorityオプションを追加。
今回はとりあえずremiを設定。

emacs /etc/yum.repos.d/remi.repo
# remi.repo
[remi]
name=Les RPM de remi pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror
enabled=0
priority=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[中略]

[remi-php56]
name=Les RPM de remi de PHP 5.6 pour Enterprise Linux 6 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/6/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=0
priority=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi

[後略]

priorityのデフォルト値は99。
値が大きいほうが優先度が低く、小さいほうが優先度が高い。
最初この仕様を知らず、値を100に設定してなんで読み込まないんじゃー!!とキレていた。
だって大きいほうが優先だと思うじゃん……。

参考
CentOS6 で remi から php や mysql をインストールするための yum の設定 - Qiita