CentOS 7 生命周期在2024年6月30日结束,官方不再为 CentOS7 提供任何的技术支持和软件更新服务。

常见 RHEL 系列的操作系统有:

  • Red Hat Enterprise Linux(RHEL)
  • CentOS
  • CentOS Stream
  • Rocky Linux
  • AlmaLinux

几者的关系:

  • rpm 包通用。
  • 命令通用。
  • CentOS 是 CentOS 社区重新编译 Red Hat 源代码生成的免费版本。
  • CentOS Stream 是 CentOS 滚动升级的版本,由 CentOS 官方提供。
  • Rocky Linux 和 AlmaLinux 都是基于 RHEL 源代码和二进制文件的克隆版本。

AlmaLinux 官网有一张对比表:

Benchmarking against RHELAlmaLinuxOracle LinuxRocky LinuxCentOS StreamCentOS Linux
Production VersionSince March 2021Since 2006Since June 2021Since 2019Since 2004
RHEL compatibilityBinary CompatibleABI Compatible?Binary compatibleCompatible within the limits of the ACGBinary Compatible
Regular updates delayAbout 1 business dayAbout 1 business dayAbout 1 business dayUpstream of RHELAbout 1 business day
Last minor version release delay1 day7 days5 daysN/AN/A
ErrataYesYesYesNoNo
Lifecycle10 Years10 Years10 Years5-6 YearsEOL on 2021-12-31
Commercial support3rd partyOracle, 3rd parties3rd Party3rd party3rd party
Livepatching serviceKernelCareOracle Ksplice, KernelCare AvailableKernelCare AvailableNot availableKernelCare, Kpatch
FIPS complianceYesYesPlannedNot availableNot available
ARM supportYesYesYesYesYes
IBM PowerPC supportYesNoYes (versions ≥ 9)YesYes
IBM Z (s390x) supportYesNoYes (versions ≥ 9)NoNo
SecureBootYesYesYesYesYes
Owned By:AlmaLinux OS FoundationOracle IncRocky Enterprise Software FoundationRed Hat IncRed Hat Inc
Owned by org type:Non-Profit 501(c)6For Profit C-CorpFor Profit, Public Benefit CorpFor Profit C-CorpFor Profit C-Corp

AlmaLinux和Rocky Linux都是作为CentOS的替代品推出的开源企业级Linux发行版,旨在提供与Red Hat Enterprise Linux (RHEL) 高度兼容的稳定环境,特别是在CentOS宣布改变其发布策略之后,这两个项目成为了焦点。以下是它们之间的一些关键区别和特点:

  1. 社区与支持背景:

    • AlmaLinux: 虽然微软通过其“Azure投资计划”对 AlmaLinux 的开发有所贡献,但项目本身是由非营利组织 AlmaLinux Foundation 管理的,旨在保持独立性和社区驱动。它强调快速响应红帽企业 Linux(RHEL)的更新,并迅速提供相应的稳定版本。
    • Rocky Linux: 由 CentOS 的联合创始人 Gregory Kurtzer 发起,Rocky Linux 得到了谷歌等公司的支持。项目注重稳定性、安全性和长期支持,旨在成为 CentOS 的直接继承者,提供一个可靠的企业级平台。
  2. 维护和更新策略:

    • 两者都承诺提供与 RHEL 高度兼容的体验,包括软件包、系统管理工具和整体生态系统。
    • 它们都遵循长期支持模型,确保用户可以获得定期的安全更新和维护。
  3. 生态系统与兼容性:

    • 由于两者都是基于 RHEL 源码重新编译,因此在软件包兼容性方面几乎一致,都能无缝替代 CentOS 使用。
    • 它们都有活跃的社区支持,提供文档、论坛和用户交流平台。
  4. 选择考量:

    • 对于选择哪个发行版,最终决策可能取决于个人或组织的偏好,包括社区参与度、长期支持的信心、特定功能或集成需求,以及对项目背后支持者的信任度。
  5. 最新动态:

    • 截至最近的资料(2024年5月9日),AlmaLinux 最新版本是 9.4,Rocky Linux 最新版本是9.3。可见 AlmaLinux 的更新是更紧跟 RHEL 的步伐的。

AlmaLinux 和 Rocky Linux 都是可靠的选择,适合那些寻找 CentOS 替代方案的用户。在选择时,考虑项目的社区活力、长期支持计划、以及你对它们各自背后支持者的信心可能是重要的因素。

升级路径

不支持从7直接升级到9,需要先升级到8,再升级到9

CentOS 7 --> Rocky Linux 8.9 --> Rocky Linux 9.3

注意事项

  • Rocky Linux 9 不再支持 network.service 管理网络接口,需要使用 NetworkManager,并且保证 NetworkManager 服务开机自启动,否则升级后重启连不上服务器
  • 原地升级有风险,请备份好数据,做好快照
  • 重装系统可能是更好的选择,如果非得要原地升级,请在测试环境做好充足的验证

7 升 8

安装 epel-release

yum install epel-release

更新系统

yum update -y

安装依赖

yum -y install rpmconf dnf
# 执行rpmconf ,如果出现一些提示,请输入Y和回车继续
rpmconf -a

# 移除yum和yum-metadata-parser
dnf -y remove yum yum-metadata-parser

安装 Rocky Linux 8.9 软件源

# 删除CentOS7的源
rpm -e --nodeps `rpm -qa|grep centos-`

# 安装RockyLinux8.9的源
rpm -ivh --nodeps --force https://mirrors.aliyun.com/rockylinux/8/BaseOS/x86_64/os/Packages/r/rocky-release-8.9-1.9.el8.noarch.rpm
rpm -ivh --nodeps --force https://mirrors.aliyun.com/rockylinux/8/BaseOS/x86_64/os/Packages/r/rocky-repos-8.9-1.9.el8.noarch.rpm
rpm -ivh --nodeps --force https://mirrors.aliyun.com/rockylinux/8/BaseOS/x86_64/os/Packages/r/rocky-gpg-keys-8.9-1.9.el8.noarch.rpm

# 升级epel源
dnf -y upgrade https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
dnf clean all

删除 kernel

rpm -e --nodeps `rpm -qa|grep kernel`

执行升级

dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync

报错

错误:事务检查与依赖解决错误:
(NetworkManager >= 1.20 or dhclient) 被 dracut-network-049-228.git20230802.el8.x86_64 需要
rpmlib(RichDependencies) <= 4.12.0-1 被 dracut-network-049-228.git20230802.el8.x86_64 需要

解决

dnf remove dracut-network

再次尝试升级,报错

错误:事务检查错误:
  file /usr/lib64/.libcrypto.so.1.1.1k.hmac from install of openssl-libs-1:1.1.1k-12.el8_9.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-7.el7.x86_64
  file /usr/lib64/.libssl.so.1.1.1k.hmac from install of openssl-libs-1:1.1.1k-12.el8_9.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-7.el7.x86_64
  file /usr/lib64/engines-1.1/afalg.so from install of openssl-libs-1:1.1.1k-12.el8_9.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-7.el7.x86_64
  file /usr/lib64/engines-1.1/capi.so from install of openssl-libs-1:1.1.1k-12.el8_9.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-7.el7.x86_64
  file /usr/lib64/engines-1.1/padlock.so from install of openssl-libs-1:1.1.1k-12.el8_9.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-7.el7.x86_64
  file /usr/lib64/libcrypto.so.1.1.1k from install of openssl-libs-1:1.1.1k-12.el8_9.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-7.el7.x86_64
  file /usr/lib64/libssl.so.1.1.1k from install of openssl-libs-1:1.1.1k-12.el8_9.x86_64 conflicts with file from package openssl11-libs-1:1.1.1k-7.el7.x86_64
  file /usr/sbin/pidof from install of procps-ng-3.3.15-14.el8.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
  file /usr/bin/last from install of util-linux-2.32.1-44.el8_9.1.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
  file /usr/bin/mesg from install of util-linux-2.32.1-44.el8_9.1.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
  file /usr/bin/wall from install of util-linux-2.32.1-44.el8_9.1.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
  file /usr/share/man/man1/last.1.gz from install of util-linux-2.32.1-44.el8_9.1.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
  file /usr/share/man/man1/mesg.1.gz from install of util-linux-2.32.1-44.el8_9.1.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64
  file /usr/share/man/man1/wall.1.gz from install of util-linux-2.32.1-44.el8_9.1.x86_64 conflicts with file from package sysvinit-tools-2.88-14.dsf.el7.x86_64

解决

dnf remove sysvinit-tools openssl11-libs

再次尝试升级

dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync

如果还有依赖报错,根据提示卸载相关软件包即可。(如果卸载的软件是你需要用到的,记下删除的软件包名称,升级完成后再装回去就行)

安装内核

dnf install kernel

安装最小化环境

# 这一步选择性执行,执行这一步能解决安装yum报错。
rm -rf /etc/yum

# 安装最小化环境
dnf -y groupinstall "Minimal Install"

修复配置冲突

dnf install rpmconf

#执行rpmconf,如果出现一些提示,请输入Y和回车继续
rpmconf -a

修复引导

grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install /dev/sda

卸载el7遗留软件包

rpm -qa | grep '\.el7\.' # 查看包
rpm -qa | grep '\.el7\.' | xargs xargs rpm -e # 卸载

重启

reboot

8 升 9

安装 Rocky Linux 9 软件源

rpm -Uvh --nodeps https://mirrors.aliyun.com/rockylinux/9/BaseOS/x86_64/os/Packages/r/rocky-gpg-keys-9.3-1.3.el9.noarch.rpm
rpm -Uvh --nodeps https://mirrors.aliyun.com/rockylinux/9/BaseOS/x86_64/os/Packages/r/rocky-release-9.3-1.3.el9.noarch.rpm
rpm -Uvh --nodeps https://mirrors.aliyun.com/rockylinux/9/BaseOS/x86_64/os/Packages/r/rocky-repos-9.3-1.3.el9.noarch.rpm

# 升级epel源
dnf -y upgrade https://mirrors.aliyun.com/epel/epel-release-latest-9.noarch.rpm

# 执行成功,但是有报错,需要解决下报错
模块依赖问题:

 问题 1: 冲突的请求
  - nothing provides module(platform:el8) needed by module mariadb:10.3:8080020230920001707:fd72936b.x86_64 from @modulefailsafe
 问题 2: 冲突的请求
  - nothing provides module(platform:el8) needed by module nginx:1.14:8040020210610090123:9f9e2e7e.x86_64 from @modulefailsafe
 问题 3: 冲突的请求
  - nothing provides module(platform:el8) needed by module perl-IO-Socket-SSL:2.066:8090020231016070024:88fd4976.x86_64 from @modulefailsafe
  - nothing provides module(perl:5.26) needed by module perl-IO-Socket-SSL:2.066:8090020231016070024:88fd4976.x86_64 from @modulefailsafe
 问题 4: 冲突的请求
  - nothing provides module(platform:el8) needed by module perl-libwww-perl:6.34:8090020231016070052:8af8375c.x86_64 from @modulefailsafe
  - nothing provides module(perl:5.26) needed by module perl-libwww-perl:6.34:8090020231016070052:8af8375c.x86_64 from @modulefailsafe
 问题 5: 冲突的请求
  - nothing provides module(platform:el8) needed by module python27:2.7:8090020231117235334:449e760b.x86_64 from @modulefailsafe
 问题 6: 冲突的请求
  - nothing provides module(platform:el8) needed by module python36:3.6:8090020231214163110:ed68999d.x86_64 from @modulefailsafe
  
# 禁用这些报错的依赖
dnf module disable mariadb:10.3 nginx:1.14 perl-IO-Socket-SSL:2.066 perl-libwww-perl:6.34 python27:2.7 python36:3.6

执行升级

dnf -y --releasever=9 --allowerasing --setopt=deltarpm=false distro-sync

重建数据库,解决安装软件报错

rpm --rebuilddb

安装最小化环境

dnf group install minimal-environment -y

解决配置冲突

# 执行rpmconf ,如果出现一些提示,请输入Y和回车继续
rpmconf -a

修复引导

grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install /dev/sda

允许root登录

# rocky linux 9 默认禁止root用户远程登录
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config

卸载el8遗留软件包

rpm -qa | grep '\.el8\.' # 查看包
rpm -qa | grep '\.el8\.' | xargs xargs rpm -e # 卸载

# 如果报依赖错误,可以先卸载依赖包,卸载el8的包后再安装回来
# 如:报错ebtables被firewalld依赖,那么先卸载firewalld,等卸载el8所有的包之后,再把firewalld安装回来
# error: Failed dependencies:
#    ebtables is needed by (installed) firewalld-1.2.5-2.el9_3.noarch

重启

reboot

# 可能会报错
Failed to set wall message, ignoring: Failed to activate service 'org.freedesktop.login1': timed out (service_start_timeout=25000ms)
Call to Reboot failed: 连接超时

# 可忽略,实际上是重启成功了

标签: none

添加新评论