Centos 7 添加epel源

前端之家收集整理的这篇文章主要介绍了Centos 7 添加epel源前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

由于部分包仅存在于epel源中,所以我们在centos中添加


以下提供了2种方法,1手动,2自动


1、手动方法

vi/etc/yum.repos.d/epel.repo

添加以下代码

[epel]
name=ExtraPackagesforEnterpriseLinux7-$basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/Metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

[epel-debuginfo]
name=ExtraPackagesforEnterpriseLinux7-$basearch-Debug
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
mirrorlist=https://mirrors.fedoraproject.org/Metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

[epel-source]
name=ExtraPackagesforEnterpriseLinux7-$basearch-Source
#baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
mirrorlist=https://mirrors.fedoraproject.org/Metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

更新yum缓存

yummakecache

查看yum源

yumrepolist
Loadedplugins:fastestmirror
Loadingmirrorspeedsfromcachedhostfile
*base:mirrors.zju.edu.cn
*epel:mirror01.idc.hinet.net
*extras:mirrors.zju.edu.cn
*updates:mirrors.zju.edu.cn
repoidreponamestatus
base/7/x86_64CentOS-7-Base9,007
*epel/x86_64ExtraPackagesforEnterpriseLinux7-x86_6410,547
extras/7/x86_64CentOS-7-Extras377
updates/7/x86_64CentOS-7-Updates2,311
repolist:22,242


2、自动方法

安装epel源

yuminstall-yepel-release

查看yum源

yumrepolist
Loadedplugins:fastestmirror
epel/x86_64/Metalink|5.4kB00:00:00
epel|4.3kB00:00:00
(1/3):epel/x86_64/group_gz|170kB00:00:00
(2/3):epel/x86_64/updateinfo|622kB00:00:01
(3/3):epel/x86_64/primary_db|4.2MB00:00:06
Loadingmirrorspeedsfromcachedhostfile
*base:mirrors.aliyun.com
*epel:mirror01.idc.hinet.net
*extras:mirrors.cn99.com
*updates:centos.ustc.edu.cn
repoidreponamestatus
base/7/x86_64CentOS-7-Base9,007
epel/x86_64ExtraPackagesforEnterpriseLinux7-x86_6410,548
extras/7/x86_64CentOS-7-Extras377
updates/7/x86_64CentOS-7-Updates2,243


这两种方法都可以,可能第一种采用了国外源对部分用户不适用.

在我这边,这两种区别不大.

猜你在找的CentOS相关文章