https://onitroad.com 更多教程

将 CentOS 8 迁移到 Oracle Linux

Oracle Github Repository 提供了一个 Linux bash 脚本 centos2ol.sh。

此脚本支持从 CentOS Linux 6. 7 和 8 迁移,但不支持 CentOS Stream。

我们可以使用 wget 或者 curl 命令轻松地从 GitHub 下载 centos2ol.sh 脚本。

# wget https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh

将 centos2ol.sh 的执行权限授予所有人。

# chmod +x centos2ol.sh

根据 centos2ol.sh 文档,请检查并调整以下准备工作。

  • 由于 GRUB2 BootHole 漏洞,我们的 SecureBoot shim 只能引导由 Oracle 签名的内核,我们只能替换默认的 CentOS 内核。虽然如果 SecureBoot 当前被禁用,这可能不会产生影响,但在以后启用它可能会导致系统无法启动。出于这个原因,我们强烈建议删除所有非标准内核,例如:安装的任何内核都不是由基础或者更新存储库提供的。这包括 centosplus 内核。
  • 确保 CentOS yum 或者 dnf 配置正常工作,例如:没有陈旧的存储库。
  • 禁用所有非 CentOS 存储库。我们可以在切换后重新启用 repos。
  • 确保 /var/cache 中至少有 5GB 的可用空间。
  • 应该禁用所有自动更新,例如通过 yum-cron。

准备就绪后,执行 centos2ol.sh 脚本以启动 Linux 操作系统的迁移过程。

# ./centos2ol.sh
Checking for required packages...
Checking your distribution...
package epel-release is not installed
Checking for yum lock...
Checking for required python packages...
Identifying dnf modules that are enabled
Finding your repository directory...
Learning which repositories are enabled...
Repositories enabled before update include:
appstream
baseos
extras
Looking for yumdownloader...
Backing up and removing old repository files...
Removing CentOS-specific yum configuration from /etc/yum.conf
Downloading Oracle Linux release package...

centos2ol.sh 脚本列出了已安装的软件包,然后将 CentOS 标准 yum 存储库替换为 Oracle Linux 的存储库。

在迁移过程中, Linux 操作系统软件包已被相应的 Oracle Linux 支持的软件包替换。

centos2ol.sh 脚本已经完成了它的工作。
重新启动机器以使用新的 Linux 内核启动操作系统。

# reboot

在系统启动期间,GRUB 菜单现在显示 Oracle Linux Server 的两个新条目。
一个用于标准 Linux 内核,而另一个用于 Unbreakable Enterprise Kernel (UEK)。

使用 UEK 启动 Linux 服务器。

成功启动后,我们将到达基于 Linux 命令行 (CLI) 的登录提示。

以 root 用户身份登录。

如何将 CentOS 8 操作系统迁移到 Oracle Linux

Oracle Linux 是由 Oracle 打包并免费分发的 Linux 发行版,自 2006 年末以来部分在 GNU 通用公共许可证下可用。

Oracle Linux 是 CentOS 8 的另一种替代方案。

检查当前的 Linux 操作系统:

执行以下命令来检查 Linux 操作系统的版本。

# cat /etc/os-release
NAME="CentOS Linux"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
# cat /etc/centos-release
CentOS Linux release 8.3.2011

检查当前 Linux 内核的版本。

# uname -r
4.18.0-240.1.1.el8_3.x86_64

检查新的 Linux 操作系统:

通过执行以下命令检查当前操作系统版本。

# cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="8.4"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.4"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:4:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.4
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.4
# cat /etc/oracle-release
Oracle Linux Server release 8.4

还要检查新 Linux 内核的版本。

# uname -r
5.4.17-2102.202.5.el8uek.x86_64
日期:2020-09-17 00:12:35 来源:oir作者:oir