CentOS 7 中 yum 安装总是失败并出现错误

CentOS 7 中 yum 安装总是失败并出现错误

404错误:

[Errno -1] Metadata file does not match checksum
Trying other mirror.
[Errno 14] HTTP Error 403 - Forbidden

我试过:

rm -fr /var/cache/yum/*
yum clean all
yum clean all && yum clean metadata && yum clean dbcache && yum makecache && yum update

还是没有效果。我还可以做些什么?

我将在/etc/yum.repos.d目录中列出我的存储库文件:

CentOS-Base.repo
CentOS-CR.repo
CentOS-fasttrack.repo
CentOS-Sources.repo
epel.repo
CentOS-Base.repo.rpmnew
CentOS-Debuginfo.repo
CentOS-Media.repo
CentOS-Vault.repo
epel-testing.repo
OpenLogic.repo

我的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
http_caching=packages

#  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
#proxy=http://proxy.com:8080
#proxy_username=xxx
#proxy_password=kkk

答案1

yum.conf禁用:上的缓存,并通过将from的值更改为来http_caching=none禁用文件上的最快镜像,然后键入以下命令:fastestmirror.confenabled10

yum clean metadata
yum clean all

编辑 要暂时禁用该插件,请添加–disableplugin=fastestmirror到您的yum命令行。例如yum update –disableplugin=fastestmirror

要永久禁用该插件,请编辑/etc/yum/pluginconf.d/fastestmirror.conf 并更改enabled=1enabled=0

答案2

通过取消注释行和注释行来删除/etc/yum.repos.d/CentOS-Base.repo.rpmnew然后编辑并启用主存储库。/etc/yum.repos.d/CentOS-Base.repobaseurl=mirrorlist=

相关内容