zvv

在 CentOS 5中安装 RPMforge 安装源

RPMforge 是 Dag、Dries 和其它软件包的组合。它们为 CentOS 提供了超过 4000 个软件包,包括 mplayer、xmms-MP3 和其它流行的媒体播放工具。RPMforge 不是红帽子 Linux 产品或 CentOS 的组成部分,但它是为这些 Linux 套件而设计的。

注释:因为这个安装源不是 CentOS 本身的组成部分,所以有关技术支持的问题应当向 RPMforge 的维护者发送。
RPMforge 软件包以 rpm 格式提供,并且一般都是可用的。必需注意,有一些包比 CentOS 官方提供的版本要新,所以你不应当盲目地安装。在升级代替 CentOS 官方提供的软件包之前,你应当确保不要破坏任何重要的东西。虽然大多数情况下你可以改正任何错误,但最好还是避免类似的情况发生。

在 CentOS 5.0 下的使用

如果你打算应用这个软件仓库,你可能希望安装 Priorities,因为 RPMforge 里的一些包比它在 ContOS 里的对应的包的版本要新。

下面的注释显示了 yum 的维护者的感想。但是,从实践的观点来看,如果你希望使用 RPMforge 安装源,你就没有办法避免这些 ContOS 原来的软件包被覆盖。并且,关于“yum-priorities”插件,还没有问题报告。

注释:请注意 yum 的上游维护者 Seth Vidal 于 2009 年 9 月关于“yum priorities”的说法。

… 引入,最后部分:(同样的,大多数人最终还是创建了“yum-priorities”)

天哪,我希望人们不要创建 yum priorities。关于 priorities 的东西是如此之多,真让我望而生畏。它几乎让我想起了 apt “pinning”,并且想出声叫骂。

1.1 Priorities(优先权)

用于 CentOS 5 安装源的 yum-priorities 软件包:
yum install yum-priorities
(安装 YUM 优先权插件,生成 /etc/yum/pluginconf.d/priorities.conf 文件)

在 CentOS 5 中,插件默认是可用的。

可以编辑 /etc/yum/pluginconf.d/priorities.conf 文件确保 yum-priorities 是可用的,确认它包含下面一些文本行:
[main]
enabled=1?? (默认)

编辑 /etc/yum.repos.d/ 路径下的 .repo 文件,通过添加以下文本行来创建 priorities:
priority=N

对应于每个安装源入口,N 是一个从 1 到 99 的整数。

建议的配置是(CentOS-Base.repo文件):
[base], [addons], [updates], [extras] … priority=1
[centosplus], [contrib] … priority=2

对第三方安装源,比如 rpmforge(rpmforge.repo文件)等等,priority=N (N 是一个大于 10 的你喜欢的整数)

1.2 RPMforge

可以在 http://dag.wieers.com/packages/ 获得 RPMforge 软件包的一个完整的列表。

下载 rpmforge-release 包。选择以下两个链接中匹配你的 OS 架构(i386/x86_64)的那个下载。如果不能确定是那种架构,请运行 uname -i 命令。

i386 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
x86_64 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

为了使安装源可用,首选的可获得和安装的 rpmforge-release 包只能是上面列出的两个中的一个。

安装 DAG 的 GPG key
rpm –import http://apt.sw.be/RPM-GPG-KEY.dag.txt

校验下载的包:
rpm -K rpmforge-release-0.5.1-1.el5.rf.*.rpm
校验正确,结果显示:
rpmforge-release-0.5.1-1.el5.rf.i386.rpm: (sha1) dsa sha1 md5 gpg OK

安全警告:rpmforge-release 包把 GPG keys 导入了 RPM 数据库。

只要你通过了注入软件包的 key 的 md5 校验和,并且信任 Dag, et al., 那么它们将是安全可信的。

安装 rpmforge-release 包

rpm -i rpmforge-release-0.5.1-1.el5.rf.*.rpm

这将在 /etc/yum.repos.d 添加 yum 安装源配置文件 rpmforge.repo 和 rpmforge-testing.repo(供测试用),并导入合适的 GPG keys。

rpmforge.repo 文件内容为:

### Name: RPMforge RPM Repository for Red Hat Enterprise 5 – dag
### URL: http://rpmforge.net/
[rpmforge]
name = Red Hat Enterprise $releasever – RPMforge.net – dag

baseurl = http://apt.sw.be/redhat/el5/en/$basearch/rpmforge
mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 1

rpmforge-testing.repo 文件内容为:

### Name: RPMforge RPM Repository for Red Hat Enterprise 5 – dag
### URL: http://rpmforge.net/
[rpmforge-testing]
name = Red Hat Enterprise $releasever – RPMforge.net – test
baseurl = http://apt.sw.be/redhat/el5/en/$basearch/test
enabled = 0
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag
gpgcheck = 0

这时。你可以配置 RPMForge 安装源的优先权(priority),如果原先没有配置 CentOS 安装源的优先权,这时也可以配置。

用一下命令进行测试:

yum check-update

它将输出类似以下两行信息:

Loading "priorities" plugin

76 packages excluded due to repository priority protections

在你的 CentOS 系统中,上面的数字可能不同,但是它表明有一些包被排除在外了。

如果看到上述信息,它表明 RPMforge 安装源和优先级配置已经起作用了。于是可以试着运行类似 yum install mplayer??如果看到上述信息,它表明 RPMforge 安装源和优先级配置已经起作用了。于是可以试着运行类似 yum install mplayer??如果看到上述信息,它表明 RPMforge 安装源和优先级配置已经起作用了。于是可以试着运行类似 yum install mplayer 命令来安装一些软件了。

注-1:

原文地址如下:
http://wiki.centos.org/AdditionalResources/Repositories/RPMForge

本文只选择翻译了与 CentOS 5.0 有关的部分,并在保持原文语义的情况下加入了部分作者的解释。

注-2:

篇章简介:YUM 可以通过加入第三方的安装源来安装一些软件包,本文安装的 RPMForge 就是这样一个例子。这就带来一个问题,如果第三方的安装源里有些软件包比 CentOS 本身预装的对应软件包版本要新的话,就会自动安装较新的版本来代替 CentOS 预装的软件版本,如果盲目地更新进行升级,可能是草率和不明智的,这有可能带来一些潜在的安全和管理问题。

于是,YUM 引入了一种机制,就是依靠“优先权”来对下载源的优先级进行排队。这个是靠 yum-priorities 插件来实现的。而要应用这个特性,需要安装这个插件并配置使其起作用,并在 repo 配置里加入 priority=N 来定义优先级别,这个整数数字(1~99)越小,优先级越高。这样一来,如果不同的下载源有软件包重叠,优先级高的就被保护,而优先级低的就被排除(excluded),不会被检测(check)到也不会被更新(update)。

“优先权”对 check-update、update 和 list 等所有 YUM 子命令都起作用。经过优先级比较和过滤后,所有没有安装的、优先级较高的新软件包仍然可以用:

yum install <软件包名>

命令来安装。

定义的安装源较多时,可以使用:

yum –disablerepo=\* –enablerepo=<安装源>?? <命令>

来对安装源进行选择。

注-3:

如果优先级较低的安装源中的软件包,比优先级较高的安装源中的软件包的版本还低,会是什么情形呢?自然更是没商量,被排除掉了。
就是说,软件包更新时,先考虑优先级,再考虑软件的版本。

==============
原文附录如下:
==============

Installing RPMforge

RPMforge is a collaboration of Dag, Dries, and other packagers. They provide over 4000 packages for CentOS, including mplayer, xmms-MP3, and other popular media tools. It is not part of RedHat or CentOS but is designed to work with those distributions.
Note: Because this repository is NOT part of CentOS, you should direct support questions to its maintainers.

Packages are supplied in RPM format and in most cases are ready to use. Beware that some packages are newer than the official CentOS versions and you should not blindly install those packages. Before you replace a CentOS package you should make sure that will not break anything important. In most cases you can revert any mistakes but it is best to avoid the mess.

CentOS 5

If you wish use this repository, you may wish to install Priorities, as a few packages in RPMforge are newer than their counterparts in the CentOS base repositories.

The note below shows the feelings of the yum maintainer but, from a practical standpoint, you have no other way to save packages from being overwritten if you wish to use the RPMforge repository. And, as of yet, no real world problems have been reported with regard to the 'yum-priorities' plugin.

??Note: Please note that the upstream maintainer of yum, Seth Vidal, had the following to say about 'yum priorities' in September 2009.

… lead in, ending: (same way most people end up setting up 'yum-priorities' anyway)

Gosh, I hope people do not set up yum priorities. There are so many things about priorities that make me cringe all over. It could just be that it reminds me of apt 'pinning' and that makes me want to hurl.

1.1. Priorities

yum-priorities is available in the CentOS 5 repositories:

yum install yum-priorities

Plugins are enabled in CentOS 5 by default.

Make sure that yum-priorities is enabled by editing the /etc/yum/pluginconf.d/priorities.conf file, and ensuring that it contains the following lines:

[main]
enabled=1

Edit the .repo files in /etc/yum.repos.d/ and set up priorities by adding the line:

priority=N

to a repository entry, where N is an integer number from 1 to 99.

The recommended settings are:
[base], [addons], [updates], [extras] … priority=1
[centosplus],[contrib] … priority=2
Third Party Repos such as rpmforge … priority=N?? (where N is > 10 and based on your preference)

1.2. RPMforge
You can find a complete listing of the RPMforge package packages at http://dag.wieers.com/packages/

Download the rpmforge-release package. Choose one of the two links below, selecting to match your host's architecture. If you are unsure of which one to use you can check your architecture with the command uname -i
i386 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
x86_64 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

The preferred rpmforge-release package to retrieve and to install in order to enable that repository is one of the two listed above.

Install DAG's GPG key
rpm –import http://apt.sw.be/RPM-GPG-KEY.dag.txt

verify the package you have downloaded
rpm -K rpmforge-release-0.5.1-1.el5.rf.*.rpm

Security warning: The rpmforge-release package imports GPG keys into your RPM database.

As long as you have verified the md5sum of the key injection package, and trust Dag, et al., then it should be as safe as your trust of them extends.

Install the package
rpm -i rpmforge-release-0.5.1-1.el5.rf.*.rpm

This will add a yum repository config file and import the appropriate GPG keys. At this point, you can set the priority of the RPMForge repository, and also of the CentOS repositories if you have not done so yet.

Test with this command:
yum check-update

It should output these two lines:
Loading "priorities" plugin

76 packages excluded due to repository priority protections

The number above may differ, but there should be several packages shown as being excluded.
If so then it looks like things are working so try installing something like this:
yum install mplayer

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »

因本文不是用Markdown格式的编辑器书写的,转换的页面可能不符合AMP标准。