» Linux ディストリビューション » CentOS » パッケージ管理 » yum-priorities

yum-priorities パッケージを導入する

 yum を使用する際、yum-priorities パッケージをインストールすることで、リポジトリの優先度を指定することができます。


ここでの説明は、yum-fastestmirror パッケージがインストールされていることを前提とします。

パッケージのインストール

 yum-priorities パッケージは、yum コマンドを使用してインストールします。

[root@web ~]# yum install yum-priorities

Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
 * addons: ftp.iij.ad.jp
 * extras: ftp.iij.ad.jp
base                      100% |=========================| 1.1 kB    00:00
updates                   100% |=========================|  951 B    00:00
addons                    100% |=========================|  951 B    00:00
extras                    100% |=========================| 1.1 kB    00:00
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package yum-priorities.noarch 0:1.1.10-9.el5.centos set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 yum-priorities          noarch     1.1.10-9.el5.centos  base               11 k

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 11 k
Is this ok [y/N]: y [ y : 上記パッケージをインストールする | N : インストールを中止する ]
Downloading Packages:
(1/1): yum-priorities-1.1 100% |=========================|  11 kB    00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: yum-priorities               ######################### [1/1]

Installed: yum-priorities.noarch 0:1.1.10-9.el5.centos
Complete!

[ CentOS 5 ]

パッケージインストール後の設定

 リポジトリの優先度に関する設定は、1 〜 99 の範囲でレベルを設定します。 CentOS の公式リポジトリ(base, updates, addons, extras, centosplus)は優先度を高く、サードパティーのリポジトリなどは優先度を低く設定します。

[root@web ~]# vi /etc/yum.repos.d/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]
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
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=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
priority=1

#packages used/produced in the build but not released
[addons]
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
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=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
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=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
priority=1

#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=etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=1

[ CentOS 6 / CentOS 5 ]