今天在维护一台香港的VPS,yum update 的时候出现了如下的错误:
# yum update -y
Loaded plugins: fastestmirror, presto
Setting up Update Process
Determining fastest mirrors
epel/metalink | 4.6 kB 00:00
* base: centos.nethub.com.hk
* epel: ftp.cuhk.edu.hk
* extras: centos.nethub.com.hk
* updates: centos.nethub.com.hk
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:01
epel | 4.3 kB 00:00
http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00
https://free.nchc.org.tw/fedora-epel/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00
http://mirror01.idc.hinet.net/EPEL/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00
http://mirror.rise.ph/fedora-epel/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00
http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00
http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00
http://kodeterbuka.beritagar.id/epel/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00
http://epel.scopesky.iq/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00
http://mirror2.totbb.net/epel/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00
http://repo.fedoralinux.ir/repos/centos/epel/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00
https://mirrors.tuna.tsinghua.edu.cn/epel/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
epel | 4.3 kB 00:00
https://epel.mirror.angkasa.id/pub/epel/6/x86_64/repodata/repomd.xml: [Errno -1] repomd.xml does not match metalink for epel
Trying other mirror.
http://epel.mirror.net.in/epel/6/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: epel. Please verify its path and try again
搜索了一下,解决方法也很简单,编辑 /etc/yum.repos.d/epel.repo 文件:
vim /etc/yum.repos.d/epel.repo
找到 [epel] 这个 section,注释掉 mirrorlist,然后去掉 baselink 前面的注释,比如我的修改后成了这样:
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=http://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
保存,然后就可以正常使用了。