yum 安装 epel-release 后出现yum doesn’t have enough cached data to continue错误的解决方案...

工作中在内网环境(centos 7.4)部署docker,需搭建yum私有源。按官方方式安装时,安装epel - release后再装container - selinux出错,原因是配置文件影响。解决方法一是同步指定yum源并修改路径,二是找可联网服务器下载rpm包安装,作者采用第二种,且安装docker - ce跳过GPG公钥配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

工作中需要部署docker,由于是内网环境,无法直接访问外网,于是考虑在内网搭建yum私有源进行安装,内网服务器操作系统为centos 7.4。根据docker的官方安装方式进行安装时,要求安装 epel-release 以及 container-selinux。
于是进行同步base以及epel源,reposync base && reposync epel

到内网环境中,通过 createrepo ./的方式创建私有源,并在另一台服务器上逐步安装,当安装完毕epel-release后,再进行安装container-selinux时,出现错误。

已加载插件:fastestmirror
base                                                                                                                                                      | 3.6 kB  00:00:00


 One of the configured repositories failed (未知),
 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. Disable the repository, 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>

     4. 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

Cannot retrieve metalink for repository: epel/x86_64. Please verify its path and try again

原因是安装完毕 epel-release 后, 会在 /etc/yum.repo.d/目录中添加 epel.repo 以及 epel-testing.repo 两个配置文件,配置文件中包含 container-selinux 的yum源。

解决方法:

  1. 继续同步epel.repo中指定的yum源,并修改本地/etc/yum.repo.d/epel.repo对应的yum源路径。
  2. 找一台可下载container-selinux相关rpm包的服务器下载关联安装包进行安装。

我目前是使用的第二种解决方案,在一台能上外网的机器中执行如下命令:

# 挂载位置轻喷 嘻嘻
sudo docker rum --rm -v /container-selinux:/data -it centos:latest /bin/bash -c "yum install -y epel-release && yum install container-selinux --downloadonly --downloaddir=/data"

然后将/container-selinux/ 中container-selinux*.rpm 拷贝到目标服务器中,执行rpm安装命令即可

sudo rpm -ivh container-selinux*.rpm

由于人也比较懒,所以安装docker-ce相关的内容时也不会去配置GPG公钥,安装的时候跳过即可

sudo yum install -y docker-ce docker-ce-cli containerd.io --nogpgcheck

```

转载于:https://www.cnblogs.com/gscienty/p/11168770.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值