环境准备
当前版本:redhat7.8
目标版本:redhat8.8
# 环境信息
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-1127.el7.x86_64 #1 SMP Tue Feb 18 16:39:12 EST 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 7.8 (Maipo)
# 升级所需的iso文件和升级软件leapp
[root@localhost ~]# ls -lh /app/
total 16G
-rw-r--r--. 1 root root 6.8M Nov 25 20:03 packages.zip #升级需要的rpm软件包
-rw-r--r--. 1 root root 11G Nov 25 20:09 rhel-8.8-x86_64-dvd.iso
-rw-r--r--. 1 root root 4.3G Nov 25 20:04 rhel-server-7.9-x86_64-dvd.iso
1、Redhat7.8升至7.9
使用7.9 iso文件做本地yum源升级
# 挂载镜像文件
[root@localhost ~]# mount /app/rhel-server-7.9-x86_64-dvd.iso /mnt/
mount: /dev/loop0 is write-protected, mounting read-only
[root@localhost ~]# df -h /mnt/
Filesystem Size Used Avail Use% Mounted on
/dev/loop0 4.3G 4.3G 0 100% /mnt
# 编辑repo文件
[root@localhost ~]# tee >>/etc/yum.repos.d/local-iso-centos-7.repo <<EOF
> [centos7-local]
> name=Centos7
> baseurl=file:///mnt/
> enabled=1
> gpgcheck=0
> EOF
[root@localhost ~]# cat /etc/yum.repos.d/local-iso-centos-7.repo
[centos7-local]
name=Centos7
baseurl=file:///mnt/
enabled=1
gpgcheck=0
# 升级
[root@localhost ~]# yum upgrade -y
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
centos7-local
[......]
Complete!
# 重启
[root@localhost ~]# reboot
# 查看升级结果
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-1160.el7.x86_64 #1 SMP Tue Aug 18 14:50:17 EDT 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)
2、Redhat7.9升至8.8
安装升级所需软件
# 解压package
[root@localhost app]# unzip packages.zip
[root@localhost app]# ls
audit-2.8.5-4.el7.x86_64.rpm leapp-upgrade-el7toel8-deps-0.19.0-1.el7_9.noarch.rpm libyaml-0.1.4-11.el7_0.x86_64.rpm python-chardet-2.2.1-3.el7.noarch.rpm
audit-libs-2.8.5-4.el7.x86_64.rpm libcgroup-0.41-21.el7.x86_64.rpm packages.zip python-enum34-1.0.4-1.el7.noarch.rpm
audit-libs-python-2.8.5-4.el7.x86_64.rpm libcomps-0.1.8-14.el7.x86_64.rpm pciutils-3.5.1-3.el7.x86_64.rpm python-IPy-0.75-6.el7.noarch.rpm
checkpolicy-2.5-8.el7.x86_64.rpm libdnf-0.22.5-2.el7_9.x86_64.rpm policycoreutils-2.5-34.el7.x86_64.rpm python-requests-2.6.0-10.el7.noarch.rpm
dnf-4.0.9.2-2.el7_9.noarch.rpm libmodulemd-1.6.3-1.el7.x86_64.rpm policycoreutils-python-2.5-34.el7.x86_64.rpm python-urllib3-1.10.2-7.el7.noarch.rpm
dnf-data-4.0.9.2-2.el7_9.noarch.rpm librepo-1.8.1-8.el7_9.x86_64.rpm python2-dnf-4.0.9.2-2.el7_9.noarch.rpm rhel-8.8-x86_64-dvd.iso
json-glib-1.4.2-2.el7.x86_64.rpm libreport-filesystem-2.1.11-53.el7.x86_64.rpm python2-hawkey-0.22.5-2.el7_9.x86_64.rpm rhel-server-7.9-x86_64-dvd.iso
leapp-0.16.0-1.el7_9.noarch.rpm librhsm-0.0.3-3.el7_9.x86_64.rpm python2-leapp-0.16.0-1.el7_9.noarch.rpm setools-libs-3.3.8-4.el7.x86_64.rpm
leapp-deps-0.16.0-1.el7_9.noarch.rpm libsemanage-python-2.5-14.el7.x86_64.rpm python2-libcomps-0.1.8-14.el7.x86_64.rpm
leapp-upgrade-el7toel8-0.19.0-1.el7_9.noarch.rpm libsolv-0.6.34-4.el7.x86_64.rpm python2-libdnf-0.22.5-2.el7_9.x86_64.rpm
# 安装软件包
[root@localhost app]# yum localinstall *
[......]
Install 27 Packages
Total size: 27 M
Installed size: 27 M
Is this ok [y/d/N]: y
[......]
Installed:
audit-libs-python.x86_64 0:2.8.5-4.el7 checkpolicy.x86_64 0:2.5-8.el7 dnf.noarch 0:4.0.9.2-2.el7_9
dnf-data.noarch 0:4.0.9.2-2.el7_9 leapp.noarch 0:0.16.0-1.el7_9 leapp-deps.noarch 0:0.16.0-1.el7_9
leapp-upgrade-el7toel8.noarch 0:0.19.0-1.el7_9 leapp-upgrade-el7toel8-deps.noarch 0:0.19.0-1.el7_9 libcgroup.x86_64 0:0.41-21.el7
libcomps.x86_64 0:0.1.8-14.el7 libdnf.x86_64 0:0.22.5-2.el7_9 libmodulemd.x86_64 0:1.6.3-1.el7
librepo.x86_64 0:1.8.1-8.el7_9 librhsm.x86_64 0:0.0.3-3.el7_9 libsemanage-python.x86_64 0:2.5-14.el7
libsolv.x86_64 0:0.6.34-4.el7 policycoreutils-python.x86_64 0:2.5-34.el7 python-IPy.noarch 0:0.75-6.el7
python-enum34.noarch 0:1.0.4-1.el7 python-requests.noarch 0:2.6.0-10.el7 python-urllib3.noarch 0:1.10.2-7.el7
python2-dnf.noarch 0:4.0.9.2-2.el7_9 python2-hawkey.x86_64 0:0.22.5-2.el7_9 python2-leapp.noarch 0:0.16.0-1.el7_9
python2-libcomps.x86_64 0:0.1.8-14.el7 python2-libdnf.x86_64 0:0.22.5-2.el7_9 setools-libs.x86_64 0:3.3.8-4.el7
Complete!
# 查看leapp是否安装成功
[root@localhost app]# leapp --version
leapp version 0.16.0
使用镜像升级
[root@localhost ~]# leapp upgrade --iso /app/rhel-8.8-x86_64-dvd.iso --no-rhsm
[......]
Debug output written to /var/log/leapp/leapp-upgrade.log
============================================================
REPORT OVERVIEW
============================================================
Upgrade has been inhibited due to the following problems:
1. Multiple devel kernels installed
2. Leapp detected loaded kernel drivers which have been removed in RHEL 8. Upgrade cannot proceed.
3. Failed to determine RHEL version provided by the supplied installation image.
4. Missing required answers in the answer file
HIGH and MEDIUM severity reports:
1. Packages available in excluded repositories will not be installed
2. Difference in Python versions and support in RHEL 8
3. Packages not signed by Red Hat found on the system
4. GRUB2 core will be automatically updated during the upgrade
5. chrony using default configuration
Reports summary:
Errors: 0
Inhibitors: 4
HIGH severity reports: 4
MEDIUM severity reports: 1
LOW severity reports: 6
INFO severity reports: 4
Before continuing consult the full 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 OVERVIEW
============================================================
Answerfile has been generated at /var/log/leapp/answerfile
[root@localhost ~]#
# 检查有Errors和Inhibitors问题时会导致升级检查不通过,本例中有4项Inhibitors
# 查看报告解决问题
解决升级检查中的问题
查看检查报告/var/log/leapp/leapp-report.txt给出的解决建议修复问题
- Multiple devel kernels installed
# 需要卸载旧内核
[root@localhost ~]# yum -y remove kernel-devel-3.10.0-1127.el7
- Leapp detected loaded kernel drivers which have been removed in RHEL 8. Upgrade cannot proceed.
# 去掉依赖的moudule
[root@localhost ~]# modprobe -r pata_acpi
[root@localhost ~]# modprobe -r floppy
- Failed to determine RHEL version provided by the supplied installation image.
上传的iso文件可能受损,重新上传一个
[root@localhost ~]# ls -lh /app/rhel-8.8-x86_64-dvd.iso
-rw-r--r--. 1 root root 12G Nov 29 16:33 /app/rhel-8.8-x86_64-dvd.iso
- Missing required answers in the answer file
# 设置answer文件
[root@localhost ~]# leapp answer --section remove_pam_pkcs11_module_check.confirm=True
解决这些问题之后重新执行升级
[root@localhost ~]# leapp upgrade --iso /app/rhel-8.8-x86_64-dvd.iso --no-rhsm
[......]
Install 392 Packages
Upgrade 623 Packages
Remove 123 Packages
Downgrade 7 Packages
Total size: 1.0 G
DNF will only download packages, install gpg keys, and check the transaction.
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Complete!
====> * add_upgrade_boot_entry
Add new boot entry for Leapp provided initramfs.
A reboot is required to continue. Please reboot your system.
Debug output written to /var/log/leapp/leapp-upgrade.log
============================================================
REPORT OVERVIEW
============================================================
HIGH and MEDIUM severity reports:
1. Packages available in excluded repositories will not be installed
2. Packages not signed by Red Hat found on the system
3. Difference in Python versions and support in RHEL 8
4. GRUB2 core will be automatically updated during the upgrade
5. chrony using default configuration
6. Module pam_pkcs11 will be removed from PAM configuration
Reports summary:
Errors: 0
Inhibitors: 0
HIGH severity reports: 4
MEDIUM severity reports: 2
LOW severity reports: 7
INFO severity reports: 4
Before continuing consult the full 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 OVERVIEW
============================================================
Answerfile has been generated at /var/log/leapp/answerfile
# 重启
[root@localhost ~]# reboot
升级后第一次重启启动时间较长,因为后台在进行升级
升级后系统版本检查
[root@localhost ~]# uname -a
Linux localhost.localdomain 4.18.0-477.10.1.el8_8.x86_64 #1 SMP Wed Apr 5 13:35:01 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# more /etc/redhat-release
Red Hat Enterprise Linux release 8.8 (Ootpa)
升级完成。