CentOSPlus 软件库

1. CentOSPlus 软件库是什么?

CentOSPlus 软件库藏有针对 CentOS base 及 CentOS updates 软件库内的组件的更新。这些更新组件并不属于上游的发行,所以在扩展 CentOS 的功能同时牺牲了与上游的兼容性。启用这个软件库会导致 CentOS 与上游有差别。你应该明白这样做的后果才启用 CentOSPlus。你可以浏览我们镜像中针对 CentOS 5 或者 CentOS 6 的 CentOSPlus 目录来寻找要使用的架构。

CentOSPlus 软件库包含的所有组件都是更新用的组件。你很可能不会启用整个 CentOSPlus,而只会选择其中合用的组件。

在你启用 CentOSPlus 软件库前,你应该阅读 yum 内关于 includepkgs= 以及 exclude= 的选项。要查询这些选项,你可在命令行执行以下命令:

man yum.conf

2. 启用 CentOSPlus 软件库

要启用 CentOSPlus 软件库,请编辑 /etc/yum.repos.d/CentOS-Base.repo 档并寻找 [centosplus] 部份。它的缺省内容是:

#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 <== -CentOS-6 in CentOS-6


样例 1: 我们希望取得 CentOSPlus 内支持 mysql_pgsql 的 postfix。下面是 /etc/yum.repos.d/CentOS-Base.repo 内应有的设置:

#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=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5
includepkgs=postfix-*
exclude=postfix-*plus*

你也需要在 /etc/yum.repos.d/CentOS-Base.repo 内的 [base][update] 部份加入下列设置,好使你不会再从它们取得 postfix 组件:

exclude=postfix-*


样例 2: 我们希望使用 CentOSPlus 的内核,以便能使用 jfs 或 reiserfs 文件系统及建设工具。我们须要编辑 /etc/yum.repos.d/CentOS-Base.repo 及修改 [centosplus] 部份内的设置如下:

enabled=1
includepkgs=kernel* jfsutils reiserfs-utils

[base][update] 部份你须要作出下列修改:

exclude=kernel kernel-devel kernel-PAE-*


3. yum-plugin-priorities 插件

另一个保护你的系统被 CentOSPlus 软件库更新的方法就是采用 yum-plugin-priorities 插件。这是推荐的方法。请按照以上链接内的指引设置 yum-plugin-priorites。编辑 /etc/yum.conf 并加入这行:

plugins=1

你须要在 /etc/yum.repos.d/CentOS-Base.repo 内设置优先次序如下:

[base]
exclude=foo bar
priority=1

[update]
exclude=foo bar
priority=1

[centosplus]
enable=1
priority=2

这样做会令 [base][update] 软件库对比起 [centosplus] 软件库有较优先的次序,于是 CentOSPlus 内唯一可以更改 [base][update] 的组件就是在这两个软件库中被 exclude= 排除的组件。

因此,yum-plugin-priorities 允许你略过在 CentOS-Base.repo[centosplus] 小节中 includepkgs= 的设置 ,但依然能够更新那些在 [base][update] 软件库中被 exclude= 排除的组件。


4. 总结

使用 CentOSPlus 软件库比使用其它 CentOS 软件库更为危险,因为它容许有多个更新的组件,而且并不是为整体启用而设计的。

你可应用 CentOSPlus 内的所有组件,但一般的做法是单单选择所需的组件,然后通过 exclude=includepkgs=(或 exclude=yum-plugin-priorities 插件) 从 CentOSPlus 软件库内下载这些组件。

请确定你理解这里的所有概念,然后才启用 CentOSPlus 软件库。

Translation of revision 26

zh/AdditionalResources/Repositories/CentOSPlus (last edited 2012-04-15 04:15:43 by GaoHu)