51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

RockyLinux8升级RockyLinux9版本

之前吴昊写过el7升级el8的版本,见https://blog.whsir.com/post-7019.html

同样的,el8升级至el9依然依赖AlmaLinux的ELevate项目,但是不同于el7升级el8,升级el8时,可以选择多种版本升级路线,但是从el8升级el9就变得单一,比如当前是RockyLinux8,根据ELevate官方介绍,仅能升级到RockyLinux9,ELevate项目升级和迁移方向图示如下。


本文基于RockyLinux8环境,升级RockyLinux9,理论适用于其它版本。

1、更新update

请在升级前,升级当前RockyLinux8版本为最新,更新完成后建议重启一次
dnf update -y

|---|---------------| | 1 | dnf update -y |


reboot

|---|--------| | 1 | reboot |

2、安装elevate库
yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el$(rpm --eval %rhel).noarch.rpm

|---|----------------------------------------------------------------------------------------------------------| | 1 | yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el$(rpm --eval %rhel).noarch.rpm |

3、安装leapp包以及升级包
yum install -y leapp-upgrade leapp-data-rocky

|---|-----------------------------------------------| | 1 | yum install -y leapp-upgrade leapp-data-rocky |

注:如果你是其它版本要升级到9.x则需要安装对应的包,我这里是RockyLinux8所以是leapp-data-rocky
leapp-upgrade leapp-data-almalinux leapp-upgrade leapp-data-centos leapp-upgrade leapp-data-eurolinux leapp-upgrade leapp-data-oraclelinux

|---------|--------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 | leapp-upgrade leapp-data-almalinux leapp-upgrade leapp-data-centos leapp-upgrade leapp-data-eurolinux leapp-upgrade leapp-data-oraclelinux |

4、升级前检查

执行升级前检查命令,Leapp会创建一个/var/log/leapp/leapp-report.txt文件,这个文件会包含可能出现的问题以及推荐的解决方案,在检查阶段,不会安装任何rpm包组。

注:如果你当前不允许root登录,则需要执行以下命令,放通root
sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config

|---|----------------------------------------------------------------------------| | 1 | sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config |

执行升级前检查命令
leapp preupgrade

|---|------------------| | 1 | leapp preupgrade |

5、问题处理
============================================================ UPGRADE INHIBITED ============================================================ Upgrade has been inhibited due to the following problems: 1. Inhibitor: Detected RPMs with RSA/SHA1 signature 2. Inhibitor: A YUM/DNF repository defined multiple times Consult the pre-upgrade report for details and possible remediation. ============================================================ UPGRADE INHIBITED ============================================================

|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 6 7 8 9 10 11 12 | ============================================================ UPGRADE INHIBITED ============================================================ Upgrade has been inhibited due to the following problems: 1. Inhibitor: Detected RPMs with RSA/SHA1 signature 2. Inhibitor: A YUM/DNF repository defined multiple times Consult the pre-upgrade report for details and possible remediation. ============================================================ UPGRADE INHIBITED ============================================================ |

可以通过/var/log/leapp/leapp-preupgrade.log查看具体问题情况。

问题一:我这里的问题是当前存在使用SHA-1哈希算法的数字签名的包,在el9中不允许使用SHA-1,所以需要在leapp-preupgrade.log中找到对应的包并卸载掉,否则无法升级。

问题二:因为我这里安装了内网的yum源,和默认的源冲突了,所以我需要把冲突的源解决掉,如果你没有改动过yum源的话,一般也不会出现yum源的报错。

注:报错要结合实际情况进行处理,比如我这里检查通过,但是执行升级时又报Error: Transaction test error:
file /usr/share/redhat-logos from install of rocky-logos-90.15-2.el9.x86_64 conflicts with file from package rocky-logos-86.3-1.el8.x86_64问题,所以我就继续卸载rocky-logos包,强烈建议在测试环境做好充分测试,测试通过不表示升级就一定成功!!!

问题修复后,再次执行l检查命令
leapp preupgrade

|---|------------------| | 1 | 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 ============================================================

|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 6 7 8 9 10 | ============================================================ 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

|---|---------------| | 1 | leapp upgrade |

看到以下内容表示升级通过,可以进行reboot重启操作
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 ============================================================ Answerfile has been generated at /var/log/leapp/answerfile

|----------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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 ============================================================ Answerfile has been generated at /var/log/leapp/answerfile |

7、重启系统
reboot

|---|--------| | 1 | reboot |

在重启后引导时会自动选择Elevate-Upgrade-Initramfs



升级完成后,还会自动重启,二次自动重启完成后就是最新的RockyLinux9系统了


8、内核清理

升级到RockyLinux9后,系统还保留着老的内核,如确定不再需要,可以进行移除操作

可以通过以下命令,查看当前已存在的内核
rpm -qa | grep kernel

|---|------------------------| | 1 | rpm -qa | grep kernel |


kernel-modules-4.18.0-425.3.1.el8.x86_64 kernel-4.18.0-425.3.1.el8.x86_64 kernel-modules-4.18.0-553.el8_10.x86_64 kernel-core-4.18.0-425.3.1.el8.x86_64 kernel-core-4.18.0-553.el8_10.x86_64 kernel-4.18.0-553.el8_10.x86_64 kernel-tools-libs-5.14.0-427.18.1.el9_4.x86_64 kernel-modules-core-5.14.0-427.18.1.el9_4.x86_64 kernel-core-5.14.0-427.18.1.el9_4.x86_64 kernel-modules-5.14.0-427.18.1.el9_4.x86_64 kernel-tools-5.14.0-427.18.1.el9_4.x86_64 kernel-5.14.0-427.18.1.el9_4.x86_64

|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 6 7 8 9 10 11 12 | kernel-modules-4.18.0-425.3.1.el8.x86_64 kernel-4.18.0-425.3.1.el8.x86_64 kernel-modules-4.18.0-553.el8_10.x86_64 kernel-core-4.18.0-425.3.1.el8.x86_64 kernel-core-4.18.0-553.el8_10.x86_64 kernel-4.18.0-553.el8_10.x86_64 kernel-tools-libs-5.14.0-427.18.1.el9_4.x86_64 kernel-modules-core-5.14.0-427.18.1.el9_4.x86_64 kernel-core-5.14.0-427.18.1.el9_4.x86_64 kernel-modules-5.14.0-427.18.1.el9_4.x86_64 kernel-tools-5.14.0-427.18.1.el9_4.x86_64 kernel-5.14.0-427.18.1.el9_4.x86_64 |

使用dnf remove移除多余的内核版本
dnf remove kernel-4.18.0 kernel-modules-4.18.0 kernel-core-4.18.0

|---|-------------------------------------------------------------------| | 1 | dnf remove kernel-4.18.0 kernel-modules-4.18.0 kernel-core-4.18.0 |

此时重新启动后,老的4.18内核不复存在。


赞(1)
未经允许不得转载:工具盒子 » RockyLinux8升级RockyLinux9版本