CentOS6にEPELリポジトリを追加する †
CentOS6にEPELリポジトリを追加登録する手順を記しています。
note:
下記にpriorityについて記述しています。
複数の外部リポジトリを登録している場合は、priorityの値を調整したり、
リポジトリファイル内のenableの値をoff(0)にすることにより、リポジトリを無効にすることもできます。
関連記事 †
リポジトリに優先順位を設定するyum-plugin-prioritiesのインストール †
CentOSのリポジトリに今回EPELのリポジトリを追加するため、各リポジトリに優先順位を設定するため
以下のコマンドでyum-plugin-prioritiesをインストールします。
作業はrootユーザで行なってください。
yum -y install yum-plugin-priorities
CentOS6標準リポジトリのpriorityの設定 †
上記でyumコマンドによりyum-plugin-prioritiesをインストールしました。
これによりリポジトリの優先順位を設定することができます。
CentOS6標準リポジトリは優先順位を一番にしたいので以下のように設定します。
作業はrootユーザで行なってください。
- 対象ファイル
/etc/yum.repos.d/CentOS-Base.repo
- 修正ファイル
追加した部分は、赤色になっています。
# CentOS-Base.repo
#
# 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]
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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1
#released updates
[updates]
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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1
#additional packages that may be useful
[extras]
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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1
#additional packages that extend functionality of existing packages
[centosplus]
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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priorityについてですが、以下のURLが参考になります。
priorityのでデフォルト値は99、範囲は1から99になります。
http://wiki.centos.org/PackageManagement/Yum/Priorities#head-6f52124e909c1691eb0c501ba38ae9202b66d6da
EPELリポジトリ用ファイルの入手 †
この資料ではブラウザからダウンロードしました。
端末を使用している方はwgetコマンドなどでダウンロードしてください。
- EPELサイトに移動
http://fedoraproject.org/wiki/EPEL
- 今回はCentOS6で64bit版を使用しているので、EPEL6 x86_64をクリック
(32bit版を利用してい方はi386をクリック)
#ref(): File not found: "01.gif" at page "CentOS/CentOS6にEPELリポジトリを登録する"
- [E]をクリックします。
#ref(): File not found: "02.gif" at page "CentOS/CentOS6にEPELリポジトリを登録する"
- スクロールするとepel-releaseがあるのでクリックします。
#ref(): File not found: "03.gif" at page "CentOS/CentOS6にEPELリポジトリを登録する"
- epel-release-6-8.noarch をクリックしてダウンロードします。
#ref(): File not found: "04.gif" at page "CentOS/CentOS6にEPELリポジトリを登録する"
ちなみにwgetコマンドを利用した場合は以下のようになります。
(2014/02/13 本資料作成時点)
ダウンロードしたリポジトリファイルをインストール †
rootユーザになり、ダウンロードしたファイルをrpmコマンドでインストールします。
rpm -ivh ダウンロードしたrpmファイル
本資料の場合は以下のようになります。
rpm -ivh epel-release-6-8.noarch.rpm
以下は実際にインストールしたときの出力です。
[root@centos6 ~]# rpm -ivh epel-release-6-8.noarch.rpm
警告: epel-release-6-8.noarch.rpm: ヘッダ V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
準備中... ########################################### [100%]
1:epel-release ########################################### [100%]
以下のコマンドでepel-releaseをアップデートします。
yum update epel-release
以上でEPELリポジトリの追加は完了です。