一、安装yum-priorities插件。
这个插件是用来设置yum在调用软件源时的顺序的。因为官方提供的软件源,都是比较稳定和被推荐使用的。因此,官方源的顺序要高于第三方源的顺序。如何保证这个顺序,就需要安装yum-priorities这插件了。
yum install yum-priorities
vi /etc/yum/pluginconf.d/priorities.conf
[main]
enabled=1
二、安装rpmforge
RPMforge是一个Linux社区的软件仓库,包含了支持CentOS或者Redhat的4000多个软件。软件是通过RPM包的形式提供,支持yum安装管理工具。
1、下载rpmforge的rpm文件包
i386 : wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
x86_64: wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
如不清楚您的系统内核,使用 uname -a 命令来查看。
2、安装DAG的PGP Key
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
3、验证rpmforge的rpm文件包
rpm -K rpmforge-release-0.5.1-1.el5.rf.i386.rpm
4、安装rpmforge的rpm文件包
rpm -i rpmforge-release-0.5.1-1.el5.rf.i386.rpm
见原贴 http://wiki.centos.org/AdditionalResources/Repositories/RPMForge
三、安装rpmfusion
i386 : rpm -Uvh http://download1.rpmfusion.org/free/el/updates/testing/5/i386/rpmfusion-free-release-5-0.1.noarch.rpm
x86_64:rpm -Uvh http://download1.rpmfusion.org/free/el/updates/testing/5/x86_64/rpmfusion-free-release-5-0.1.noarch.rpm
四、安装EPEL
i386 :rpm -ivh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
x86_64:rpm -ivh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm
五、设置优先级别
设置/etc/yum.repos.d/ 目录下的.repo相关文件(如CentOS-Base.repo),在这些文件中插入顺序指令:priority=N (N为1到99的正整数,数值越小越优先)一般的配置是这样的:
[base], [addons], [updates], [extras] … priority=1
[CentOSplus],[contrib] … priority=2
其他第三的软件源为:priority=N (推荐N>10)
下面是我的配置:
1、vi /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-5
priority=1
#released updates
[updates]
name=CentOS-$releasever - Updates
"/etc/yum.repos.d/CentOS-Base.repo" 66L, 2311C
# 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-5
priority=1
#released updates
[updates]
name=CentOS-$releasever - Updates
gpgkey=file:///etc/pki/rpm-gpg/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=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
priority=2
#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-5
priority=2
2、vi /etc/yum.repos.d/rpmforge.repo
添加 priority=11
3、vi /etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
priority=12
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1
priority=12
[epel-source]
name=Extra Packages for Enterprise Linux 5 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1
priority=12
4、vi /etc/yum.repos.d/rpmfusion-free-updates.repo
[rpmfusion-free-updates]
name=RPM Fusion for EL 5 - Free - Updates
#baseurl=http://download1.rpmfusion.org/free/el/updates/5/$basearch/
mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-el-updates-released-5&arch=$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el
priority=13
[rpmfusion-free-updates-debuginfo]
name=RPM Fusion for EL 5 - Free - Updates Debug
#baseurl=http://download1.rpmfusion.org/free/el/updates/5/$basearch/debug/
mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-el-updates-released-debug-5&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el
priority=13
[rpmfusion-free-updates-source]
name=RPM Fusion for EL 5 - Free - Updates Source
#baseurl=http://download1.rpmfusion.org/free/el/updates/5/SRPMS/
mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-el-updates-released-source-5&arch=$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el
priority=13
六、测试
1、测试是否安装成功
rpm -q rpmforge-release
结果输出为 rpmforge-release-0.5.1-1.el5.rf
rpm -q epel-release
结果输出为 epel-release-5-3
rpm -q rpmfusion-free-release
结果输出为 rpmfusion-free-release-5-0.1
全部安装成功。
2、测试升级
yum check-update
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* addons: centos.ustc.edu.cn
* atomic: www6.atomicorp.com
* base: centos.ustc.edu.cn
* epel: mirror.bjtu.edu.cn
* extras: centos.ustc.edu.cn
* rpmforge: fr2.rpmfind.net
* rpmfusion-free-updates: mirrors.163.com
* rpmfusion-free-updates-testing: mirrors.163.com
* updates: centos.ustc.edu.cn
2378 packages excluded due to repository priority protections
安装完后很多软件都可yum install 了,非常方便!安装下mplayer播放器试试吧
yum install mplayer
在CentOS 5.0中安装RPMforge安装源:http://www.linuxdiyf.com/linux/8669.html
CentOS 6.x和CentOS 7安装RPMforge:http://www.linuxdiyf.com/linux/7188.html
CentOS 5(RHEL5)安装rpmfusion:http://www.linuxdiyf.com/linux/8373.html
在CentOS 5.X中使用第三方rpmfusion源仓库:http://www.linuxdiyf.com/linux/1939.html
Centos7.x RHEL配置EPEL第三方YUM源:http://www.linuxdiyf.com/linux/14507.html