Centos6.0使用第三方YUM源(EPEL,RPMForge,RPMFusion)

yum是centos下很方便的rpm包管理工具,配置第三方软件库使你的软件库更加丰富。以下简单的讲下配置的步骤。

首先,需要安装yum-priorities插件:

 

yum install yum-priorities -y

    

该插件的作用主要是设置调用源时的优先级的,一般将官方的优先级设置为最高。例如:

 

[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

priority=1

在每个[]段的最后加上priority=[]字段来设置每个镜像的优先级,1为最高,99为最低。

一般的配置为:

    [base], [addons], [updates], [extras] … priority=1
    [CentOSplus],[contrib] … priority=2
    其他第三的软件源为:priority=N (推荐N>10)

 

安装epel.repo,下载地址为 http://download.fedora.redhat.com/pub/epel/ 找与自己系统版本相符的包

 

rpm -ivh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 

修改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.repo的优先级为11.

 

安装rpmforge.repo,下载地址为 http://pkgs.repoforge.org/rpmforge-release/ 找与自己系统版本相符的包

 

wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

wget http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

rpm -import RPM-GPG-KEY.dag.txt

rpm -K rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

rpm -ivh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 

修改rpmforge.repo,

 

[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=12 

设置rpmforge.repo优先级为12

 

安装rpmfusion.repo,下载地址为http://download1.rpmfusion.org

 

rpm -ivh http://download1.rpmfusion.org/free/el/updates/testing/6/x86_64/rpmfusion-free-release-6-0.1.noarch.rpm

rpm -ivh http://download1.rpmfusion.org/nonfree/el/updates/testing/6/x86_64/rpmfusion-nonfree-release-6-0.1.noarch.rpm 

修改rpmfusion.repo,

 

[rpmfusion-nonfree-updates-testing]

name=RPM Fusion for EL 6 - Nonfree - Test Updates

#baseurl=http://download1.rpmfusion.org/nonfree/el/updates/testing/6/$basearch/

mirrorlist=http://mirrors.rpmfusion.org/mirrorlist?repo=nonfree-el-updates-testing-6&arch=$basearch

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-el-6

priority=13 

设置优先级为13

 

测试:

 

yum check-update  

会载入yum-priorities插件

 

yum install nginx -y 

能成功安装。

 

参考文档:http://wiki.centos.org/zh/AdditionalResources/Repositories/RPMForge

posted @ 2015-06-11 22:31  sandea  阅读(427)  评论(0编辑  收藏  举报