在CentOS下运行yum install flash-plugin或yum install mplayer的时候,提示库里没有找到这个软件?为什么会这样?因为CentOS是RHEL编译过来的,去掉了所有关于版权问题的东西。因此,在没有使用第三方软件库的情况下,很多软件无法用yum install来直接安装。
EPEL(Extra Packages for Enterprise Linux)软件库提供为RHEL系列(4.x、5.x、6.x等等)重新编译的Fedora组件。这个软件库在不替换系统组件方面下了功夫。在某些情况下它尝试直接针对CentOS兼容性的问题,但坚决否定软件库间的兼容性是目标之一。当它与其它第三方软件库混合使用时,问题可能会出现。故此,当你使用EPEL时,尤其是当你亦会运用其它件库的组件时,请确保你使用yum的Priorities插件。
RPMForge库现在已经拥有超过10000种的CentOS的软件包,被CentOS社区认为是最安全也是最稳定的一个第三方软件库。
一、配置基本源
安装CentOS yum源优先级插件yum-priorities
yum install yum-priorities #输入y安装
设置CentOS默认yum源的优先级为最高
系统运维 www.osyunwei.com 温馨提醒:qihang01原创内容©版权所有,转载请注明出处及原文链接
cd /etc/yum.repos.d/ #进入yum源目录
vi CentOS-Base.repo #在[base]、[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
- priority=1
- [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
- priority=1
- [extras]
- name=CentOS-$releasever - Extras
- mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
- #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
- gpgcheck=1
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
- priority=1
- [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-6
- priority=2
- [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-6
- priority=2
二、EPEL(Extra Packages for Enterprise Linux)(http://fedoraproject.org/wiki/EPEL)
添加方法: 打开终端,输入
32位系统:
[root@CentOS ~]#rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm (这里需要注意随着fedora系统的更新-6-7是会变的当提示你不能下载时就出网站看看)
64位系统:
[root@CentOS ~]#rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
然后导入公钥(不导入的话会出错)
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
在/etc/yum.repos.d/epel.repo 里设置epel源的优先级为priority=11
点击(此处)折叠或打开
- [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
三、下载与安装相应rpmforge的rpm文件包
1、下载rpmforge的rpm文件包(http://wiki.centos.org/AdditionalResources/Repositories/RPMForge)
32位系统
[root@CentOS ~]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
64位系统
[root@CentOS ~]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
2、安装DAG的PGP Key
[root@CentOS ~]# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
3、验证rpmforge的rpm文件包
[root@CentOS ~]# rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm如果报XXX not an rpm package的错,查看是否wget下载的包不完整,包的大小是12K
4、安装rpmforge的rpm文件包
[root@CentOS ~]# rpm -ivh rpmforge-release-0.5.2-2.el6.rf.*.rpm
5、设置/etc/yum.repos.d/rpmforge.repo文件中源的级别,就是添加priority=12这句
点击(此处)折叠或打开
- ### 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=12
四、定义yum的非官方库
在服务器构建的过程中,我们将要用到的一些工具不存在于CentOS中yum的官方库中,所以需要定义yum的非官方库文件,让一些必需的工具通过yum也能够安装。
点击(此处)折叠或打开
- [dag]
- name=Dag RPM Repository for Red Hat Enterprise Linux
- baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
- gpgcheck=1
- enabled=1