使用 Leapp 升级 Oracle Linux 7 到 8
前几天我想知道如何轻松地将 OL7 升级到 OL8,并且看起来 Oracle 拥有该过程的确切工具:
Oracle® Linux 8 使用 Leapp 执行系统升级
这是我将尝试升级的系统:
[root@OL7 ~]# head -1 /etc/*rel*
==> /etc/oracle-release <==
Oracle Linux Server release 7.9
==> /etc/os-release <==
NAME="Oracle Linux Server"
==> /etc/prelink.conf.d <==
head: error reading ‘/etc/prelink.conf.d’: Is a directory
==> /etc/redhat-release <==
Red Hat Enterprise Linux Server release 7.9 (Maipo)
==> /etc/system-release <==
Oracle Linux Server release 7.9
==> /etc/system-release-cpe <==
cpe:/o:oracle:linux:7:9:server
[root@OL7 ~]#
进入全屏模式 退出全屏模式
首先,我们需要确保启动管理器被禁用。由于这是一个虚拟机,我看不到启动管理器,所以我们很清楚:
[root@OL7 ~]# bootctl status
System:
Machine ID: 01a9ea161568458ba5d6f29e505d4c13
Boot ID: 965df6b728634b0287b3f4059b3c1807
No suitable data is provided by the boot manager. See:
http://www.freedesktop.org/wiki/Software/systemd/BootLoaderInterface
http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
for details.
进入全屏模式 退出全屏模式
确认语言环境设置为 en_US.UTF-8
[root@OL7 ~]# cat /etc/locale.conf
LANG="en_US.UTF-8"
进入全屏模式 退出全屏模式
更新系统以确保您使用的是最新版本并且所有软件包都已更新并重新启动系统
[root@OL7 ~]# yum update
ol7_UEKR6 | 3.0 kB 00:00:00
ol7_addons | 3.0 kB 00:00:00
ol7_developer | 3.0 kB 00:00:00
[....]
Updated:
bind-export-libs.x86_64 32:9.11.4-26.P2.el7_9.7 btrfs-progs.x86_64 0:5.12.1-1.el7 dhclient.x86_64 12:4.2.5-83.0.1.el7_9.1
dhcp-common.x86_64 12:4.2.5-83.0.1.el7_9.1 dhcp-libs.x86_64 12:4.2.5-83.0.1.el7_9.1 glib2.x86_64 0:2.56.1-9.el7_9
grub2.x86_64 1:2.02-0.87.0.13.el7_9.6 grub2-common.noarch 1:2.02-0.87.0.13.el7_9.6 grub2-pc.x86_64 1:2.02-0.87.0.13.el7_9.6
grub2-pc-modules.noarch 1:2.02-0.87.0.13.el7_9.6 grub2-tools.x86_64 1:2.02-0.87.0.13.el7_9.6 grub2-tools-extra.x86_64 1:2.02-0.87.0.13.el7_9.6
grub2-tools-minimal.x86_64 1:2.02-0.87.0.13.el7_9.6 gssproxy.x86_64 0:0.7.0-30.el7_9 kernel-tools.x86_64 0:3.10.0-1160.42.2.el7
kernel-tools-libs.x86_64 0:3.10.0-1160.42.2.el7 kpartx.x86_64 0:0.4.9-135.0.1.el7_9 krb5-libs.x86_64 0:1.15.1-50.0.1.el7
libxml2.x86_64 0:2.9.1-6.0.3.el7.5 libxml2-python.x86_64 0:2.9.1-6.0.3.el7.5 libzstd.x86_64 0:1.5.0-1.el7
linux-firmware.noarch 999:20210617-999.8.git0f66b74b.el7 nfs-utils.x86_64 1:1.3.0-0.68.0.1.el7.1 openldap.x86_64 0:2.4.44-24.el7_9
oraclelinux-release-el7.x86_64 0:1.0-17.el7 pciutils.x86_64 0:3.5.1-3.0.1.el7 pciutils-libs.x86_64 0:3.5.1-3.0.1.el7
rsyslog.x86_64 0:8.24.0-57.0.1.el7_9.1 selinux-policy.noarch 0:3.13.1-268.0.13.el7_9.2 selinux-policy-targeted.noarch 0:3.13.1-268.0.13.el7_9.2
Replaced:
python-chardet.noarch 0:2.2.1-3.el7
Complete!
[root@OL7 ~]#
[root@OL7 ~]# reboot
进入全屏模式 退出全屏模式
现在让我们安装 Oracle Leapp 软件包
[root@OL7 ~]# yum install leapp --enablerepo=ol7_leapp,ol7_latest
No package leapp available.
Error: Nothing to do
[root@OL7 ~]#
进入全屏模式 退出全屏模式
起初它不起作用,但是文档实际上解释了原因:
https://docs.oracle.com/en/operating-systems/oracle-linux/8/leapp/chap-leapp-prep.html#:~:textu003dThis%20warning,to%20proceed。
“如果在更新 Oracle Linux 7 软件包之前已经存在 oracle-linux-ol7.repo 文件,则会出现此警告。更新过程会创建 .rpmnew 文件以避免覆盖当前文件中可能存在的任何自定义设置。
在这种情况下,使用 .rpmnew 文件指导您对现有的 .repo 文件进行必要的修改。将任何新信息合并到您的 .repo 文件中。 ol7_leapp 存储库描述必须列在最终的 oracle-linux-ol7.repo 文件中,才能继续进行升级。”
所以,我所做的就是用新的 .rpmnew 文件替换默认的 .repo 文件:
[root@OL7 yum.repos.d]# ls -lrth
total 36K
-rw-r--r--. 1 root root 276 Feb 16 2021 oracle-softwarecollection-ol7.repo
-rw-r--r--. 1 root root 4.3K May 31 00:55 oracle-linux-ol7.repo <<<<<<<<<<<
-rw-r--r--. 1 root root 1.1K May 31 00:55 oraclelinux-developer-ol7.repo
-rw-r--r--. 1 root root 252 May 31 00:55 oracle-epel-ol7.repo
-rw-r--r--. 1 root root 226 Jun 9 03:57 virt-ol7.repo
-rw-r--r--. 1 root root 2.6K Jun 9 03:57 uek-ol7.repo
-rw-r--r--. 1 root root 4.5K Jun 9 03:57 oracle-linux-ol7.repo.rpmnew <<<<<<<<<<<
[root@OL7 yum.repos.d]# mv oracle-linux-ol7.repo oracle-linux-ol7.repo.bk
[root@OL7 yum.repos.d]# mv oracle-linux-ol7.repo.rpmnew oracle-linux-ol7.repo
[root@OL7 yum.repos.d]#
进入全屏模式 退出全屏模式
它现在应该可以工作了:
[root@OL7 yum.repos.d]# yum install leapp --enablerepo=ol7_leapp,ol7_latest
Resolving Dependencies
--> Running transaction check
---> Package leapp.noarch 0:0.12.0-1.0.1.el7_9 will be installed
--> Processing Dependency: python2-leapp = 0.12.0-1.0.1.el7_9 for package: leapp-0.12.0-1.0.1.el7_9.noarch
[....]
Transaction Summary
=====================================================================================================================================================================
Install 1 Package (+35 Dependent packages)
Total download size: 6.1 M
Installed size: 24 M
Is this ok [y/d/N]: y
[....]
Installed:
leapp.noarch 0:0.12.0-1.0.1.el7_9
Dependency 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
dnf-data.noarch 0:4.0.9.2-2.el7 json-glib.x86_64 0:1.4.2-2.el7 leapp-deps.noarch 0:0.12.0-1.0.1.el7_9
leapp-repository.noarch 0:0.13.0-2.0.1.el7_9 leapp-repository-deps.noarch 0:0.13.0-2.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 libmodulemd.x86_64 0:1.6.4-1.el7
librepo.x86_64 0:1.8.1-8.el7_9 libreport-filesystem.x86_64 0:2.1.11-53.0.1.el7 librhsm.x86_64 0:0.0.3-3.el7
libsemanage-python.x86_64 0:2.5-14.el7 libsolv.x86_64 0:0.6.34-4.el7 libyaml.x86_64 0:0.1.4-11.el7_0
policycoreutils-python.x86_64 0:2.5-34.0.1.el7 python-IPy.noarch 0:0.75-6.el7 python-backports.x86_64 0:1.0-8.el7
python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 python-enum34.noarch 0:1.0.4-1.el7 python-ipaddress.noarch 0:1.0.16-2.el7
python-pyudev.noarch 0:0.15-9.el7 python-requests.noarch 0:2.6.0-10.el7 python-setuptools.noarch 0:18.0.1-2.el7
python-six.noarch 0:1.9.0-2.el7 python-urllib3.noarch 0:1.10.2-7.el7 python2-dnf.noarch 0:4.0.9.2-2.el7
python2-hawkey.x86_64 0:0.22.5-2.el7 python2-leapp.noarch 0:0.12.0-1.0.1.el7_9 python2-libcomps.x86_64 0:0.1.8-14.el7
python2-libdnf.x86_64 0:0.22.5-2.el7 setools-libs.x86_64 0:3.3.8-4.el7
Complete!
[root@OL7 yum.repos.d]#
进入全屏模式 退出全屏模式
Preupgrade 命令将提供有关升级前的预期和任何市长问题的信息(如果您在 OCI 中运行此命令,请查看文档,因为您应该使用“--oci”而不是“--oraclelinux”)
它还将生成一个“应答文件”,其中包含在执行升级之前需要解决的更改
[root@OL7 yum.repos.d]# leapp preupgrade --oraclelinux
==> Processing phase `configuration_phase`
====> * ipu_workflow_config
IPU workflow config actor
==> Processing phase `FactsCollection`
====> * system_facts
Provides data about many facts from system.
====> * tcp_wrappers_config_read
Parse tcp_wrappers configuration files /etc/hosts.{allow,deny}.
====> * selinuxcontentscanner
Scan the system for any SELinux customizations
====> * scancpu
Scan CPUs of the machine.
====> * root_scanner
Scan the system root directory and produce a message containing
[....]
==> Processing phase `Reports`
====> * verify_check_results
Check all dialogs and notify that user needs to make some choices.
====> * verify_check_results
Check all generated results messages and notify user about them.
============================================================
UPGRADE INHIBITED
============================================================
Upgrade has been inhibited due to the following problems:
1. Inhibitor: Possible problems with remote login using root account
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
============================================================
Answerfile has been generated at /var/log/leapp/answerfile <<<<<
[root@OL7 yum.repos.d]#
[root@OL7 yum.repos.d]# cat /var/log/leapp/answerfile
[remove_pam_pkcs11_module_check]
# Title: None
# Reason: Confirmation
# =================== remove_pam_pkcs11_module_check.confirm ==================
# Label: Disable pam_pkcs11 module in PAM configuration? If no, the upgrade process will be interrupted.
# Description: PAM module pam_pkcs11 is no longer available in OL-8 since it was replaced by SSSD.
# Type: bool
# Default: None
# Available choices: True/False
# Unanswered question. Uncomment the following line with your answer
# confirm =
[root@OL7 yum.repos.d]#
进入全屏模式 退出全屏模式
为了能够执行升级,我们现在需要解决“UPGRADE INHIBITED”部分中的项目。
就我而言:
============================================================
UPGRADE INHIBITED
============================================================
Upgrade has been inhibited due to the following problems:
1. Inhibitor: Possible problems with remote login using root account
2. Inhibitor: Missing required answers in the answer file
Consult the pre-upgrade report for details and possible remediation.
进入全屏模式 退出全屏模式
要“响应”答案文件,我们可以使用 jumpp answer 命令(您也可以修改答案文件,而不是文档中提到的)
我还需要允许 SSH root 登录,我不确定这是否总是必要的,但我知道至少在升级期间启用它会更好,以确保您在升级期间不会失去对系统的完全访问权限过程(虽然我不需要在升级之前重新启动 SSH 服务)
[root@OL7 yum.repos.d]# leapp answer --section remove_pam_pkcs11_module_check.confirm=True
[root@OL7 yum.repos.d]#
[root@OL7 yum.repos.d]# grep PermitRootLogin /etc/ssh/sshd_config
PermitRootLogin yes
# the setting of "PermitRootLogin without-password".
[root@OL7 yum.repos.d]#
进入全屏模式 退出全屏模式
完成后,我们可以继续升级。
建议您保持第二个会话登录到系统,以防万一您失去连接。
[root@OL7 yum.repos.d]# leapp upgrade --oraclelinux
==> Processing phase `configuration_phase`
====> * ipu_workflow_config
IPU workflow config actor
==> Processing phase `FactsCollection`
====> * scanclienablerepo
Produce CustomTargetRepository based on the LEAPP_ENABLE_REPOS in config.
====> * system_facts
Provides data about many facts from system.
[....]
====> * check_skip_phase
Skip all the subsequent phases until the report phase.
==> Processing phase `TargetTransactionFactsCollection`
====> * target_userspace_creator
Initializes a directory to be populated as a minimal environment to run binaries from the target system.
Latest Unbreakable Enterprise Kernel Release 6 5.5 MB/s | 23 MB 00:04
Oracle Linux 8 Application Stream (x86_64) 6.2 MB/s | 26 MB 00:04
Oracle Linux 8 BaseOS Latest (x86_64) 6.1 MB/s | 35 MB 00:05
Last metadata expiration check: 0:00:07 ago on Wed Sep 8 12:18:03 2021.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
dnf noarch 4.4.2-11.el8 ol8_baseos_latest 539 k
Installing dependencies:
audit-libs x86_64 3.0-0.17.20191104git1c2f876.el8
ol8_baseos_latest 116 k
basesystem noarch 11-5.el8 ol8_baseos_latest 10 k
bash x86_64 4.4.20-1.el8_4 ol8_baseos_latest 1.5 M
brotli x86_64 1.0.6-3.el8 ol8_baseos_latest 323 k
[....]
tzdata noarch 2021a-1.el8 ol8_baseos_latest 473 k
xz-libs x86_64 5.2.4-3.el8 ol8_baseos_latest 94 k
zlib x86_64 1.2.11-17.el8 ol8_baseos_latest 102 k
Transaction Summary
================================================================================
Install 123 Packages
Total download size: 77 M
Installed size: 598 M
Downloading Packages:
(1/123): basesystem-11-5.el8.noarch.rpm 138 kB/s | 10 kB 00:00
(2/123): brotli-1.0.6-3.el8.x86_64.rpm 1.9 MB/s | 323 kB 00:00
(3/123): bzip2-libs-1.0.6-26.el8.x86_64.rpm 1.2 MB/s | 48 kB 00:00
(4/123): audit-libs-3.0-0.17.20191104git1c2f876 245 kB/s | 116 kB 00:00
(5/123): ca-certificates-2020.2.41-80.0.el8_2.n 1.9 MB/s | 391 kB 00:00
(6/123): bash-4.4.20-1.el8_4.x86_64.rpm 3.1 MB/s | 1.5 MB 00:00
[....]
(391/393): btrfs-progs-5.12.1-1.el8.x86_64.rpm 1.6 MB/s | 858 kB 00:00
(392/393): xfsprogs-5.4.0-1.0.1.el8.x86_64.rpm 1.5 MB/s | 1.1 MB 00:00
(393/393): linux-firmware-20210617-999.8.git0f6 4.8 MB/s | 178 MB 00:36
--------------------------------------------------------------------------------
Total 6.2 MB/s | 374 MB 01:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Complete!
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
==> Processing phase `InterimPreparation`
====> * efi_interim_fix
Adjust EFI boot entry for first reboot
====> * initram_disk_generator
Creates the upgrade initram disk
====> * 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
============================================================
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
[root@OL7 yum.repos.d]#
进入全屏模式 退出全屏模式
完成后,重新启动系统。
系统现在将应用升级的所有更改,因此需要一些时间才能启动。
如果您有控制台连接,建议将其打开以查看发生了什么。
而**voilà!**,我们可以看到系统现在是如何升级的:
[vagrant@OL7 ~]$ head -1 /etc/*rel*
==> /etc/oracle-release <==
Oracle Linux Server release 8.4
==> /etc/os-release <==
NAME="Oracle Linux Server"
==> /etc/prelink.conf.d <==
head: error reading '/etc/prelink.conf.d': Is a directory
==> /etc/redhat-release <==
Red Hat Enterprise Linux release 8.4 (Ootpa)
==> /etc/system-release <==
Oracle Linux Server release 8.4
==> /etc/system-release-cpe <==
cpe:/o:oracle:linux:8:4:server
[vagrant@OL7 ~]$
进入全屏模式 退出全屏模式
查看文档中的一些升级后任务
完成升级后任务在此过程之后确保系统处于最佳状态。
在任何情况下,看起来都是进行一些升级的好工具,但请确保您仔细检查升级前报告,并且在没有经过适当测试的情况下永远不要在生产系统上执行此操作:)
更多推荐




所有评论(0)