当前位置: 首页 > news >正文

centos官方镜像源(`mirrorlist.centos.org`)已经彻底关闭,无法访问

[root@192 ~]# 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?arch=x86_64&release=7&repo=sclo-rh error was 14: curl#7 - "Failed connect to mirrorlist.centos.org:80; 拒绝连接" 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. 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 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还没装上,我们要手动修改源配置文件。

  1. 备份原有源配置(好习惯):

    sudomv/etc/yum.repos.d /etc/yum.repos.d.baksudomkdir/etc/yum.repos.d
  2. 写入可用的阿里云 Vault 源(CentOS 7 的归档源):
    直接复制下面整段命令,一次性执行,它会创建一个能用的CentOS-Base.repo文件。

    sudotee/etc/yum.repos.d/CentOS-Base.repo<<-'EOF' # CentOS-Base.repo [base] name=CentOS-7 - Base - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/7.9.2009/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/7.9.2009/RPM-GPG-KEY-CentOS-7 [updates] name=CentOS-7 - Updates - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/7.9.2009/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/7.9.2009/RPM-GPG-KEY-CentOS-7 [extras] name=CentOS-7 - Extras - mirrors.aliyun.com baseurl=http://mirrors.aliyun.com/centos-vault/7.9.2009/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos-vault/7.9.2009/RPM-GPG-KEY-CentOS-7 EOF
  3. 清理并重建 yum 缓存

    sudoyum clean allsudoyum makecache

    这次执行应该不会报错了。


🚀 第二步:重新安装 Docker CE

源修好后,现在可以按正常流程走了。

  1. 安装依赖工具(刚才失败的那步,现在重试):

    sudoyuminstall-yyum-utils device-mapper-persistent-data lvm2
  2. 添加 Docker 阿里云镜像源

    sudoyum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  3. 安装 Docker CE

    sudoyuminstall-ydocker-ce docker-ce-cli containerd.io
  4. 启动 Docker 并设置开机自启

    sudosystemctl startdockersudosystemctlenabledocker
  5. 验证安装

    dockerversion

⚠️ 特别提醒

  • 由于 CentOS 7 已停止维护,后续yum install安装任何软件都可能会遇到依赖包缺失的问题。如果出现这种情况,通常需要手动下载老版本的 rpm 包,会比较麻烦。
  • 强烈建议:如果业务环境允许,可以考虑尽快迁移到AlmaLinux 8/9Rocky Linux 8/9,它们是 CentOS 的最佳替代品,且仍在活跃维护中。

先按上面的步骤试一下,如果执行yum makecache时还有报错,可以把新的提示发给我。

http://www.jsqmd.com/news/1084836/

相关文章:

  • 3步轻松备份QQ空间:永久保存你的青春记忆 [特殊字符]
  • 5步搞定QQ空间完整备份:你的青春记忆永久保存终极指南
  • PyTorch实战:VGG-16调参技巧助力CIFAR-10分类准确率突破91%
  • 五大突破性功能解析:网盘直链下载解决方案的技术革命
  • MoeKoe Music完全手册:打造你的专属二次元音乐世界
  • 微信好友关系终极检测指南:三步发现谁悄悄删除了你
  • 如何让AI数字人成为你的24小时智能管家:Fay框架深度解析
  • AI动作捕捉:三步实现真人视频转3D虚拟角色动画的终极方案
  • Obsidian PDF++:如何实现沉浸式PDF阅读体验的3个核心设计
  • C++23新特性在CLion 2026.1中的实战体验:std::expected错误处理与协程优化深度评测
  • RA8D2 ADC16H高级调度:组优先级与同步操作实战指南
  • 技术实现:绝区零自动化工具架构设计与高性能算法解析
  • IntelliJ IDEA新建Spring Boot项目全流程拆解:从环境配置到Hello World的7个关键节点
  • FanControl:让Windows电脑风扇控制变得简单智能
  • Java毕设选题推荐:基于智能社区的生鲜团购管理平台的设计与实现 基于线上社区的生鲜团购下单系统的设计与实现【附源码、mysql、文档、调试+代码讲解+全bao等】
  • Obsidian Excel插件完整指南:5分钟实现笔记与表格的无缝整合
  • Navicat Premium试用重置终极指南:3步快速恢复14天免费试用期
  • IDEA 快速搭建 MyBatis-Spring Boot 项目(零配置+热加载+SQL监控一体化)
  • Steam创意工坊资源终极下载指南:WorkshopDL免账号下载完整教程
  • 学术写作效率飞跃!2026全能型AI论文平台推荐指南
  • 10分钟极速配置黑苹果:OpCore Simplify智能图形化工具完全指南
  • 不止于治疗:皓贝一口腔医院的预防理念
  • 鹤壁宴席烟酒备,不浪费又体面
  • 嵌入式安全启动实战:从密钥管理到固件加密的CLI工具深度解析
  • 绝区零自动化工具终极指南:5个技巧让你的游戏体验提升300%
  • MelonLoader终极指南:快速解决Unity游戏模组加载问题的完整方案
  • markdownReader技术方案:构建Chrome原生Markdown渲染引擎的架构解析与实现
  • 绝区零自动化终极指南:5步打造你的智能游戏助手
  • 深入探索相机潜能:PMCA-RE逆向工程工具全解析
  • Windows安卓应用安装器终极指南:告别模拟器,原生运行APK应用