Skip to content

How do I upgrade my RHEL EC2 instance from RHEL 7 to RHEL 8?

4 minute read
0

I need to upgrade my Red Hat Enterprise Linux (RHEL) Amazon Elastic Compute Cloud (Amazon EC2) instance.

Short description

Use the Leapp utility to perform an in-place upgrade from RHEL version 7 to RHEL version 8 on your Amazon EC2 instance. Leapp is an AWS Command Line Interface (AWS CLI) tool that helps users with the installation process and in-place upgrade.

It's a best practice to make a backup of your instance before you upgrade. To do this, either create an Amazon Machine Image (AMI) from your instance or create a snapshot.

It's also a best practice to upgrade on a test instance first. If all of your applications work as expected for your environment, then upgrade on your live production instance.

For information on known limitations and detailed in-place operating system (OS) upgrade instructions, see Upgrading from RHEL 7 to RHEL 8 on the Red Hat website.

Resolution

Note: If you receive errors when you run AWS CLI commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

  1. Before you upgrade from RHEL 7 to RHEL 8, upgrade the instance to the latest minor release of RHEL 7. Use the following commands in the AWS CLI:

    $ sudo su 
    \# yum update -y 
    \# reboot
  2. After the instance reboots, make sure that the instance updated to the latest RHEL 7 minor version available. Use the following command:

    $ sudo su   
    \# cat /etc/redhat-release   
    Red Hat Enterprise Linux Server release 7.9 (Maipo)
  3. Install Leapp. To install, turn on necessary RHUI repositories and install the package. Run the following command:

     # 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=\*
  4. To check for any errors, run the pre-upgrade command:

    $ leapp preupgrade --no-rhsm

    If you see any errors, then follow the steps in Troubleshoot pre-upgrade errors.

  5. If you don't use Red Hat Subscription Manager (RHSM), then run the following command:

    $ leapp upgrade --no-rhsm
  6. To upgrade for a specific version (such as RHEL 8.8), run the following command:

    $ leapp upgrade --target 8.8 --no-rhsm
  7. Reboot the instance, and then confirm that the instance is running RHEL 8:

    \# reboot  
    \# cat /etc/redhat-release

Troubleshoot pre-upgrade errors

When you run the pre-upgrade command, you might get the following output:

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

To resolve these errors, take the following actions:

"Inhibitor: Possible problems with remote login using root account."

Allow PermitRootLogin for SSH to resolve this issue. The sshd configuration file is in the /etc/ssh/sshd_config folder. In the sshd configuration file, uncomment the following line:

#PermitRootLogin yes 

"Inhibitor: Missing required answers in the answer file. Consult the pre-upgrade report for details and possible remediation."

The output of the answer file generates in the /var/log/leapp/answer file by Leapp. Access the answer file with the following command:

$ cat /var/log/leapp/answerfile

The answer file displays results similar to the following:

\[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 = 

Confirm the answers with the following format:

$ leapp answer —section remove\_pam\_pkcs11\_module\_check.confirm=True

Verify the updates to the file with the following command:

$ cat /var/log/leapp/answerfile  
\[remove\_pam\_pkcs11\_module\_check\]  
confirm = True
AWS OFFICIALUpdated a month ago