将CentOS 8无缝更新到CentOS Stream 8

本文最后更新于:2022年3月1日 晚上

前言

最近上我的云服务器搞点东西,结果发现yum没法用了,一直提示

1
mirrorlist: No URLs in mirrorlist

不查不知道,一查吓一跳,原来官方已经在2021/12/31停止了对CentOS 8的支持,那我就试着更新yum源试试,这里使用的是阿里的yum镜像源

  1. 将源文件备份
1
cd /etc/yum.repos.d/ && mkdir backup && mv *repo backup/ 
  1. 下载阿里源文件
1
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
  1. 更新源里面的地址
1
2
3
4
5
sed -i -e "s|mirrors.cloud.aliyuncs.com|mirrors.aliyun.com|g " /etc/yum.repos.d/CentOS-*



sed -i -e "s|releasever|releasever-stream|g" /etc/yum.repos.d/CentOS-*
  1. 生成缓存
1
yum clean all && yum makecache

到这里就能切换完成了,但是很不凑巧,当我执行yum check-updateyum update之后出现报错,并有下列提示

1
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

总之老子再也不想用CentOS 8了,赶紧切换到CentOS Stream

CentOS 8平滑升级至CentOS Stream

1
2
3
4
5
6
7
# 老方法 dnf install centos-release-stream 不再推荐使用
dnf swap centos-linux-repos centos-stream-repos
dnf distro-sync

# 查看当前版本
cat /etc/centos-release
CentOS Stream release 8

建议更新后重启一下。

CentOS Stream迁移后还原回CentOS 8

https://forums.rockylinux.org/t/centos-8-centos-stream-rocky-linux/2343/5

https://unix.stackexchange.com/questions/624494/how-to-switch-to-centos-8-from-centos-stream


将CentOS 8无缝更新到CentOS Stream 8
https://jialiangz.github.io/2022/02/23/update-to-CentosStream8/
作者
爱吃菠萝
发布于
2022年2月23日
更新于
2022年3月1日
许可协议