yum update 不起作用(yum 没有足够的缓存数据来继续)

yum update 不起作用(yum 没有足够的缓存数据来继续)

我已经通过 yum 在 centos 7 上成功安装了东西。然后我安装了 epel repo ( yum install epel-release) 并总是给我以下错误,之后我无法安装任何东西

 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

 1. Contact the upstream for the repository and get them to fix the problem.

 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).

 3. Run the command with the repository temporarily disabled
        yum --disablerepo=<repoid> ...

 4. Disable the repository permanently, so yum won't use it by default. Yum
    will then just ignore the repository until you permanently enable it
    again or use --enablerepo for temporary usage:

        yum-config-manager --disable <repoid>
    or
        subscription-manager repos --disable=<repoid>

 5. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:

        yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

我在互联网上搜索了很多,但找不到解决方案。有些人可能来自代理。即使我将代理信息添加到 yum.conf,但我再次失败了。

然后我想检查如果我删除 epel repo 那么它可能会起作用并且我从系统中删除了 epel-repo 之后我可以安装。

请帮助我,我花了两天时间解决这个问题

答案1

正如您所发现的,epel-release 包导致了该问题。如果您还没有:

# yum remove epel-release

然后使用以下命令安装 EPEL Repo(需要 wget 包):

# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
# rpm -ivh epel-release-7-9.noarch.rpm

从那里您应该能够毫无问题地执行 yum update。

答案2

我刚刚在使用新的 CentOS 7.6 时遇到了这个问题

解决方案很简单:

  • 不要删除软件包epel-release(如果您已经删除了它,请安装它)
  • 编辑文件/etc/yum.repos.d/epel.repo
  • 在第一部分([epel])中:
    • 评论metalink=https://...
    • 取消注释baseurl=http://...

这为我解决了这个问题。

答案3

也许您需要添加 DNS 服务器,/etc/resolv.conf以便它可以知道存储库中的主机,例如在我的例子中(google DNS 就足够了):

cat /etc/resolv.conf

# Generated by NetworkManager

nameserver 192.168.1.128 # local DNS

nameserver 8.8.8.8

nameserver 8.8.4.4

答案4

我也遇到了这个问题,这个问题的根本原因是构建 docker 镜像无法访问 yum 存储库。所以我必须更改我的 kubernetes 集群的网络策略(因为我正在从事 kubernetes 项目)。

相关内容