您的位置:首页 > 运维架构 > Linux

什么是EPEL 及 Centos上安装EPEL

2017-03-04 09:30 267 查看
RHEL以及他的衍生发行版如CentOS为了稳定,官方的rpm repository提供的rpm包为了服务器安全稳定更新往往是很滞后的,很多时候需要自己编译那太辛苦了,而EPEL恰恰可以解决这两方面的问题。

什么是EPEL?

EPEL的全称叫 Extra Packages for Enterprise Linux 。EPEL是由 Fedora 社区打造,为 RHEL 及衍生发行版如 CentOS提供高质量软件包的项目。装上了 EPEL之后,就相当于添加了一个第三方源。

如果你知道rpmfusion.org的话,拿 rpmfusion 做比较还是很恰当的,rpmfusion 主要为桌面发行版提供大量rpm包,而EPEL则为服务器版本提供大量的rpm包,而且大多数rpm包在官方 repository 中是找不到的

另外一个特点是绝大多数rpm包要比官方repository 的rpm包版本要来得新,比如我前些日子在CentOS上安装的PHP,RHEL为了稳定性还在延用5.1.6版,我记得这是去年上半年的版本,而php 的最新版本已经到5.3.2,如果在php5.1.6的基础上安装phpmyadmin,则会提示php版本过低,这时候,EPEL中提供的较新php
rpm就能很方便的派上用场了。

一,什么是epel

如果既想获得 RHEL 的高质量、高性能、高可靠性,又需要方便易用(关键是免费)的软件包更新功能,那么 Fedora Project 推出的
EPEL(Extra Packages for Enterprise
Linux)正好适合你。EPEL(http://fedoraproject.org/wiki/EPEL) 是由 Fedora 社区打造,为
RHEL 及衍生发行版如 CentOS、Scientific Linux 等提供高质量软件包的项目。

二,使用心得

1,不用去换原来yum源,安装后会产生新repo

2,epel会有很多源地址,如果一个下不到,会去另外一个下
http://mirror.xfes.ru/fedora-epel/6/x86_64/ibus-table-chinese-scj-1.3.4-1.el6.noarch.rpm: [Errno 14] PYCURL ERROR 6 - ""

Trying other mirror.
http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/ibus-table-chinese-scj-1.3.4-1.el6.noarch.rpm: [Errno 14] PYCURL ERROR 6 - ""

Trying other mirror.
http://repo.boun.edu.tr/epel/6/x86_64/ibus-table-chinese-scj-1.3.4-1.el6.noarch.rpm: [Errno 14] PYCURL ERROR 6 - ""kjs

3,更新时如果下载的包不全,就不会进行安装。这样的话,依赖关系可以保重

三,安装epel,centos6选6,5就选5

32位系统选择:

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

64位系统选择:

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

导入key:

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

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


其实上面安装的那个包就是在你系统/etc/yum.repos.d/下释放了2个yum源的repo文件而已:

但是默认情况下,只有正式版是有效状态的,如果用比较新的软件,用epel-test.repo这个文件就行了,需要修改/etc/yum.repos.d/epel-testing.repo,把enabled=0改成enabled=1即可。

另外,如果你要使用yumdownloader来下载src.rpm包的话,需要把epel.repo里[epel-source]域下的enabled=0也改成enabled=1即可。

当然了,如果你暂时不想使用EPEL的yum源的话,把对应文件里的enabled=1改成enabled=0就行了,如果你完全不需要了,那就直接卸载掉:

使用EPEL源安装软件

现在就可以执行:yum install 软件包名进行安装了

别忘了安装yum install yum-priorities

下面讲解下如何使用EPEL与RPMForge、RPMFusion软件仓库:

一、安装yum-priorities插件。

这个插件是用来设置yum在调用软件源时的顺序的。因为官方提供的软件源,都是比较稳定和被推荐使用的。因此,官方源的顺序要高于第三方源的顺序。如何保证这个顺序,就需要安装yum-priorities这插件了。

[root@CentOS ~]# yum install yum-priorities

安装完后需要设置/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)

如我的CentOS-Base.repo配置为(CentOS 6.0):
# 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-6
priority=1

#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
priority=1

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever – Addons
mirrorlist=http://mirrorlist.CentOS.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirror.CentOS.org/CentOS/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
priority=1

#additional packages that may be useful
[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

#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-6
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-6
priority=2

二、下载与安装相应EPEL的rpm文件包

1、下载与安装EPEL的rpm文件包

32位系统
[root@CentOS ~]# rpm -ivh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
64位系统
[root@CentOS ~]# rpm -ivh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
如果您不清楚您的系统内核,请使用uname -a命令来查看您的内核信息。

2、导入DAG的PGP Key

[root@CentOS ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

3、设置/etc/yum.repos.d/epel.repo文件中源的级别,就是添加priority=11这句。
如我的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

[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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: