This topic describes how to upgrade Red Hat Enterprise Linux (RHEL) 7 to RHEL 8 or RHEL 8 to RHEL 9 on an ECS instance.
RHEL 7 upgrade to RHEL 8
After June 30, 2024, RHEL 7 transitions from the Maintenance Support phase to the Extended Life phase. Red Hat provides limited technical support. To obtain comprehensive technical support and security updates, it is recommended to upgrade RHEL 7 to RHEL 8.
If you are using the RHEL 7.9 system and your current business must remain on the RHEL 7.9 version, it is recommended to first purchase an Alibaba Cloud Red Hat Enterprise Linux Extended Life Cycle Support (ELS) Add-On subscription to continue receiving security updates and bug fixes. For more information, see purchase extended life cycle support (ELS) subscription.
Prerequisites
-
Ensure that the RHEL instance to be upgraded meets the system operation requirements. For specific requirements, see Red Hat Enterprise Linux capabilities and limitations.
-
Ensure that your RHEL instance is purchased as a RHEL 7 system through Alibaba Cloud public image (with RHEL 7 subscription included) or imported to Alibaba Cloud as a RHEL 7 system with an Alibaba Cloud RHEL 7 subscription purchased.
Note-
The Alibaba Cloud RHEL subscription provides legal software access, security updates, and technical support for using the RHEL operating system on Alibaba Cloud.
-
If you have purchased a Red Hat RHEL system independently, refer to the official Red Hat documentation Upgrading from RHEL 7 to RHEL 8 for upgrade instructions.
-
Procedure
-
Before upgrading, it is recommended to understand the upgrade risks and create a snapshot to back up data, so you can quickly recover if any issues occur during the upgrade.
-
Remotely connect to the ECS instance of the RHEL system using the root user.
For specific operations, see log on to a Linux instance using the Workbench tool with the SSH protocol.
ImportantThe upgrade operation involves modifying system configuration files, library files, etc., and requires root privileges to ensure the upgrade process is completed smoothly.
-
Run the following command to confirm whether your RHEL instance is using an Alibaba Cloud RHEL subscription.
rpm -q client-rhel7
-
If there is no echo information, it indicates that your system is not using an Alibaba Cloud RHEL subscription. Please purchase a subscription before performing the upgrade operation.
-
If there is echo information similar to
client-rhel7-3.0-1.el7_9.noarch
, it indicates that your system is using an Alibaba Cloud RHEL subscription, and you can continue with the upgrade operation described in this topic.
-
-
Prepare the upgrade environment.
-
Run the following command to upgrade the RHEL system to the latest version, which usually includes fixes for known vulnerabilities, bugs, and security issues, and restart the system to apply the changes.
yum -y update reboot
-
Run the following command to install the Leapp upgrade tool on the RHEL system.
yum -y install leapp leapp-rhui-alibaba --enablerepo="*"
-
Run the following command to confirm whether Leapp is installed successfully.
leapp --version
If there is echo information similar to
leapp version xxx
, it indicates that Leapp is installed successfully.
-
-
Perform a pre-upgrade check.
Due to the significant differences between RHEL systems, a pre-upgrade check must be performed using the Leapp tool before upgrading. You can view the Leapp check results and modify the configurations based on suggestions to meet upgrade requirements.
-
Run the following command to perform a pre-upgrade check.
-
Pre-upgrade to the latest version of RHEL 8.
leapp preupgrade --no-rhsm
-
Pre-upgrade to a specific target version, such as upgrading RHEL 7 to RHEL 8.8.
leapp preupgrade --no-rhsm --target 8.8
NoteYou can view the target versions supported for upgrade by running the
leapp preupgrade -h
command.
-
-
View the pre-upgrade check results.
The Leapp pre-upgrade check logs are stored in the following log files:
-
/var/log/leapp/leapp-preupgrade.log: stores the logs of the Leapp utility.
-
/var/log/leapp/leapp-report.txt: stores the pre-upgrade check report in the text format.
-
/var/log/leapp/leapp-report.json: stores the pre-upgrade check report in the JSON format.
If the pre-upgrade check fails, specific failed items (inhibitors) are displayed as shown in the following figure.
-
-
(Conditionally required) Handle pre-upgrade errors.
Check the
/var/log/leapp/leapp-report.txt
log file for any error messages during the pre-upgrade. You can fix the issues based on the suggestions provided by the Leapp tool. The following lists some common pre-upgrade check errors and solutions by risk level.-
high (inhibitor): High risk (inhibitor). These issues will directly block the upgrade process and must be resolved before continuing with the upgrade.
-
-
high: High risk. These issues will not directly block the upgrade, but it is recommended to resolve them before or after the upgrade to avoid problems after the upgrade.
-
-
medium: Medium risk. These issues will not directly block the upgrade, but it is recommended to resolve them before or after the upgrade to avoid potential issues after the upgrade.
-
low: Low risk. These issues have little impact on the upgrade process or system operation, but it is recommended to resolve them before or after the upgrade to ensure stable system operation.
-
info: Information. These issues are usually informational and do not affect the upgrade process or system operation. You can view the specific prompts in the report to understand the changes that will occur during the upgrade.
-
-
-
Run the following command to upgrade.
-
Upgrade to the latest version of RHEL 8.
leapp upgrade --no-rhsm
-
Upgrade to a specific target version, such as upgrading RHEL 7 to RHEL 8.8.
leapp upgrade --no-rhsm --target 8.8
The following command output indicates that the upgrade is complete.
-
-
Run the following command to restart the instance:
reboot
-
Verify the upgrade results.
-
Run the
cat /etc/redhat-release
command to check whether the system version has been updated. -
Check the upgrade logs or report.
-
Observe whether your business runs normally on the RHEL 8 system.
-
-
(Conditionally required) Run the following command to configure the RHEL source.
After the upgrade using the Leapp upgrade tool is complete, the
/etc/dnf/vars/releasever
file will be modified by default to limit the system upgrade to a specific version of RHEL. For example, for RHEL 8.8, the repo source information ishttps://xxxx/8.8/xxx
, and you can only access packages under the RHEL 8.8 version. If you want to automatically access the latest version of RHEL 8 packages to ensure you obtain the latest security patches and feature updates, you can delete the releasever configuration file and rebuild the metadata cache to achieve this.rm -f /etc/dnf/vars/releasever dnf clean all && dnf makecache
After the execution is complete, the repo source information for RHEL 8 will be updated to
https://xxxx/8/xxx
, and the system will be able to automatically obtain the latest security patches and feature updates for the latest version of RHEL 8, ensuring the system is always up to date.
RHEL 8 upgrade to RHEL 9
Although RHEL 8 is currently in the Full Support phase, you can upgrade the system to RHEL 9 as needed to obtain the latest features, hardware adaptation, and long-term support.
Prerequisites
-
Ensure that the RHEL instance to be upgraded meets the system operation requirements. For specific requirements, see Red Hat Enterprise Linux capabilities and limitations.
-
Ensure that your RHEL instance is purchased as a RHEL 8 system through Alibaba Cloud public image (with RHEL 8 subscription included) or imported to Alibaba Cloud as a RHEL 8 system with an Alibaba Cloud RHEL 8 subscription purchased.
Note-
The Alibaba Cloud RHEL subscription provides legal software access, security updates, and technical support for using the RHEL operating system on Alibaba Cloud.
-
If you have purchased a Red Hat RHEL system independently, refer to the official Red Hat documentation Upgrading from RHEL 8 to RHEL 9 for upgrade instructions.
-
Procedure
-
Before upgrading, it is recommended to understand the upgrade risks and create a snapshot to back up data, so you can quickly recover if any issues occur during the upgrade.
-
Remotely connect to the ECS instance of the RHEL system using the root user.
For specific operations, see log on to a Linux instance using the Workbench tool with the SSH protocol.
ImportantThe upgrade operation involves modifying system configuration files, library files, etc., and requires root privileges to ensure the upgrade process is completed smoothly.
-
Run the following command to confirm whether your RHEL instance is using an Alibaba Cloud RHEL subscription.
rpm -qa |grep aliyun
-
If there is no echo information, it indicates that your system is not using an Alibaba Cloud RHEL subscription. Please purchase a subscription before performing the upgrade operation.
-
If there is echo information similar to the following containing the minor version
rhel8.6
, please first submit a ticket to obtain and install the latest rpm package before performing the upgrade operation.NoteWhen running RHEL on Alibaba Cloud, the system needs to access Red Hat's software repository through Alibaba Cloud's RHUI service. If a minor version package (such as
aliyun_rhel8.6-2.0-1.noarch
) is installed in the system, the system may not be able to connect to RHUI correctly, resulting in the inability to obtain software updates or upgrade to a new version. -
If there is echo information similar to the subscription package
aliyun_rhui_rhel8-2.0-3.x86_64
, it indicates that your system is using an Alibaba Cloud RHEL subscription, and you can continue with the upgrade operation described in this topic.
-
-
Prepare the upgrade environment.
-
Run the following command to upgrade the RHEL system to the latest version, which usually includes fixes for known vulnerabilities, bugs, and security issues, and restart the system to apply the changes.
yum -y update reboot
-
Run the following command to install the Leapp upgrade tool on the RHEL system.
yum -y install leapp leapp-rhui-alibaba --enablerepo="*"
-
Run the following command to confirm whether Leapp is installed successfully.
leapp --version
If there is echo information similar to
leapp version xxx
, it confirms that Leapp is successfully installed.
-
-
Perform a pre-upgrade check.
Due to significant differences between RHEL systems, a pre-upgrade check using the Leapp tool is necessary before upgrading. Review the Leapp check results and adjust configurations as recommended to fulfill upgrade prerequisites.
-
Execute the following command to initiate a pre-upgrade check.
-
Pre-upgrade to the latest version of RHEL 9.
leapp preupgrade --no-rhsm
-
Pre-upgrade to a specific target version, such as RHEL 8 to RHEL 9.4.
leapp preupgrade --no-rhsm --target 9.4
NoteTo see which target versions are supported for the upgrade, run the
leapp preupgrade -h
command.
-
-
Examine the pre-upgrade check results.
Leapp pre-upgrade check logs are saved in the following files:
-
/var/log/leapp/leapp-preupgrade.log: contains logs from the Leapp utility.
-
/var/log/leapp/leapp-report.txt: presents the pre-upgrade check report in text format.
-
/var/log/leapp/leapp-report.json: provides the pre-upgrade check report in JSON format.
If the pre-upgrade check identifies any inhibitors, they will be displayed as shown in the figure below.
-
-
(Conditionally required) Address pre-upgrade errors.
Inspect the
/var/log/leapp/leapp-report.txt
for error messages from the pre-upgrade check. Resolve any issues according to the Leapp tool's recommendations. Below are common pre-upgrade errors and their solutions, categorized by risk level.-
high: High risk. These issues may not block the upgrade directly, but resolving them is advised either before or after the upgrade to prevent post-upgrade problems.
-
-
low: Low risk. These issues may have minimal impact on the upgrade process or system operation, but addressing them is recommended either before or after the upgrade for stable system performance.
-
info: Informational. These issues typically do not impact the upgrade process or system operation. Review the prompts in the report for insights into changes that will occur during the upgrade.
-
-
-
Execute the following command to upgrade.
-
Upgrade to the latest version of RHEL 9.
leapp upgrade --no-rhsm
-
Upgrade to a specific target version, such as RHEL 8 to RHEL 9.4.
leapp upgrade --no-rhsm --target 9.4
The output of the following command indicates that the upgrade is complete.
-
-
Run the following command to restart the instance:
reboot
-
Verify the upgrade results.
-
Execute the
cat /etc/redhat-release
command to confirm the system version update. -
Review the upgrade logs or report.
-
Monitor your business operations on the RHEL 9 system for normal functionality.
-
-
(Conditionally required) Execute the following command to configure the RHEL source.
After completing the upgrade with the Leapp tool, the
/etc/dnf/vars/releasever
file will by default restrict system upgrades to a specific RHEL version. For instance, for RHEL 9.4, the repository source will behttps://xxxx/9.4/xxx
, limiting access to RHEL 9.4 packages only. To automatically access the latest RHEL 9 packages and ensure receipt of the most recent security patches and feature updates, delete the releasever configuration file and refresh the metadata cache.rm -f /etc/dnf/vars/releasever dnf clean all && dnf makecache
Once completed, the repository source for RHEL 9 will be updated to
https://xxxx/9/xxx
, allowing the system to automatically receive the latest updates for RHEL 9, keeping it up-to-date.
References
-
You can also upgrade Red Hat 8 to Red Hat 9 through the Server Migration Center (SMC). For details, see operating system migration (Linux).
-
For more information about Red Hat, visit the official Red Hat documentation Red Hat Enterprise Linux.
-
For frequently asked questions about RHEL 7 entering the Extended Life phase, refer to the official Red Hat FAQ document.