之前写过一篇 Centos迁移到AnolisOS 的教程,今天我们来讲讲从 Centos7 迁移到 RHEL 8 衍生的几个发行版。
本指南包含有关如何将 CentOS 7 升级到 RHEL8 的衍生发行版(例如 AlmaLinux、EuroLinux、CentOS Stream、Oracle Linux 和 Rocky Linux)的步骤。
在开始迁移前请做好系统快照备份,如果是生产环境尽量先在虚拟环境中进行迁移和验证。
Table of Contents
版本查询
首先需要确定您的系统版本为 CentOS 7.x 才可以使用本指南。
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
更新系统
完成升级需要更新到最新版的Centos7系统,因此首先需要对 CentOS7系统进行更新,然后重启。
yum update -y
reboot
安装Leapp
elevate-release
项目使用 repo 和 GPG 密钥安装包。
yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm
选择迁移系统版本
为您的系统选择相应的REHL8发行版进行迁移升级,当前支持以下选项:
# Alma Linux
leapp-data-almalinux
# Centos Stream
leapp-data-centos
# Euro Linux
leapp-data-eurolinux
# Oracle Linux
leapp-data-oraclelinux
# Rocky Linux
leapp-data-rocky
迁移检查
本实例选择 Rocky Linux
作为迁移版本
sudo yum install -y leapp-upgrade leapp-data-Rocky
开始升级前检查,并且安装所需要的依赖.
验证报告
sudo leapp preupgrade
报告文件会存放在 /var/log/leapp/
目录中
cd /var/log/leapp
ls
answerfile answerfile.userchoices archive leapp-preupgrade.log leapp-report.json leapp-report.txt
问题修复
=========================================================
UPGRADE INHIBITED
=========================================================
Upgrade has been inhibited due to the following problems:
1. Inhibitor: Missing required answers in the answer file
Consult the pre-upgrade report for details and possible remediation.
=========================================================
UPGRADE INHIBITED
=========================================================
Debug output written to /var/log/leapp/leapp-upgrade.log
=========================================================
REPORT
=========================================================
A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt
=========================================================
END OF REPORT
=========================================================
Answerfile has been generated at /var/log/leapp/answerfile
出现以上错误需要执行下列命令进行修复
sudo rmmod pata_acpi
echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config
sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True
开始迁移
一切问题解决后准备就绪,执行下列命令开始升级迁移
leapp upgrade
重启系统
安装需要耐心等等,速度取决于您的网速,安装完成所有的包后出现以下提示重启系统。
A reboot is required to continue. Please reboot your system.
Debug output written to /var/log/leapp/leapp-upgrade.log
=========================================================
REPORT
=========================================================
A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt
=========================================================
END OF REPORT
=========================================================
Answerfile has been generated at /var/log/leapp/answerfile
- 重启系统继续升级
reboot
系统重启后进入引导,选择ELevate-Upgrade-Initramfs
项继续升级
迁移完成
升级迁移完成后我们可以正式登录系统了
查看系统版本
之前选择了迁移 Rocky Linux
我们可以使用以下命令查看版本信息。
cat /etc/rocky-release
cat /etc/os-release
至此迁移升级完成,我们检查一下是否还有残留的 Centos 的包
rpm -qa | grep centos
rpm -qf | grep el7
文章评论