由于部分包仅存在于epel源中,所以我们在centos中添加;
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
安装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
在我这边,这两种区别不大.