云网牛站
所在位置:首页 > Linux教程 > 从RHEL 6升级到RHEL 7的方法及从RHEL 7升级到RHEL 8的方法

从RHEL 6升级到RHEL 7的方法及从RHEL 7升级到RHEL 8的方法

2021-01-30 16:09:06作者:彭即元稿源:云网牛站

本文介绍从Red Hat Enterprise Linux 6(RHEL 6)升级到RHEL 8的方法:先从RHEL 6升级到RHEL 7,再升级到RHEL 8,即首先升级到RHEL 7,然后从RHEL 7升级到RHEL 8,不能一下子跨版本升级。如果您有这方面的升级需求,请按以下步骤操作。

 

前言

1、升级注意事项和限制

以下是系统从RHEL 6升级到RHEL 8所必须满足的一般标准:

服务器CPU体系结构应为Intel 64或IBMZ。

FIPS模式应被禁用。

系统不应包含LUKS加密的分区或卷。

系统应该可以访问具有RHEL 6、RHEL 7和RHEL 8内容的存储库。

对于运行Red Hat未提供的应用程序的用户,您必须确认软件包将与RHEL 8的特定目标版本兼容,还应确认软件包依赖性在您有权访问的存储库中可用。

2、将RHEL 6升级到RHEL 8服务器

这些是从RHEL 6到RHEL 8就地升级的事件序列:

通过更新到最新版本的RHEL 6来为RHEL 6系统做升级准备。

在RHEL 6系统上执行升级前评估,以确保顺利升级到RHEL 8。

启动从RHEL 6到RHEL 7的就地升级。

通过将RHEL 7系统更新到最新版本的RHEL 7,为RHEL 7系统升级做准备。

对RHEL 7进行升级前评估,并在升级之前解决所有问题。

启动从RHEL 7到RHEL 8的就地升级。

验证升级系统的状态。

 

步骤1:准备RHEL 6系统以升级到RHEL 7

确认RHEL 6系统的注册状态:

$ sudo subscription-manager status

如果没有注册并订阅:

sudo subscription-manager register --auto-attach

确认您已附加了Red Hat Enterprise Linux Server订阅:

$ sudo subscription-manager list --installed

确保您正在运行RHEL 6的最新版本,这可以通过更新系统来实现:

sudo yum -y update

参考:在Red Hat(RHEL)和CentOS系统上安装安全更新的四种方法

重启后再重启:

sudo reboot

确认您使用的是最新版本或RHEL 6:

$ cat /etc/redhat-release 

Red Hat Enterprise Linux Server release 6.10 (Santiago)

重新启动系统后,启用Extras存储库,其中包含preupgrade-assistant,preupgrade-assistant-ui,preupgrade-assistant-el6toel7,preupgrade-assistant-el6toel7-data和redhat-upgrade-tool软件包:

$ sudo subscription-manager repos --enable rhel-6-server-extras-rpms

Repository 'rhel-6-server-extras-rpms' is enabled for this system.

$ sudo subscription-manager repos --enable rhel-6-server-optional-rpms

Repository 'rhel-6-server-optional-rpms' is enabled for this system.

然后安装所需的软件包:

sudo yum -y install redhat-upgrade-tool preupgrade-assistant preupgrade-assistant-el6toel7 preupgrade-assistant-ui

 

步骤2:执行RHEL 6系统评估

接下来,我们评估系统是否存在升级到Red Hat Enterprise Linux 7时可能遇到的任何潜在问题,Preupgrade Assistant(preupg命令)用于此目的。

运行preupg命令评估您的RHEL 6系统:

sudo preupg

当询问您是否要继续回答y,如下:

The Preupgrade Assistant is a diagnostics tool

and does not perform the actual upgrade.

Do you want to continue? [Y/n]

y

执行的测试结果将打印到命令行标准输出,然后打印其结果:

Gathering logs used by the Preupgrade Assistant:

All installed packages: 01/10 ...finished (time 00:00s)

All changed files: 02/10 ...finished (time 00:47s)

Changed config files: 03/10 ...finished (time 00:00s)

All users: 04/10 ...finished (time 00:00s)

All groups: 05/10 ...finished (time 00:00s)

Service statuses: 06/10 ...finished (time 00:00s)

All installed files: 07/10 ...finished (time 00:02s)

All local files: 08/10 ...finished (time 00:03s)

All executable files: 09/10 ...finished (time 00:00s)

Red Hat signed packages: 10/10 ...finished (time 00:00s)

Assessment of the system, running checks / SCE scripts:

001/140 ...done    (Configuration files to be reviewed) (time: 00:02s)

002/140 ...done    (File lists for the manual migration) (time: 00:00s)

003/140 ...done    (Bacula Backup Software) (time: 00:00s)

004/140 ...done    (MySQL configuration) (time: 00:00s)

005/140 ...done    (MySQL data stack) (time: 00:00s)

006/140 ...done    (Changes related to moving from MySQL to MariaDB) (time: 00:00s)

007/140 ...done    (PostgreSQL) (time: 00:00s)

008/140 ...done    (GNOME desktop environment) (time: 00:00s)

009/140 ...done    (KDE desktop environment) (time: 00:00s)

010/140 ...done    (POWER6 processors) (time: 00:00s)

评估报告文件将存储在/root/preupgrade/result.html下:

Moving openssh-keycat   needs_inspection

Changed configuration files   needs_inspection

Changes in utilities   needs_inspection

Obsolete RPM packages   needs_inspection

httpd   needs_inspection

Binaries to be rebuilt   needs_inspection

Libraries with their soname bumped   needs_inspection

Removed .so libraries   needs_inspection

Ethernet interface naming   needs_inspection

Python packages   needs_inspection

Repositories for Kickstart   needs_inspection

Incorrect usage of reserved UIDs and GIDs   needs_inspection

Configuration files to be reviewed   needs_action

MySQL configuration   needs_action

Packages not signed by Red Hat   needs_action

Removed RPM packages   needs_action

"not-base" channels   needs_action

Removing sandbox from SELinux   needs_action

GRUB to GRUB 2 migration   needs_action

Enabled and disabled services in Red Hat Enterprise Linux 6   needs_action

The /etc/rc.local and /etc/rc.d/rc.local files   needs_action

The cgroups configuration compatibility   needs_action

GNOME desktop environment   fail

The tarball with results is stored in '/root/preupgrade-results/preupg_results-210129180616.tar.gz' .

The latest assessment is stored in the '/root/preupgrade' directory.

Summary information:

We have found some critical issues. In-place upgrade or migration is not advised.

Read the file /root/preupgrade/result.html for more details.

Please ensure you have backed up your system and/or data

before doing a system upgrade to prevent loss of data in

case the upgrade fails and full re-install of the system

from installation media is needed.

Upload results to UI by the command:

e.g. preupg -u http://example.com:8099/submit/ -r /root/preupgrade-results/preupg_results-210129180616.tar.gz .

可以从Web浏览器查看该报告:

sudo firefox file:///root/preupgrade/result.html

要查看发现的极端升级风险,请使用以下命令

sudo preupg --riskcheck --verbose

解决评估过程中升级前助手发现的所有问题,然后再继续下一步:

从RHEL 6升级到RHEL 7的方法及从RHEL 7升级到RHEL 8的方法

 

步骤3:从RHEL 6升级到RHEL 7

在使用Red Hat Upgrade Tool进行系统升级之前,请确保备份所有数据,以避免潜在的数据丢失。

登录到Red Hat Downloads门户并下载RHEL 7 DVD ISO,地址在https://access.redhat.com/downloads/。升级期间,我们将其用作安装媒体:

从RHEL 6升级到RHEL 7的方法及从RHEL 7升级到RHEL 8的方法

这是我文件的位置:

从RHEL 6升级到RHEL 7的方法及从RHEL 7升级到RHEL 8的方法

备份一些重要的配置文件:

sudo mkdir /root/backups

sudo cp /etc/{shadow,gshadow} /root/backups

sudo cp /etc/grub.conf /root/backups

运行redhat-upgrade-tool以下载升级到RHEL 7所需的软件包。

要使用ISO映像升级系统,请在--iso选项之后提供ISO映像的路径:

sudo redhat-upgrade-tool --iso ~/rhel-server-7.9-x86_64-dvd.iso

要完成安装,您需要重新引导系统:

sudo reboot

验证系统已升级到RHEL 7:

$ cat /etc/redhat-release

如果您的RHEL 6系统已正确注册并订阅了RHSM,则升级过程应已自动将其重新订阅RHEL 7:

$ sudo yum repolist

从GRUB旧版升级到GRUB 2:

sudo yum remove grub

sudo yum install grub2

检查您的启动设备:

$ sudo lsblk

生成grub2配置:

sudo grub2-install --grub-setup=/bin/true /dev/device

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

 

步骤4:从RHEL 7升级到RHEL 8

启用基本,附加和可选存储库:

sudo subscription-manager repos --enable rhel-7-server-rpms

sudo subscription-manager repos --enable rhel-7-server-extras-rpms

sudo subscription-manager repos --enable rhel-7-server-optional-rpms

设置Red Hat Subscription Manager以使用最新的RHEL 7内容:

sudo subscription-manager release --unset

清除包裹锁:

sudo yum versionlock clear

确保将系统区域设置设置为en_US.UTF-8:

$ cat /etc/locale.conf

将所有软件包更新为最新的RHEL 7版本:

sudo yum update

sudo reboot

安装Leapp实用程序:

sudo yum install leapp leapp-repository

下载数据文件,Leapp实用程序从RHEL 7到RHEL 8就地升级所需的数据,并将它们放在/etc/leapp/files/目录中。

执行升级前阶段:

sudo leapp preupgrade

手动编辑/var/log/leapp/answerfile文件,并通过删除#符号取消注释文件的确认行,并确认答案为True或False。在继续从RHEL 7到RHEL 8的就地升级之前,还要检查/var/log/leapp/leapp-report.txt文件中的报告并解决所有报告的问题。

开始升级过程:

sudo leapp upgrade

升级后重新引导系统:

sudo reboot

确认当前的操作系统版本是Red Hat Enterprise Linux 8:

$ cat /etc/redhat-release

验证产品列表和发行版本:

$ sudo subscription-manager list --installed

$ sudo subscription-manager release

取消设置Red Hat Subscription Manager以使用最新的RHEL内容:

sudo subscription-manager release --unset

更新到最新的RHEL版本:

sudo  yum update

重启系统:

sudo reboot

至此,升级完成。

 

结语

如果幸运的话,您应该可以从RHEL 6升级到可以正常运行的RHEL 8系统。不过我们强烈建议您重新安装RHEL 8并规划应用程序迁移,而不是就地两步升级过程,参考安装Red Hat Enterprise Linux 8(RHEL 8)系统的图解教程。因为许多事情可能出错,导致系统无法启动。另外,在执行本文中的操作时要小心。

 

相关主题

Red Hat/RHEL教程-Red Hat/RHEL系统技术专栏

精选文章
热门文章