当前位置: 首页 > 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.cnnetsun.cn/news/3041079.html

相关文章:

  • 鹤壁宴席烟酒备,不浪费又体面
  • 2026闭眼入!5款AI论文工具实测,告别卡壳症,初稿思路秒打通!
  • BUUCTF 隐写术实战:从图片中剥离隐藏的Flag
  • 如何通过NVIDIA Profile Inspector解锁显卡隐藏性能:免费开源工具终极指南
  • IDEA创建Spring Boot项目卡在Generating…?99%开发者忽略的4个网络/代理/缓存致命细节(附JDK17+Spring 3.2兼容清单)
  • 终极指南:如何免费下载Steam创意工坊模组无需Steam账号
  • 从服务配置到设备接管:详解虚拟机调用PC内置麦克风与声卡的全链路实践
  • 终极指南:如何用MelonLoader解锁Unity游戏的无限可能
  • YOLO26 架构解析:新一代实时目标检测核心技术
  • MySQL(十四):事务隔离与 MVCC 原理
  • 实战剖析——Cobalt Strike钓鱼攻击链的构建与防御思考
  • DeepBump:从单张图片智能生成法线贴图与高度图的AI工具
  • 解锁开源工具:OpenCore Legacy Patcher重塑老旧Mac的终极指南
  • Cursor Free VIP终极指南:三步轻松解除AI编程助手试用限制
  • CVE-2023-22527漏洞深度剖析:Confluence OGNL注入与远程代码执行实战
  • 构建AI模型:Excel驱动的深度学习模块化解析
  • 深度解密WeChatMsg:如何将微信聊天数据转化为个人数字资产
  • 2026年企业展厅设计的价值重构:从“空间装饰”到“品牌叙事引擎”
  • 3步高效实现老Mac硬件兼容性升级:OpenCore Legacy Patcher专业指南
  • (第7讲)支持完整RTSP流媒体服务器大全
  • 从单体到微服务,IDEA项目重构血泪史:17个真实踩坑案例(含Spring Cloud Config加密配置丢失、Eureka Zone感知错配等生产事故溯源)
  • WinBtrfs终极实战指南:3种配置方案解锁Windows Btrfs文件系统完整功能
  • IDEA中Spring Boot多模块启动总报NoSuchBeanDefinitionException?:基于Spring Boot 3.2源码级诊断的4类元数据加载失效根因分析
  • 【GoLand高效开发实战指南】:20年JetBrains IDE专家亲授的12个隐藏技巧,90%开发者从未用过
  • 三大突破让老旧Mac重获新生:OpenCore Legacy Patcher的技术民主化实践
  • 如何免费创建专业级虚拟摄像头:OBS VirtualCam终极指南
  • OBS VirtualCam:让你的直播和视频会议更专业的终极指南
  • 数据库开发效率断崖式提升,深度拆解DataGrip智能补全、数据可视化与CI/CD集成方案
  • 嵌入式 Linux init 进程 | 深入剖析原理、自启与方案抉择
  • APA第7版参考文献格式转换工具:3分钟解决Word引用难题的终极指南