328 字
2 分钟
CentOSStream8 YUM源配置
CentOS Stream 8 在 2024 年 5 月 31 日 EOL 后,mirror.centos.org 上的 8 系列源已经下线,原系统的 yum makecache 全部 404。处理方式不是修一行 baseurl,而是整体替换为阿里云保留下来的 Centos-8 源。
1. 关闭防火墙和 SELinux
$ systemctl stop firewalld && systemctl disable firewalld$ setenforce 0$ sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/selinux/config2. 整体替换阿里仓库源
把官方 repo 文件全部挪走,下载阿里云的 Centos-8 repo:
$ mv /etc/yum.repos.d/* /media/$ curl -o /etc/yum.repos.d/aliyun.repo http://mirrors.aliyun.com/repo/Centos-8.repo$ yum clean all && yum makecache不能像 AlmaLinux/Rocky 那样
sed替换 baseurl —— 因为 Stream 8 的原始仓库定义里指向的路径在 mirror.centos.org 已经完全消失,必须换一份能用的 repo 文件。
3. 验证
$ yum repolist$ yum install -y vim应能看到 baseurl 指向 mirrors.aliyun.com/centos/8/...,且仓库状态正常。
4. 常见问题
| 现象 | 处理 |
|---|---|
makecache 报 Failed to download metadata | 官方源还残留,确认 /etc/yum.repos.d/ 下只剩 aliyun.repo |
| 部分包仍 404 | Stream 8 已 EOL,部分仓库需要切到阿里云的 vault 归档:https://mirrors.aliyun.com/centos-vault/8-stream/ |
| 安装新版软件失败 | Stream 8 是滚动版,EOL 后新软件不会再进库,建议迁移到 Stream 9 或 Rocky 9 |
5. 其他可选镜像
# 清华curl -o /etc/yum.repos.d/tuna.repo \ https://mirrors.tuna.tsinghua.edu.cn/help/centos/
# 华为云curl -o /etc/yum.repos.d/huawei.repo \ https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo6. 同系列文章
- AlmaLinux 9:[[posts/almalinux9-yum-repo/index.md]]
- Rocky Linux 9:[[posts/rockylinux9-yum-repo/index.md]]
- CentOS 7:[[posts/centos7-yum-repo/index.md]]
- RHEL 系:[[posts/rhel7-yum-repo/index.md]]
- Debian 12:[[posts/debian12-apt-repo/index.md]]
- 离线场景制作本地仓库:[[posts/centos-local-yum-repo/index.md]]
CentOSStream8 YUM源配置
https://blog.xeu.asia/posts/centosstream8-yum-repo/