centos官方镜像源(`mirrorlist.centos.org`)已经彻底关闭,无法访问
[root192 ~]# sudo yum install -y yum-utils device-mapper-persistent-data lvm2 已加载插件fastestmirror, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Loading mirror speeds from cached hostfile Could not retrieve mirrorlist http://mirrorlist.centos.org?archx86_64release7reposclo-rh error was 14: curl#7 - Failed connect to mirrorlist.centos.org:80; 拒绝连接 One of the configured repositories failed (未知), and yum doesnt 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 --disablereporepoid ... 4. Disable the repository permanently, so yum wont 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 --disablerepoid 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 --setoptrepoid.skip_if_unavailabletrue Cannot find a valid baseurl for repo: centos-sclo-rh/x86_64这个报错很经典是因为 CentOS 7 在 2024 年 6 月 30 日已经全面停止维护EOL官方镜像源mirrorlist.centos.org已经彻底关闭无法访问了。你需要将 yum 源全部替换为国内可用的存档镜像vault或阿里/腾讯云镜像。请按以下步骤操作先修复 yum 源再安装 Docker️ 第一步修复 CentOS 7.9 yum 源由于yum-utils还没装上我们要手动修改源配置文件。备份原有源配置好习惯sudomv/etc/yum.repos.d /etc/yum.repos.d.baksudomkdir/etc/yum.repos.d写入可用的阿里云 Vault 源CentOS 7 的归档源直接复制下面整段命令一次性执行它会创建一个能用的CentOS-Base.repo文件。sudotee/etc/yum.repos.d/CentOS-Base.repo-EOF # CentOS-Base.repo [base] nameCentOS-7 - Base - mirrors.aliyun.com baseurlhttp://mirrors.aliyun.com/centos-vault/7.9.2009/os/$basearch/ gpgcheck1 gpgkeyhttp://mirrors.aliyun.com/centos-vault/7.9.2009/RPM-GPG-KEY-CentOS-7 [updates] nameCentOS-7 - Updates - mirrors.aliyun.com baseurlhttp://mirrors.aliyun.com/centos-vault/7.9.2009/updates/$basearch/ gpgcheck1 gpgkeyhttp://mirrors.aliyun.com/centos-vault/7.9.2009/RPM-GPG-KEY-CentOS-7 [extras] nameCentOS-7 - Extras - mirrors.aliyun.com baseurlhttp://mirrors.aliyun.com/centos-vault/7.9.2009/extras/$basearch/ gpgcheck1 gpgkeyhttp://mirrors.aliyun.com/centos-vault/7.9.2009/RPM-GPG-KEY-CentOS-7 EOF清理并重建 yum 缓存sudoyum clean allsudoyum makecache这次执行应该不会报错了。 第二步重新安装 Docker CE源修好后现在可以按正常流程走了。安装依赖工具刚才失败的那步现在重试sudoyuminstall-yyum-utils device-mapper-persistent-data lvm2添加 Docker 阿里云镜像源sudoyum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo安装 Docker CEsudoyuminstall-ydocker-ce docker-ce-cli containerd.io启动 Docker 并设置开机自启sudosystemctl startdockersudosystemctlenabledocker验证安装dockerversion⚠️ 特别提醒由于 CentOS 7 已停止维护后续yum install安装任何软件都可能会遇到依赖包缺失的问题。如果出现这种情况通常需要手动下载老版本的 rpm 包会比较麻烦。强烈建议如果业务环境允许可以考虑尽快迁移到AlmaLinux 8/9或Rocky Linux 8/9它们是 CentOS 的最佳替代品且仍在活跃维护中。先按上面的步骤试一下如果执行yum makecache时还有报错可以把新的提示发给我。