Red Hat Enterprise Linux生命周期概述
Red Hat Enterprise Linux(简称RHEL)是一款由红帽公司开发的企业级开源Linux操作系统,提供高稳定性、安全性和支持服务,广泛用于企业服务器和数据中心环境。详情请参见Red Hat Enterprise Linux Life Cycle。
阿里云上RHEL公共镜像来源于红帽官方,由阿里云联合红帽原厂为用户提供技术支持。2024年6月30日后,RHEL 7从维护(Maintenance Support)阶段过渡到延长生命(Extended Life)阶段,延长生命阶段将持续4年。RHEL产品生命周期阶段如下表所示。
版本 | 发布日期 | 主流支持阶段 | 延长支持 停止日期 |
完全支持(Full Support) 停止日期 | 1阶段维护(Maintenance Support 1) 停止日期 | 2阶段维护(Maintenance Support 2) 停止日期 |
Red Hat 9 | 2022-05-18 | 2027-05-31 | 不涉及 | 2032-05-31 | 2035-05-31 |
Red Hat 8 | 2019-05-7 | 2024-05-31 | 不涉及 | 2029-05-31 | 2032-05-31 |
Red Hat 7 | 2014-06-10 | 2019-08-06 | 2020-08-06 | 2024-06-30 | 2028-06-30 |
Red Hat 6 | 2010-11-10 | 2016-05-10 | 2017-05-10 | 2020-11-30 | 2024-06-30 |
Red Hat 5 | 2007-03-15 | 2013-01-08 | 2014-01-31 | 2017-03-31 | 2020-11-30 |
Red Hat 4 | 2005-02-14 | 2009-03-31 | 2011-02-16 | 2012-02-29 | 2017-03-31 |
RHEL 7进入延长生命阶段的影响
RHEL 7进入延长生命阶段后,红帽官方会提供有限的技术支持。 在此阶段,不会提供程序漏洞修复、安全修复、硬件启用(Hardware Enablement)或根本原因分析,同时只对现有安装提供支持。
RHEL 7进入延长生命阶段后的建议方案概述
RHEL 7进入延长生命阶段事件需要您结合业务现状合理关注。比如对应的业务即将下线,那么可忽略此事件。对于仅私网环境可见的业务,操作系统停服的风险相对可控,可选择性关注。对公网提供服务以及对系统稳定性、安全性要求高的业务需要认真评估停服风险,并及时制定应对方案:
针对新增业务
不建议您使用已经进入延长生命周期阶段的RHEL 7镜像新建ECS实例继续提供服务。您可以选择使用与RHEL 7完全兼容,且处于主流支持阶段的操作系统如RHEL 8或RHEL 9承载您的业务。
针对存量业务
短期内,您可以购买RHEL 7的ELS订阅,以持续获得安全更新和错误修复。
若您希望在长期内维持业务稳定性,建议您升级到更新版本(推荐):即将RHEL 7原地升级到RHEL 8,或者进一步将RHEL 8升级到RHEL 9。您可以利用已购买的RHEL 7订阅进行升级,因为新版本提供了更多的安全更新、新功能以及与最新硬件和软件的兼容性。升级后,您可以持续获得全面的技术支持和安全更新,从而有效降低安全风险。
升级到更新版本
RHEL原地升级(In-Place Upgrade)是一种升级操作系统的方法,支持将RHEL 7升级到RHEL 8、将RHEL 8升级到RHEL 9,是推荐并支持的升级方法,尤其适用于希望保留现有工作流和配置的企业环境。原地升级允许用户将现有的RHEL系统升级到新的主版本,而不需要执行全新安装。这种方法可以保留现有的应用程序、配置和数据,同时确保您继续获得安全更新、错误修复和技术支持。
红帽提供了Leapp工具用于原地升级,且支持预升级检查。您可以使用红帽官方的工具远程登录云服务器实例进行升级:
购买延长生命周期支持(ELS)订阅
RHEL ELS订阅全称是Red Hat Enterprise Linux Extended Life Cycle Support (ELS) Add-On,是红帽官方推出的延长生命周期订阅,可以为您提供关键和重要的安全修复以及某些紧急bug的修复,有助于缓解延长生命周期阶段的安全风险。但请注意,ELS仅适用于RHEL 7.9版本,有效期至2028年6月30日。阿里云提供了RHEL 7 ELS的购买方式,购买方法请参考为ECS实例购买软件许可证(邀测)。
购买RHEL 7 ELS Add-on订阅的价格如下:
1 vCPU~8 vCPU:包月(36.28元/vCPU/月)、包年(377.29元/vCPU/年)、按量付费(0.0581元/vCPU/时)
9 vCPU~127 vCPU:包月(27.21元/vCPU/月)、包年(282.97元/vCPU/年)、按量付费(0.0415元/vCPU/时)
128 vCPU及以上:包月(23.58元/vCPU/月)、包年(245.24元/vCPU/年)、按量付费(0.0332元/vCPU/时)
常见问题
RHEL 7进入ELS后,会强制为RHEL 7实例购买RHEL ELS Add-on订阅吗?
RHEL 7进入ELS后,如果实例没有购买RHEL ELS Add-on订阅,会被停机吗?
不会被停机。RHEL ELS Add-on订阅是红帽提供的安全更新和补丁,不购买只是无法获取这些更新,从而无法保障您的实例安全性。
RHEL 7进入ELS后,如果实例没有购买RHEL ELS Add-on订阅,可以正常续费吗?
包年包月的RHEL实例到期后可以正常续费。续费相关的信息,请参见如何续费包年包月实例。
RHEL 7进入ELS后,还会继续收取RHEL镜像的License费用吗?
RHEL 7进入ELS阶段之后,RHEL 7实例仍需要获得RHEL的许可授权,并支付RHEL订阅费用。用户可以获得如下内容:
说明 关于RHEL镜像的计费信息,请参见镜像计费。
更多关于RHEL 7进入ELS阶段的问题可参考红帽官方FAQ文档。
RHEL 7升级为RHEL 8,如何操作?
说明 如果您是RHEL 7.9系统且当前的业务必须保留在RHEL 7.9版本,建议您先购买阿里云Red Hat Enterprise Linux Extended Life Cycle Support (ELS) Add-On订阅,以持续获得安全更新和错误修复。更多信息,请参见购买延长生命周期支持(ELS)订阅。
在升级之前,建议您提前了解升级风险并创建快照备份数据,以防升级出现问题时可以快速恢复。
使用root用户远程连接RHEL系统的ECS实例。
具体操作,请参见使用Workbench终端连接登录Linux实例(SSH)。
重要 升级操作涉及对系统配置文件、库文件等修改,需要root权限进行操作,以确保升级过程顺利完成。
运行以下命令,确认您的RHEL实例是否已使用阿里云RHEL订阅。
rpm -q client-rhel7
准备升级环境。
运行以下命令,将RHEL系统升级到最新版本,最新版本通常包含对已知漏洞、错误和安全问题的修复,并重启系统使其生效。
yum -y update
reboot
运行以下命令,在RHEL系统上安装Leapp升级工具。
yum -y install leapp leapp-rhui-alibaba --enablerepo="*"
运行以下命令,确认Leapp是否安装成功。
leapp --version
如果有类似leapp version xxx
回显信息,表示Leapp安装成功。
预升级检查。
由于RHEL各系统差异较大,在升级前需要先通过Leapp工具对系统进行预升级检查。您可以查看Leapp工具的检查结果,并根据Leapp工具的建议进行修复,以满足升级需求。
运行以下命令,进行预升级检查。
预升级RHEL 8最新版本。
leapp preupgrade --no-rhsm
预升级至具体的目标版本,例如需要将RHEL 7升级至RHEL 8.8版本。
leapp preupgrade --no-rhsm --target 8.8
说明 您可以通过leapp preupgrade -h
命令查看当前系统支持升级的目标版本。
查看预升级检查结果。
Leapp工具预升级的检查日志保存在以下日志文件中:
/var/log/leapp/leapp-preupgrade.log:Leapp工具的日志
/var/log/leapp/leapp-report.txt:文本格式的预升级检查报告
/var/log/leapp/leapp-report.json :JSON格式的预升级检查报告
预升级检查失败后,会打印出一些具体检查失败项, 如下图所示。

(条件必选)处理预升级报错。
在日志文件/var/log/leapp/leapp-report.txt
中查看预升级是否有报错信息,请您根据Leapp工具的建议进行修复。以下按风险等级列出一些常见的预升级检查报错及处理办法。
high (inhibitor):高风险(阻止升级),这类问题会直接阻止升级过程,必须解决后才能继续升级。
案例1:系统中安装了多个内核版本
Risk Factor: high (inhibitor)
Title: Multiple devel kernels installed
Summary: DNF cannot produce a valid upgrade transaction when multiple kernel-devel packages are installed.
Remediation: [hint] Remove all but one kernel-devel packages before running Leapp again.
[command] yum -y remove kernel-devel-3.10.0-1160.11.1.el7
处理办法:系统中安装了多个内核版本,需要卸载旧的内核包。您可以根据leapp工具的提示命令卸载旧内核,例如本案例中的yum -y remove kernel-devel-3.10.0-1160.11.1.el7
。
案例2:系统中加载了RHEL 8不支持的内核模块
Risk Factor: high (inhibitor)
Title: Leapp detected loaded kernel drivers which have been removed in RHEL 8. Upgrade cannot proceed.
Summary: Support for the following RHEL 7 device drivers has been removed in RHEL 8:
- floppy
处理办法:部分模块(例如本案例的floppy模块)在RHEL 8上不支持,您可以运行以下命令进行卸载。
rmmod floppy
案例3:sshd_config配置异常
Risk Factor: high (inhibitor)
Title: Possible problems with remote login using root account
Summary: OpenSSH configuration file does not explicitly state the option PermitRootLogin in sshd_config file, which will default in RHEL8 to "prohibit-password".
Remediation: [hint] If you depend on remote root logins using passwords, consider setting up a different user for remote administration or adding "PermitRootLogin yes" to sshd_config.
If this change is ok for you, add explicit "PermitRootLogin prohibit-password" to your sshd_config to ignore this inhibitor
处理办法:
将配置文件/etc/ssh/sshd_config
中的PermitRootLogin
默认值配置为yes
。
说明 RHEL 7和RHEL 8的PermitRootLogin
的默认值有差异:
运行以下命令,重启sshd服务。
systemctl restart sshd
案例4:没有编辑确认应答文件
Risk Factor: high (inhibitor)
Title: Missing required answers in the answer file
Summary: One or more sections in answerfile are missing user choices: remove_pam_pkcs11_module_check.confirm
For more information consult https://leapp.readthedocs.io/en/latest/dialogs.html
Remediation: [hint] Please register user choices with leapp answer cli command or by manually editing the answerfile.
[command] leapp answer --section remove_pam_pkcs11_module_check.confirm=True
处理办法:本案例需要删除RHEL 8上不支持的pam模块,需要在应答文件/var/log/leapp/answerfile
中确认,您可以运行以下命令将confirm
设置为True
进行确认。
leapp answer --section remove_pam_pkcs11_module_check.confirm=True

high:高风险,这类问题不会直接阻止升级,但建议您在升级前或升级后解决这些问题,以避免升级后出现问题。
案例1:一些软件包无法安装
Risk Factor: high
Title: Packages from unknown repositories may not be installed
Summary: 3 packages may not be installed or upgraded due to repositories unknown to leapp:
- python3-pyxattr (repoid: rhel8-CRB)
- rpcgen (repoid: rhel8-CRB)
- ustr (repoid: rhel8-CRB)
Remediation: [hint] In case the listed repositories are mirrors of official repositories for RHEL (provided by Red Hat on CDN) and their repositories IDs has been customized, you can change the configuration to use the official IDs instead of fixing the problem. You can also review the projected DNF upgrade transaction result in the logs to see what is going to happen, as this does not necessarily mean that the listed packages will not be upgraded. You can also install any missing packages after the in-place upgrade manually.
处理办法:您可以在升级后手动安装丢失的软件包。
案例2:RHEL 7的一些软件包未升级
Risk Factor: high
Title: Some RHEL 7 packages have not been upgraded
Summary: Following RHEL 7 packages have not been upgraded:
leapp-upgrade-el7toel8-0.18.0-1.el7_9
kernel-3.10.0-1160.92.1.el7
leapp-rhui-alibaba-1.0.0-1.el7_9
Please remove these packages to keep your system in supported state.
处理办法:运行yum remove leapp-upgrade-el7toel8-0.18.0-1.el7_9 kernel-3.10.0-1160.92.1.el7 leapp-rhui-alibaba-1.0.0-1.el7_9
命令删除这些软件包。
medium:中风险,这类问题不会直接阻止升级,但建议您在升级前或升级后解决这些问题,以避免升级后出现潜在问题。
案例:PAM配置中的pam_pkcs11
模块将被移除
Title: Module pam_pkcs11 will be removed from PAM configuration
Summary: Module pam_pkcs11 was surpassed by SSSD and therefore it was removed from RHEL-8. Keeping it in PAM configuration may lock out the system thus it will be automatically removed from PAM configuration before upgrading to RHEL-8. Please switch to SSSD to recover the functionality of pam_pkcs11.
Remediation: [hint] Configure SSSD to replace pam_pkcs11
处理办法:为了确保升级后系统的认证功能正常运行,需要配置SSSD以替代 pam_pkcs11
的功能。
low:低风险,这类问题对升级过程或系统运行的影响较小,但建议您在升级前或升级后解决这些问题,以确保系统稳定运行。
案例:SELinux将被设置为permissive
模式
Risk Factor: low
Title: SElinux will be set to permissive mode
Summary: SElinux will be set to permissive mode. Current mode: enforcing. This action is required by the upgrade process to make sure the upgraded system can boot without beinig blocked by SElinux rules.
Remediation: [hint] Make sure there are no SElinux related warnings after the upgrade and enable SElinux manually afterwards. Notice: You can ignore the "/root/tmp_leapp_py3" SElinux warnings.
处理办法:升级后确保没有SELinux相关警告,然后将SELinux重新设置为 enforcing
模式,确保系统安全合规。
info:提示,这类问题通常是信息性提示,不会对升级过程或系统运行产生影响。您可以查看报告中的具体提示,了解升级过程中会发生的变化。
案例:/etc/dnf/vars/releasever 中的发行版本将被设置为当前目标版本
Risk Factor: info
Title: Release version in /etc/dnf/vars/releasever will be set to the current target release
Summary: On this system, Leapp detected "releasever" variable is either configured through DNF/YUM configuration file and/or the system is using RHUI infrastructure. In order to avoid issues with repofile URLs (when --release option is not provided) in cases where there is the previous major.minor version value in the configuration, release version will be set to the target release version (8.8). This will also ensure the system stays on the expected target version after the upgrade
处理办法:无需操作。
运行以下命令,进行升级。
如下图所示,表示升级成功。

运行以下命令,重启进入新系统。
reboot
验证升级结果。
(条件必选)运行以下命令,配置RHEL的源。
使用Leapp升级工具升级完成后,默认会修改/etc/dnf/vars/releasever
文件来限定系统升级到RHEL的具体版本。例如RHEL 8.8,repo源信息为https://xxxx/8.8/xxx
,后续您只能访问RHEL 8.8版本下的软件包。如果您希望能够自动访问RHEL 8最新版本的软件包,确保获取到最新的安全补丁和功能更新,可以通过删除releasever配置文件并重建元数据缓存来实现。
rm -f /etc/dnf/vars/releasever
dnf clean all && dnf makecache
执行完成后,RHEL 8的repo源信息会更新为https://xxxx/8/xxx
,系统将能够自动获取RHEL 8最新版本的安全补丁和功能更新,确保系统始终处于最新状态。
RHEL 8升级为RHEL 9,如何操作?
在升级之前,建议您提前了解升级风险并创建快照备份数据,以防升级出现问题时可以快速恢复。
使用root用户远程连接RHEL系统的ECS实例。
具体操作,请参见使用Workbench终端连接登录Linux实例(SSH)。
重要 升级操作涉及对系统配置文件、库文件等修改,需要root权限进行操作,以确保升级过程顺利完成。
运行以下命令,确认您的RHEL实例是否已使用阿里云RHEL订阅。
rpm -qa |grep aliyun
如果没有任何回显信息,表示您的系统未使用阿里云RHEL订阅,请先购买订阅,再执行升级操作。
如果有类似如下包含小版本rhel8.6
的回显信息,请先提交工单获取并安装最新的rpm包,再执行升级操作。

说明 在阿里云上运行RHEL时,系统需要通过阿里云的RHUI服务访问Red Hat的软件仓库。如果系统中安装的是小版本的包(例如 aliyun_rhel8.6-2.0-1.noarch
),系统可能无法正确连接到 RHUI,导致无法获取软件更新或无法升级到新版本。
如果有类似aliyun_rhui_rhel8-2.0-3.x86_64
订阅包回显信息,表示您的系统已使用阿里云RHEL订阅,可以继续执行本文升级操作。

准备升级环境。
运行以下命令,将RHEL系统升级到最新版本,最新版本通常包含对已知漏洞、错误和安全问题的修复,并重启系统使其生效。
yum -y update
reboot
运行以下命令,在RHEL系统上安装Leapp升级工具。
yum -y install leapp leapp-rhui-alibaba --enablerepo="*"
运行以下命令,确认Leapp是否安装成功。
leapp --version
如果有类似leapp version xxx
回显信息,表示Leapp安装成功。
预升级检查。
由于RHEL各系统差异较大,在升级前需要先通过Leapp工具对系统进行预升级检查。您可以查看Leapp工具的检查结果,并根据Leapp工具的建议进行修复,以满足升级需求。
运行以下命令,进行预升级检查。
预升级至RHEL 9最新版本。
leapp preupgrade --no-rhsm
预升级至具体的目标版本,例如需要将RHEL 8升级至RHEL 9.4版本。
leapp preupgrade --no-rhsm --target 9.4
说明 您可以通过leapp preupgrade -h
命令查看当前系统支持升级的目标版本。
查看预升级检查结果。
Leapp工具预升级的检查日志保存在以下日志文件中:
/var/log/leapp/leapp-preupgrade.log:Leapp工具的日志
/var/log/leapp/leapp-report.txt:文本格式的预升级检查报告
/var/log/leapp/leapp-report.json :JSON格式的预升级检查报告
预升级检查失败后,会打印出一些具体检查失败项, 如下图所示。

(条件必选)处理预升级报错。
在日志文件/var/log/leapp/leapp-report.txt
中查看预升级是否有报错信息,您可以根据Leapp工具的建议进行修复。以下按风险等级列出一些常见的预升级检查报错及处理办法。
high:高风险,这类问题不会直接阻止升级,但建议您在升级前或升级后解决这些问题,以避免升级后出现问题。
案例1:检测到自定义的Leapp actors或文件
Risk Factor: high
Title: Detected custom leapp actors or files.
Summary: We have detected installed custom actors or files on the system. These can be provided e.g. by third party vendors, Red Hat consultants, or can be created by users to customize the upgrade (e.g. to migrate custom applications). This is allowed and appreciated. However Red Hat is not responsible for any issues caused by these custom leapp actors. Note that upgrade tooling is under agile development which could require more frequent update of custom actors.
The list of custom leapp actors and files:
- /usr/share/leapp-repository/repositories/system_upgrade/common/files/rhui/alibaba/content.crt
- /usr/share/leapp-repository/repositories/system_upgrade/common/files/rhui/alibaba/key.pem
- /usr/share/leapp-repository/repositories/system_upgrade/common/files/rhui/alibaba/leapp-alibaba.repo
Related links:
- Customizing your Red Hat Enterprise Linux in-place upgrade: https://red.ht/customize-rhel-upgrade
Remediation: [hint] In case of any issues connected to custom or third party actors, contact vendor of such actors. Also we suggest to ensure the installed custom leapp actors are up to date, compatible with the installed packages.
处理办法:确保自定义actors是最新版本,并且与Leapp工具和系统环境兼容。升级完成后,检查系统是否正常运行,并及时解决因自定义actors引起的问题。如何管理自定义actors可参见Customizing your Red Hat Enterprise Linux in-place upgrade。
案例2: 在升级过程中自动更新GRUB2配置
Risk Factor: high
Title: GRUB2 core will be automatically updated during the upgrade
Summary: On legacy (BIOS) systems, GRUB2 core (located in the gap between the MBR and the first partition) cannot be updated during the rpm transaction and Leapp has to initiate the update running "grub2-install" after the transaction. No action is needed before the upgrade. After the upgrade, it is recommended to check the GRUB configuration.
处理办法:升级后检查GRUB配置,确保系统能够正常启动。
low:低风险,这类问题对升级过程或系统运行的影响较小,但建议您在升级前或升级后解决这些问题,以确保系统稳定运行。
案例:SELinux将被设置为permissive
模式
Risk Factor: low
Title: SElinux will be set to permissive mode
Summary: SElinux will be set to permissive mode. Current mode: enforcing. This action is required by the upgrade process to make sure the upgraded system can boot without beinig blocked by SElinux rules.
Remediation: [hint] Make sure there are no SElinux related warnings after the upgrade and enable SElinux manually afterwards. Notice: You can ignore the "/root/tmp_leapp_py3" SElinux warnings.
处理办法:升级后确保没有SELinux相关警告,然后将SELinux重新设置为 enforcing
模式,确保系统安全合规。
info:提示,这类问题通常是信息性提示,不会对升级过程或系统运行产生影响。您可以查看报告中的具体提示,了解升级过程中会发生的变化。
案例:排除部分目标系统仓库
Risk Factor: info
Title: Excluded target system repositories
Summary: The following repositories are not supported by Red Hat and are excluded from the list of repositories used during the upgrade.
- rhui-codeready-builder-for-rhel-9-aarch64-rhui-rpms
- codeready-builder-for-rhel-9-aarch64-rpms
- codeready-builder-for-rhel-9-s390x-rpms
- codeready-builder-beta-for-rhel-9-ppc64le-rpms
- codeready-builder-for-rhel-9-x86_64-rpms
Remediation: [hint] If some of excluded repositories are still required to be used during the upgrade, execute leapp with the --enablerepo option with the repoid of the repository required to be enabled as an argument (the option can be used multiple times).
处理办法:如果某些被排除的仓库在升级过程中仍然需要启用,可以使用 --enablerepo
选项启用它们。
运行以下命令,进行升级。
如下图所示,表示升级成功。

运行以下命令,重启进入新系统。
reboot
验证升级结果。
(条件必选)运行以下命令,配置RHEL的源。
使用Leapp升级工具升级完成后,默认会修改/etc/dnf/vars/releasever
文件来限定系统升级到RHEL的具体版本。例如RHEL 9.4,repo源信息为https://xxxx/9.4/xxx
,后续您只能访问RHEL 9.4版本下的软件包。如果您希望能够自动访问RHEL 9最新版本的软件包,确保获取到最新的安全补丁和功能更新,可以通过删除releasever配置文件并重建元数据缓存来实现。
rm -f /etc/dnf/vars/releasever
dnf clean all && dnf makecache
执行完成后,RHEL 9的repo源信息会更新为https://xxxx/9/xxx
,系统将能够自动获取RHEL 9最新版本的安全补丁和功能更新,确保系统始终处于最新状态。
相关文档
操作系统的生命周期和各个阶段的特点,以及应对停服或者延长支持阶段的常规方案,请参见操作系统生命周期概述。