> CentOS > CentOS教程 >

CentOS第三方软件库


一、准备工作,安装yum-priorities插件

作用: 设置yum在调用软件源时的顺序

1.1 安装:

# yum install yum-priorities -y 

1.2 设置:

/etc/yum.repos.d/*.repo, 添加顺序指令 priority=N (N从1至99, 1优先级最高)

具体语法:

[base], [addons], [updates], [extras] … priority=1 
[CentOSplus],[contrib] … priority=2 
… 

示例:

[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 
<span style="color:#FF0000;">priority=1</span> 
 
#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 
<span style="color:#FF0000;">priority=1</span> 

二、下载、安装并配置EPEL|RPMForge|RPMFusion对应的RPM文件包

需要了解系统内核信息, 使用 uname -r 命令来查看

2.1 EPEL

http://fedoraproject.org/wiki/EPEL

2.1.1 下载与安装EPEL具体方法 (如RHEL/CentOS 6;32位系统)

# wgethttp://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm 
 
# rpm -Uvh epel-release-6-5.noarch.rpm 

2.1.2 导入DAG的PGP Key

# rpm --importhttp://download.fedora.redhat.com/pub/epel/RPM-GPG-KEY-EPEL-6 

2.1.3 设置/etc/yum.repos.d/epel.repo文件中源的级别

示例:



[epel] 
name=Extra Packages for Enterprise Linux 6 - $basearch 
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch 
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch 
failovermethod=priority 
enabled=1 
gpgcheck=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 
priority=11 
 
[epel-debuginfo] 
name=Extra Packages for Enterprise Linux 6 - $basearch -Debug 
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug 
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch 
failovermethod=priority 
enabled=0 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 
gpgcheck=1 
priority=11 
 
[epel-source] 
name=Extra Packages for Enterprise Linux 6 - $basearch -Source 
#baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS 
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch 
failovermethod=priority 
enabled=0 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 
gpgcheck=1 
priority=11 

2.2 RPMForge

http://pkgs.repoforge.org/rpmforge-release/

2.2.1 下载与安装RPMForge具体方法 (如RHEL/CentOS 6;32位系统)

# wgethttp://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm 
 
# rpm -Uvh rpmforge-release-0.5.2-2.el6.rf.i686.rpm 


2.2.2 安装DAG的PGP Key



# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt 


2.2.3 验证rpmforge的rpm文件包



# rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm 


2.2.4 安装rpmforge的rpm文件包



# rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm 

2.2.5 设置/etc/yum.repos.d/rpmforge.repo文件中源的级别

示例:

### Name: RPMforge RPM Repository for RHEL 6 - dag 
### URL: http://rpmforge.net/ 
[rpmforge] 
name = RHEL $releasever - RPMforge.net - dag 
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge 
mirrorlist = http://apt.sw.be/redhat/el6/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 
priority=13 
 
[rpmforge-extras] 
name = RHEL $releasever - RPMforge.net - extras 
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/extras 
mirrorlist =http://apt.sw.be/redhat/el6/en/mirrors-rpmforge-extras 
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge-extras 
enabled = 0 
protect = 0 
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag 
gpgcheck = 1 
priority=13 
 
[rpmforge-testing] 
name = RHEL $releasever - RPMforge.net - testing 
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/testing 
mirrorlist =http://apt.sw.be/redhat/el6/en/mirrors-rpmforge-testing 
#mirrorlist =file:///etc/yum.repos.d/mirrors-rpmforge-testing 
enabled = 0 
protect = 0 
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag 
gpgcheck = 1 
priority=13 

2.3 RPMFusion

http://rpmfusion.org/

2.3.1 下载与安装RPMFusion具体方法 (如RHEL/CentOS 6;32位系统)



# wgethttp://download1.rpmfusion.org/free/el/updates/testing/6/i386/rpmfusion-free-release-6-0.1.noarch.rpm 
 
# rpm -Uvh rpmfusion-free-release-6-0.1.noarch.rpm 
 
# wgethttp://download1.rpmfusion.org/nonfree/el/updates/testing/6/i386/rpmfusion-nonfree-release-6-0.1.noarch.rpm 
 
# rpm -Uvh rpmfusion-nonfree-release-6-0.1.noarch.rpm 

2.3.2 安装DAG的PGP Key

http://rpmfusion.org/keys 
 
http://rpmfusion.org/keys?action=AttachFile&do=get&target=RPM-GPG-KEY-rpmfusion-free-el-6 
 
http://rpmfusion.org/keys?action=AttachFile&do=get&target=RPM-GPG-KEY-rpmfusion-nonfree-el-6 
 
# rpm --import RPM-GPG-KEY-rpmfusion-free-el-6 
 
# rpm --import RPM-GPG-KEY-rpmfusion-nonfree-el-6 

2.3.3 设置/etc/yum.repos.d/epel.repo文件中源的级别

示例:



[rpmfusion-free-updates] 
name=RPM Fusion for EL 6 - Free - Updates 
#baseurl=http://download1.rpmfusion.org/free/el/updates/6/$basearch/ 
mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-el-updates-released-6&arch=$basearch 
enabled=1 
gpgcheck=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-6 
priority=14 
 
[rpmfusion-free-updates-debuginfo] 
name=RPM Fusion for EL 6 - Free - Updates Debug 
#baseurl=http://download1.rpmfusion.org/free/el/updates/6/$basearch/debug/ 
mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-el-updates-released-debug-6&arch=$basearch 
enabled=0 
gpgcheck=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-6 
priority=14 
 
[rpmfusion-free-updates-source] 
name=RPM Fusion for EL 6 - Free - Updates Source 
#baseurl=http://download1.rpmfusion.org/free/el/updates/6/SRPMS/ 
mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=free-el-updates-released-source-6&arch=$basearch 
enabled=0 
gpgcheck=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-free-el-6 
priority=14 

2.4 pbone

http://rpm.pbone.net/
需要注册,免费15天

2.4.1 下载与安装pbone具体方法 (如RHEL/CentOS 6;32位系统)

进入网址http://rpm.pbone.net/在YUM REPO中选择所需软件包类型生成YUM conf

进入/etc/yum.repos.d/, 建立/etc/yum.repos.d/pbone.repo文件
把上步生成的文字复制进去,将ENTER_YOUR_USERNAME_HERE和ENTER_YOUR_PASSWORD_HERE替换成你的用户名密码并保存

示例:

[74i386] 
name=PBONE RedHat EL 6 i386 
baseurl=http://yum.pbone.net/74/i386/ 
gpgcheck=0 
proxy=http://proxy.pbone.net:3127/ 
proxy_username=ENTER_YOUR_USERNAME_HERE 
proxy_password=ENTER_YOUR_PASSWORD_HERE 
[74noarch] 
name=PBONE RedHat EL 6 noarch 
baseurl=http://yum.pbone.net/74/noarch/ 
gpgcheck=0 
proxy=http://proxy.pbone.net:3127/ 
proxy_username=ENTER_YOUR_USERNAME_HERE 
proxy_password=ENTER_YOUR_PASSWORD_HERE 
 
[79i386] 
name=PBONE CentOS 6 i386 
baseurl=http://yum.pbone.net/79/i386/ 
gpgcheck=0 
proxy=http://proxy.pbone.net:3127/ 
proxy_username=ENTER_YOUR_USERNAME_HERE 
proxy_password=ENTER_YOUR_PASSWORD_HERE 
[79noarch] 
name=PBONE CentOS 6 noarch 
baseurl=http://yum.pbone.net/79/noarch/ 
gpgcheck=0 
proxy=http://proxy.pbone.net:3127/ 
proxy_username=ENTER_YOUR_USERNAME_HERE 
proxy_password=ENTER_YOUR_PASSWORD_HERE 

2.4.2 设置/etc/yum.repos.d/epel.repo文件中源的级别

示例:

[74i386] 
name=PBONE RedHat EL 6 i386 
baseurl=http://yum.pbone.net/74/i386/ 
gpgcheck=0 
proxy=http://proxy.pbone.net:3127/ 
proxy_username=ENTER_YOUR_USERNAME_HERE 
proxy_password=ENTER_YOUR_PASSWORD_HERE 
priority=16 
[74noarch] 
name=PBONE RedHat EL 6 noarch 
baseurl=http://yum.pbone.net/74/noarch/ 
gpgcheck=0 
proxy=http://proxy.pbone.net:3127/ 
proxy_username=ENTER_YOUR_USERNAME_HERE 
proxy_password=ENTER_YOUR_PASSWORD_HERE 
priority=16 
 
[79i386] 
name=PBONE CentOS 6 i386 
baseurl=http://yum.pbone.net/79/i386/ 
gpgcheck=0 
proxy=http://proxy.pbone.net:3127/ 
proxy_username=ENTER_YOUR_USERNAME_HERE 
proxy_password=ENTER_YOUR_PASSWORD_HERE 
priority=16 
[79noarch] 
name=PBONE CentOS 6 noarch 
baseurl=http://yum.pbone.net/79/noarch/ 
gpgcheck=0 
proxy=http://proxy.pbone.net:3127/ 
proxy_username=ENTER_YOUR_USERNAME_HERE 
proxy_password=ENTER_YOUR_PASSWORD_HERE 
priority=16 

三、最后配置YUM

# yum clean all

# yum makecache


(责任编辑:IT)