温馨提示×

CentOS dropped如何更新

小樊
38
2026-07-09 02:30:28
栏目: 智能运维

你说的「CentOS dropped」一般指 CentOS 8 已停止维护(EOL),官方不再提供更新源。下面按不同情况给你解决方案。


一、CentOS 8 已停止维护(最常见)

1️⃣ 问题原因

  • CentOS 8 已于 2021-12-31 停止更新
  • 官方仓库已删除,导致:
    yum update
    
    报错:
    Errors during downloading metadata for repository
    

2️⃣ 解决方案(推荐)

✅ 方案一:迁移到 CentOS Stream 8(官方推荐)

dnf install -y centos-release-stream
dnf swap -y centos-linux-repos centos-stream-repos
dnf distro-sync -y

完成后重启:

reboot

✅ 这是 Red Hat 官方推荐路径


✅ 方案二:迁移到 Rocky Linux / AlmaLinux(生产推荐)

适合服务器、生产环境。

Rocky Linux(推荐)

dnf install -y rocky-repos
dnf distro-sync -y

AlmaLinux

dnf install -y almalinux-release
dnf distro-sync -y

✅ 方案三:临时修复(不推荐长期使用)

仅用于应急,把源指向归档地址:

sed -i 's|mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-*.repo
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo

然后:

yum clean all
yum makecache

⚠️ 无安全更新,不建议生产使用


二、CentOS 7 仍然可用(但快 EOL)

  • CentOS 7 2024-06-30 停止维护
  • 目前仍可更新:
yum update -y

⚠️ 建议尽早迁移到 Rocky / Alma / Ubuntu / Debian


三、如果你用的是 CentOS Stream 9

✅ 正常更新即可:

dnf update -y

四、我可以进一步帮你

你可以直接告诉我:

  1. cat /etc/os-release
  2. 生产环境还是测试环境
  3. 是否允许重装系统

我可以给你 最稳妥的迁移方案(含命令)

0