如何将我的 RHEL EC2 实例从 RHEL 7 升级到 RHEL 8?
我需要升级我的 Red Hat Enterprise Linux (RHEL) Amazon Elastic Compute Cloud (Amazon EC2) 实例。
简短描述
使用 Leapp 实用程序在您的 Amazon EC2 实例上执行从 RHEL 版本 7 到 RHEL 版本 8 的就地升级。Leapp 是一款 AWS 命令行界面 (AWS CLI) 工具,可帮助用户完成安装过程和就地升级。
最佳做法是在升级之前对实例进行备份。为此,要么从实例创建亚马逊机器映像 (AMI),要么创建快照。
另一种最佳做法是先在测试实例上进行升级。如果所有应用程序都能在您的环境中按预期运行,则在实时生产实例上进行升级。
有关已知限制和操作系统 (OS) 就地升级的详细说明,请参阅 Red Hat 网站上的 Upgrading from RHEL 7 to RHEL 8(从 RHEL 7 升级到 RHEL 8)。
解决方法
**注意:**如果您在运行 AWS CLI 命令时收到错误,请参阅 AWS CLI 错误故障排除。此外,请确保您使用的是最新版本的 AWS CLI。
-
在从 RHEL 7 升级到 RHEL 8 之前,请先将实例升级到 RHEL 7 的最新次要版本。在 AWS CLI 中使用以下命令:
$ sudo su\# yum update -y\# reboot -
实例重启后,确保该实例已更新到可用的最新 RHEL 7 次要版本。请使用以下命令:
$ sudo su \# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.9 (Maipo) -
安装 Leapp。要安装,请启用必要的 RHUI 存储库并安装软件包。运行以下命令:
# yum-config-manager --enable rhui-client-config-server-7 # yum-config-manager --enable rhel-7-server-rhui-extras-rpms # yum install -y leapp leapp-rhui-aws leapp-repository leapp-repository-deps lvm2-python-boom —enablerepo=\* -
要检查是否有任何错误,请运行升级前命令:
$ leapp preupgrade --no-rhsm如果您发现任何错误,请按照对升级前错误进行故障排除中的步骤进行操作。
-
如果您不使用 Red Hat Subscription Manager (RHSM),请运行以下命令:
$ leapp upgrade --no-rhsm -
要升级到特定版本(如 RHEL 8.8),请运行以下命令:
$ leapp upgrade --target 8.8 --no-rhsm -
重启实例,然后确认该实例正在运行 RHEL 8:
\# reboot \# cat /etc/redhat-release
对升级前错误进行故障排除
运行升级前命令时,您可能会收到以下输出:
\============================================================ 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 fileConsult the pre-upgrade report for details and possible remediation \============================================================ UPGRADE INHIBITED \============================================================ Debug output written to /var/log/leapp/leapp-preupgrade.log \============================================================
要解决这些错误,请执行以下操作:
"Inhibitor: Possible problems with remote login using root account."
允许 SSH 的 PermitRootLogin 来解决此问题。sshd 配置文件位于 /etc/ssh/sshd_config 文件夹中。在 sshd 配置文件中,取消注释以下行:
#PermitRootLogin yes
"Inhibitor: Missing required answers in the answer file.Consult the pre-upgrade report for details and possible remediation."
应答文件的输出由 Leapp 在 the /var/log/leapp/answer 文件中生成。使用以下命令访问应答文件:
$ 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 RHEL-8 since it was replaced by SSSD. \# Reason: Leaving this module in PAM configuration may lock out the system. \# Type: bool# Default: None# Available choices: True/False \# Unanswered question. Uncomment the following line with your answer \# confirm =
使用以下格式确认应答:
$ leapp answer —section remove\_pam\_pkcs11\_module\_check.confirm=True
使用以下命令验证对文件的更新:
$ cat /var/log/leapp/answerfile \[remove\_pam\_pkcs11\_module\_check\] confirm = True
