Centos 7 添加epel源

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

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


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


1、手动方法

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

添加以下代码

  1. [epel]
  2. name=ExtraPackagesforEnterpriseLinux7-$basearch
  3. #baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
  4. mirrorlist=https://mirrors.fedoraproject.org/Metalink?repo=epel-7&arch=$basearch
  5. failovermethod=priority
  6. enabled=1
  7. gpgcheck=0
  8. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
  9.  
  10. [epel-debuginfo]
  11. name=ExtraPackagesforEnterpriseLinux7-$basearch-Debug
  12. #baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
  13. mirrorlist=https://mirrors.fedoraproject.org/Metalink?repo=epel-debug-7&arch=$basearch
  14. failovermethod=priority
  15. enabled=0
  16. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
  17. gpgcheck=1
  18.  
  19. [epel-source]
  20. name=ExtraPackagesforEnterpriseLinux7-$basearch-Source
  21. #baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
  22. mirrorlist=https://mirrors.fedoraproject.org/Metalink?repo=epel-source-7&arch=$basearch
  23. failovermethod=priority
  24. enabled=0
  25. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
  26. gpgcheck=1

更新yum缓存

  1. yummakecache

查看yum源

  1. yumrepolist
  2. Loadedplugins:fastestmirror
  3. Loadingmirrorspeedsfromcachedhostfile
  4. *base:mirrors.zju.edu.cn
  5. *epel:mirror01.idc.hinet.net
  6. *extras:mirrors.zju.edu.cn
  7. *updates:mirrors.zju.edu.cn
  8. repoidreponamestatus
  9. base/7/x86_64CentOS-7-Base9,007
  10. *epel/x86_64ExtraPackagesforEnterpriseLinux7-x86_6410,547
  11. extras/7/x86_64CentOS-7-Extras377
  12. updates/7/x86_64CentOS-7-Updates2,311
  13. repolist:22,242


2、自动方法

安装epel源

  1. yuminstall-yepel-release

查看yum源

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


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

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

猜你在找的CentOS相关文章