CentOS7.x升级至RockyLinux8.x
默认CentOS7.x是无法直接升级到8.x任何版本的,为了解决CentOS7.x升级到8.x版本的问题,AlmaLinux推出了一个名为ELevate项目来帮助用户从7.x版本升级到8.x。
ELevate支持的操作系统有:AlmaLinux8、CentOS8、EuroLinux8、Oracle Linux8、Rocky Linux8。
项目官方网址:https://almalinux.org/elevate/
github开源地址:https://github.com/AlmaLinux/leapp-repository/tree/almalinux
请注意升级前一定要做好数据备份,避免某种原因导致升级失败!!!
CentOS7.x升级至RockyLinux8.x开始
1、更新当前CentOS7.x版本为最新
yum update
2、更新完成后重启
reboot
3、安装elevate库
yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm
4、安装leapp包以及升级包
在文章开始介绍了ELevate支持5个7.x至8.x版本的系统升级,所以这里你要先确定要升级的8.x版本是哪一个,然后安装对应的升级包。
我这里是从7.x升级到rocky8.x,所以需要安装leapp-data-rocky包
yum install leapp-upgrade leapp-data-rocky -y
注:如果你是要升级到其他8.x版本则需要安装其他的包,总之想要升级到哪个版本就安装哪个
leapp-upgrade leapp-data-almalinux
leapp-upgrade leapp-data-centos
leapp-upgrade leapp-data-eurolinux
leapp-upgrade leapp-data-oraclelinux
5、升级前检查
执行升级前检查命令,Leapp会创建一个/var/log/leapp/leapp-report.txt文件,这个文件会包含可能出现的问题以及推荐的解决方案,在检查阶段,不会安装任何rpm包组。
注:如果你当前不允许root登录,则需要执行以下命令,放通root
sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config
执行升级前检查命令
leapp preupgrade
============================================================
UPGRADE INHIBITED
============================================================
Upgrade has been inhibited due to the following problems:
1. Inhibitor: A YUM/DNF repository defined multiple times
2. Inhibitor: Missing required answers in the answer file
Consult the pre-upgrade report for details and possible remediation.
============================================================
UPGRADE INHIBITED
============================================================
Debug output written to /var/log/leapp/leapp-preupgrade.log
============================================================
REPORT
============================================================
A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt
============================================================
END OF REPORT
============================================================
解决检查出现的问题:
问题一:因为我这里安装了内网的yum源,和默认的源冲突了,所以我需要把冲突的源解决掉,如果你没有改动过yum源的话,一般也不会出现yum源的报错。
问题二:查看log
cat /var/log/leapp/leapp-report.txt
可以看到需要你执行这个命令
leapp answer --section remove_pam_pkcs11_module_check.confirm=True
问题解决完成后,再次执行升级前检查命令,确保检查升级通过
leapp preupgrade
看到以下内容,即表示检查通过
============================================================
REPORT
============================================================
A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt
============================================================
END OF REPORT
============================================================
6、开始升级
leapp upgrade
A reboot is required to continue. Please reboot your system.
Debug output written to /var/log/leapp/leapp-upgrade.log
============================================================
REPORT
============================================================
A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt
============================================================
END OF REPORT
7、根据上面提示,重启系统
reboot
重启后可以看到,系统还在进行升级操作
升级完成后,还会自动重启,二次自动重启完成后就是最新的Rocky8系统了
8、查看升级后的系统版本
cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.7 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.7"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.7 (Green Obsidian)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-8"
ROCKY_SUPPORT_PRODUCT_VERSION="8.7"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.7"
至此升级完成