有时候,在使用YUM的EPEL源的时候,你会遇到如题所示的Error,它具体的表现如下:
[root@mha2 yum.repos.d]# yum repolist Loaded plugins: fastestmirror, refresh-packagekit, security Determining fastest mirrors Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again [root@mha2 yum.repos.d]#
造成该问题的原因是因为默认的epel源的mirrorlist找不到信息。
如下:
[root@mha2 yum.repos.d]# pwd /etc/yum.repos.d [root@mha2 yum.repos.d]# [root@mha2 yum.repos.d]# ls CentOS-Base.repo CentOS-Media.repo epel.repo Percona.repo remi-php71.repo remi-safe.repo CentOS-Debuginfo.repo CentOS-Vault.repo epel-testing.repo remi-php70.repo remi.repo [root@mha2 yum.repos.d]# [root@mha2 yum.repos.d]# [root@mha2 yum.repos.d]# cat 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 [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 [root@mha2 yum.repos.d]#
解决方法如下:
对epel.repo执行如下操作:
1. 注释mirrorlist
2. 放开baseurl
如下:
将上述的epel.repo修改为如下形态:
[root@mha2 yum.repos.d]# cat 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 [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 [root@mha2 yum.repos.d]#
然后,再次尝试【yum repolist】:
[root@mha2 yum.repos.d]# yum clean metadata Loaded plugins: fastestmirror, refresh-packagekit, security Cleaning repos: LocalPercona base epel extras remi-safe updates 10 metadata files removed 3 sqlite files removed 0 metadata files removed [root@mha2 yum.repos.d]# [root@mha2 yum.repos.d]# yum clean all Loaded plugins: fastestmirror, refresh-packagekit, security Cleaning repos: LocalPercona base epel extras remi-safe updates Cleaning up Everything Cleaning up list of fastest mirrors [root@mha2 yum.repos.d]# [root@mha2 yum.repos.d]# yum repolist Loaded plugins: fastestmirror, refresh-packagekit, security Determining fastest mirrors * base: mirrors.zju.edu.cn * extras: mirrors.cn99.com * remi-safe: mirrors.tuna.tsinghua.edu.cn * updates: mirrors.zju.edu.cn LocalPercona | 2.9 kB 00:00 ... LocalPercona/primary_db | 16 kB 00:00 ... base | 3.7 kB 00:00 base/primary_db | 4.7 MB 00:08 epel | 4.3 kB 00:00 epel/primary_db | 5.9 MB 00:20 extras | 3.4 kB 00:00 extras/primary_db | 37 kB 00:00 remi-safe | 2.9 kB 00:00 remi-safe/primary_db | 435 kB 00:01 updates | 3.4 kB 00:00 updates/primary_db | 3.7 MB 00:06 repo id repo name status LocalPercona Local Percona 10 base CentOS-6 - Base 6,696 epel Extra Packages for Enterprise Linux 6 - x86_64 12,168 extras CentOS-6 - Extras 62 remi-safe Safe Remi's RPM repository for Enterprise Linux 6 - x86_64 1,012 updates CentOS-6 - Updates 686 repolist: 20,634 [root@mha2 yum.repos.d]#
就没有问题了。
——————————————
Done。