如何从 CentOS 8 迁移到 AlmaLinux 实操教程

已经写过关于从 CentOS 8 迁移到 CentOS Stream的文章。今天,我想试试 AlmaLinux。因此,这篇快速文章将列出将现有 VM 或裸机服务器从 CentOS 8 转换为 AlmaLinux 8 的步骤。该服务器目前充当移动应用程序的 API,包括 PostgreSQL、Redis、Python+Django、Apache Web 服务器、SELinux 和 firewalld 。

警告!在开始升级和转换过程之前进行备份。我是一位经验丰富的 Linux 用户、开发人员和系统管理员。但是,备份是无可替代的。保留经过验证的备份。不要在没有备份的情况下继续进行。nixCraft 不对数据丢失负责。

支持的系统:

你需要工作的 CentOS 8 发行版。目前该脚本支持以下操作系统和控制面板:

  • CentOS 8
  • Oracle Linux 8
  • RHEL 8
  • Rocky Linux 8
  • Control panel such as DirectAdmin, cPanel, and Plesk

操作教程

1、以 root 用户身份登录,如是的忽略即可:

sudo -i

2、通过运行 dnf 命令/ yum 命令将挂起的更新应用到 CentOS 8 :

dnf update

3、安装新内核更新后重新启动 Linux机器:

reboot

4、重启后,您需要使用 wget 或 curl 命令下载 almalinux-deploy.sh 脚本,输入:

wget https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh
# read the script #
vim almalinux-deploy.sh

5、接下来使用 chmod 命令设置可执行权限,运行:

chmod -v +x almalinux-deploy.sh

6、最后,通过键入 almalinux-deploy.sh 将 CentOS 迁移到 AlmaLinux:

./almalinux-deploy.sh

7、截至 2022 年 04 月11 日,官方 CentOS 8 镜像列表处于脱机状态。为了成功执行dnf update -y,您需要更新您的 dnf 配置文件以指向有效的镜像。因此,如果您遇到任何错误,请-f按以下方式传递:

./almalinux-deploy.sh -f

8、升级和迁移将花费他们自己的美好时光。这完全取决于您的服务器硬件规格和 Internet 速度。因此,请等待并注意屏幕上的错误。最后,您应该会在屏幕上看到如下确认消息:

Complete!
Run dnf distro-sync -y                                                OK
Restoring of alternatives is done                                     OK
Generating grub configuration file ...
done
All Secure Boot related packages which were released by not AlmaLinux are reinstalledOK
 
Migration to AlmaLinux is completed

9、重启托管在 AWS 或 Linode 上的 Linux 机器:

root# shutdown -r now
Connection to 3.1x.2xx.2xx closed by remote host.

10、最后,验证AlmaLinux版本,运行:

cat /etc/redhat-release
## OR ##
cat /etc/os-release

11、此外,请确保所有服务(例如 PGSQL、Apache 和其他服务)都在使用 ps 命令或 ss 命令运行:

ss -tulpn | more
ss -tulpn | grep ":80"
# Verify logs using the tail command and dmesg command+egrep command #
tail -f /var/log/httpd/app_name_goes_here
dmesg | egrep -i 'error|critical|warn'