yum 报[Errno 12] Timeout on错误

今天在用阿里云服务器进行yum update的时候,怎么更新都会报错,curl直接请求yum源可以正常访问,但是进行yum进行更新报错日志如下:
http://mirrors.aliyun.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyun.com/centos/7/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 3001 milliseconds')
Trying other mirror.
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 3001 milliseconds')
Trying other mirror.

经过google,发现有遇到同样问题的,解决方案是修改/etc/yum.conf文件,原有文件

[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

proxy=http://52.34.225.218:8083
#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
timeout=3

发现有代理proxy,可能是因为此代理访问不通所以导致更新源失败。

只需要将proxy=http://52.34.225.218:8083之前添加#注释掉即可

#proxy=http://52.34.225.218:8083

参考链接地址:http://joeyoung.io/yum-errno-12-timeout-error-work-around/

本文已经被查看12,404次

发表评论

电子邮件地址不会被公开。 必填项已用*标注