yum 安裝 epel-release 后出現yum doesn’t have enough cached data to continue錯誤的解決方案


工作中需要部署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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM