理论上redhat系列较新的版本都可以这样更新,使用旧版本yum的发行版大概也可以。下面以 rocky linux 8.x 直接更新成rocky linux 9.x 示例
1. 先安装上基础包(release,repos,gpg-key)其包文件名,可以到该目录下查看,因为这几个包名里的版本号会随时更新。
dnf install https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r/rocky-release-9.2-1.6.el9.noarch.rpm dnf install --skip-broken https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r/rocky-repos-9.2-1.6.el9.noarch.rpm dnf install --skip-broken https://download.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os/Packages/r/rocky-gpg-keys-9.2-1.6.el9.noarch.rpm
2.执行更新
dnf --releasever=9 --allowerasing --setopt=deltarpm=false distro-sync
如果期间有报 GPG 错误,可以在本行命令中加上 –nogpgcheck 参数,不检查 gpg
3. 重建rpm数据库
rpm --rebuilddb
4. 重启 reboot
参考 https://www.starwindsoftware.com/blog/upgrade-from-rocky-linux-8-x-to-rocky-linux-9-0
可能存在的问题
a. 如果yum报如下的警告消息
Problem 1: conflicting requests - nothing provides module(platform:el8) needed by module mysql:8.0:8080020230517025647:fd72936b.x86_64 Problem 2: conflicting requests - nothing provides module(platform:el8) needed by module perl:5.26:8050020211109115414:b4937e53.x86_64 ... Problem 6: conflicting requests - nothing provides module(platform:el8) needed by module python36:3.6:8080020230329212447:683b2e54.x86_64 Problem 7: conflicting requests - nothing provides module(platform:el8) needed by module python38:3.8:8080020230625053205:0d9ba776.x86_64 Problem 8: conflicting requests - nothing provides module(platform:el8) needed by module python39:3.9:8080020230703194939:aed85c85.x86_64
应该是以前设置过一些 yum module,这些module在新版本里已经无效,也就是在 /etc/dnf/modules.d/ 下有相关模块的配置文件,删掉对应的文件就是了,再运行 yum check 时就没了。或者 运行 module reset mysql 等相应的模块也可。