暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

【Rocky9】Rocky Linux 9.2 升级 9.3,及新特性实践

原创 严少安 2023-11-21
4446

rockbg.png

发版计划

前面介绍了如何安装和升级 Rocky Linux 9.2 操作系统,按照 RHEL 的发版计划,RHEL 9.3 已于 11 月 7 日发版,而 Rocky Linux 作为 RHEL 的下游,也于 11 月 20 日发布更新。[1]

先来回顾一下 Red Hat Enterprise Linux Version 9 的生命周期。

依据官网说明,RHEL 9 每六个月发版一次,9.3 于 23 年 11 月发版,9.4 将在 24 年 2 月发布。

已发布的版本信息如下:

发布版本 GA 日期 内核版本
RHEL 9.3 2023-11-07 5.14.0-362.8.1.el9_3
RHEL 9.2 2023-05-10 5.14.0-284.11.1.el9_2
RHEL 9.1 2022-11-15 5.14.0-162.6.1.el9_1
RHEL 9.0 2022-05-17 5.14.0-70.13.1.el9_0

rhel9lifecycle.png

升级到 Rocky 9.3

这里使用 dnf 在线升级,如果是内网用户,建议先查验 yum 源是否已更新。如果没有中央 yum 源,可以下载最新的 Rocky Linux 9.3 镜像,手动挂载,并配置本地 yum 源,然后再进行升级。

  1. 检查当前的 Release 版本和 Kernel 版本。
cat /etc/redhat-release uname -a

输出:

[shawnyan@rocky9 ~]$ cat /etc/redhat-release Rocky Linux release 9.2 (Blue Onyx) [shawnyan@rocky9 ~]$ uname -a Linux rocky9.shawnyan.cn 5.14.0-284.30.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Sep 16 09:55:41 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux [shawnyan@rocky9 ~]$
  1. 在线升级。
dnf -y upgrade

输出日志:

[shawnyan@rocky9 ~]$ sudo dnf -y upgrade --allowerasing
Last metadata expiration check: 0:00:19 ago on Tue 21 Nov 2023 01:33:19 PM UTC.
Dependencies resolved.                                              
==============================================================================================================================================
 Package                                       Architecture          Version                     Repository                              Size
==============================================================================================================================================
Installing:                                                                                                   
 kernel                                        x86_64                5.14.0-362.8.1.el9_3        baseos                                 5.1 M
Upgrading:                                                                                                    
 NetworkManager                                x86_64                1:1.44.0-3.el9              baseos                                 2.2 M
 NetworkManager-adsl                           x86_64                1:1.44.0-3.el9              baseos                                  36 k
...                                                                                                           
 gcc                                           x86_64                11.4.1-2.1.el9              appstream                               32 M
 gcc-c++                                       x86_64                11.4.1-2.1.el9              appstream                               13 M
 gcc-plugin-annobin                            x86_64                11.4.1-2.1.el9              appstream                               48 k
 gcc-toolset-12-binutils                       x86_64                2.38-19.el9                 appstream                              5.4 M
 gcc-toolset-12-binutils-gold                  x86_64                2.38-19.el9                 appstream                              771 k
 gdb                                           x86_64                10.2-11.el9                 appstream                              121 k
 gdb-headless                                  x86_64                10.2-11.el9                 appstream                              3.9 M
...                                                                                                           
 iproute                                       x86_64                6.2.0-5.el9                 baseos                                 786 k
 iproute-tc                                    x86_64                6.2.0-5.el9                 baseos                                 448 k
...                                                                                                           
 kernel-headers                                x86_64                5.14.0-362.8.1.el9_3        appstream                              6.5 M
 kernel-srpm-macros                            noarch                1.0-13.el9                  appstream                               15 k
 kernel-tools                                  x86_64                5.14.0-362.8.1.el9_3        baseos                                 5.3 M
 kernel-tools-libs                             x86_64                5.14.0-362.8.1.el9_3        baseos                                 5.1 M
...                                                                                                           
 rocky-backgrounds                             noarch                90.14-2.el9                 appstream                               61 M
 rocky-gpg-keys                                noarch                9.3-1.1.el9                 baseos                                  13 k
 rocky-logos                                   x86_64                90.14-2.el9                 appstream                              715 k
 rocky-release                                 noarch                9.3-1.1.el9                 baseos                                  23 k
 rocky-repos                                   noarch                9.3-1.1.el9                 baseos                                  13 k
...                                                                                                           
Installing dependencies:                                                                                      
 debugedit                                     x86_64                5.0-4.el9                   appstream                               76 k
 kbd-legacy                                    noarch                2.4.0-9.el9                 baseos                                 502 k
 kernel-core                                   x86_64                5.14.0-362.8.1.el9_3        baseos                                  20 M
 kernel-modules                                x86_64                5.14.0-362.8.1.el9_3        baseos                                  37 M
 kernel-modules-core                           x86_64                5.14.0-362.8.1.el9_3        baseos                                  32 M
 libtraceevent                                 x86_64                1.5.3-3.el9                 baseos                                 213 k
 liburing                                      x86_64                2.3-2.el9                   appstream                               26 k
 libxcvt                                       x86_64                0.1.2-2.el9                 appstream                               13 k
Installing weak dependencies:                                                                                 
 kernel-devel                                  x86_64                5.14.0-362.8.1.el9_3        appstream                               20 M
Removing dependent packages:                                                                                  
 libstdc++-static                              x86_64                11.3.1-4.3.el9              @devel                                 6.5 M
 libtirpc-devel                                x86_64                1.3.3-1.el9                 @devel                                 251 k
                                                                                                              
Transaction Summary                                                                                           
==============================================================================================================================================
Install   10 Packages                                                                                         
Upgrade  459 Packages                                                                                         
Remove     2 Packages                                                                                         
                                                                                                              
Total download size: 1.1 G                                                                                    
...                                                                                                           
----------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                         2.5 MB/s | 1.1 GB     07:11
Running transaction check                                           
Transaction check succeeded.                                           
Running transaction test                                               
Transaction test succeeded.                                            
Running transaction                                                    
  Running scriptlet: selinux-policy-targeted-38.1.23-1.el9.noarch                                                                         1/1
  Running scriptlet: kmod-kvdo-8.2.1.6-98.el9.x86_64                                                                                      1/1
  Preparing        :                                                                                                                      1/1
  Upgrading        : libgcc-11.4.1-2.1.el9.x86_64                                                                                       1/930
  Running scriptlet: libgcc-11.4.1-2.1.el9.x86_64                                                                                       1/930
...                                                                    

20231121_140107.png

受系统资源和网速的影响,整个升级过程约半小时。

  1. 升级后查验。

升级完成后,再次查看版本信息。

cat /etc/redhat-release uname -a

输出:

[shawnyan@rocky9 ~]$ cat /etc/redhat-release Rocky Linux release 9.3 (Blue Onyx) [shawnyan@rocky9 ~]$ uname -a Linux rocky9.shawnyan.cn 5.14.0-362.8.1.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Nov 8 17:36:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux [shawnyan@rocky9 ~]$

主要更新

Kernel 内核版本

上文的表格中已经标记了 RHEL 的内核版本,Rocky Linux 与 RHEL 保持一致,在 Rocky 9.2 中是 5.14.0-284.11.1.el9_2

我本地环境升级过,所以小版本号略高一点:

[shawnyan@rocky9 ~]$ uname -r 5.14.0-284.30.1.el9_2.x86_64

而在 Rocky 9.3 中,默认的内核版本升级为 5.14.0-362.8.1.el9_3

[shawnyan@rocky9 ~]$ uname -r 5.14.0-362.8.1.el9_3.x86_64

编译工具 GCC

GCC (GNU Compiler Collection) 提供了使用C、c++ 和 Fortran 编程语言开发应用程序的工具。

在 Rocky 9.2 中,GCC 工具的版本默认为 11.3.1。同时,可以通过安装 gcc-toolset 将其版本升级到 12。

[shawnyan@rocky9 ~]$ gcc --version gcc (GCC) 11.3.1 20221121 (Red Hat 11.3.1-4) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [shawnyan@rocky9 ~]$ [shawnyan@rocky9 ~]$ rpm -qa | grep gcc-toolset gcc-toolset-12-runtime-12.0-6.el9.x86_64 gcc-toolset-12-annobin-docs-11.08-2.el9.noarch gcc-toolset-12-libstdc++-devel-12.2.1-7.4.el9.x86_64 gcc-toolset-12-binutils-gold-2.38-17.el9_2.1.x86_64 gcc-toolset-12-binutils-2.38-17.el9_2.1.x86_64 gcc-toolset-12-gcc-12.2.1-7.4.el9.x86_64 gcc-toolset-12-gcc-c++-12.2.1-7.4.el9.x86_64 gcc-toolset-12-annobin-plugin-gcc-11.08-2.el9.x86_64 gcc-toolset-12-annobin-annocheck-11.08-2.el9.x86_64 [shawnyan@rocky9 ~]$ [shawnyan@rocky9 ~]$ scl enable gcc-toolset-12 bash [shawnyan@rocky9 ~]$ gcc --version gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-7) Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

在 Rocky 9.3 中,GCC 版本升级到了 11.4.1。

[shawnyan@rocky9 ~]$ gcc --version gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2) Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [shawnyan@rocky9 ~]$ rpm -qa | grep gcc-toolset

同时,可以通过安装 gcc-toolset 将其版本升级到 13。

  • 安装 GCC Toolset 13
[shawnyan@rocky9 ~]$ sudo dnf install gcc-toolset-13 Last metadata expiration check: 0:02:04 ago on Tue 21 Nov 2023 02:06:55 PM UTC. Dependencies resolved. ========================================================================================================================= Package Architecture Version Repository Size ========================================================================================================================= Installing: gcc-toolset-13 x86_64 13.0-2.el9 appstream 9.9 k Installing dependencies: gcc-toolset-13-annobin-docs noarch 12.20-1.el9 appstream 95 k gcc-toolset-13-annobin-plugin-gcc x86_64 12.20-1.el9 appstream 960 k gcc-toolset-13-binutils x86_64 2.40-13.el9 appstream 5.6 M gcc-toolset-13-binutils-gold x86_64 2.40-13.el9 appstream 803 k gcc-toolset-13-dwz x86_64 0.14-0.el9 appstream 126 k gcc-toolset-13-gcc x86_64 13.1.1-4.2.el9 appstream 43 M gcc-toolset-13-gcc-c++ x86_64 13.1.1-4.2.el9 appstream 13 M gcc-toolset-13-gcc-gfortran x86_64 13.1.1-4.2.el9 appstream 14 M gcc-toolset-13-gdb x86_64 12.1-3.el9 appstream 4.3 M gcc-toolset-13-libquadmath-devel x86_64 13.1.1-4.2.el9 appstream 185 k gcc-toolset-13-libstdc++-devel x86_64 13.1.1-4.2.el9 appstream 3.3 M gcc-toolset-13-runtime x86_64 13.0-2.el9 appstream 27 k libgfortran x86_64 11.4.1-2.1.el9 baseos 807 k libquadmath x86_64 11.4.1-2.1.el9 baseos 197 k Transaction Summary ========================================================================================================================= Install 15 Packages Total download size: 87 M Installed size: 255 M ... Installed: gcc-toolset-13-13.0-2.el9.x86_64 gcc-toolset-13-annobin-docs-12.20-1.el9.noarch gcc-toolset-13-annobin-plugin-gcc-12.20-1.el9.x86_64 gcc-toolset-13-binutils-2.40-13.el9.x86_64 gcc-toolset-13-binutils-gold-2.40-13.el9.x86_64 gcc-toolset-13-dwz-0.14-0.el9.x86_64 gcc-toolset-13-gcc-13.1.1-4.2.el9.x86_64 gcc-toolset-13-gcc-c++-13.1.1-4.2.el9.x86_64 gcc-toolset-13-gcc-gfortran-13.1.1-4.2.el9.x86_64 gcc-toolset-13-gdb-12.1-3.el9.x86_64 gcc-toolset-13-libquadmath-devel-13.1.1-4.2.el9.x86_64 gcc-toolset-13-libstdc++-devel-13.1.1-4.2.el9.x86_64 gcc-toolset-13-runtime-13.0-2.el9.x86_64 libgfortran-11.4.1-2.1.el9.x86_64 libquadmath-11.4.1-2.1.el9.x86_64 Complete! Installed: gcc-toolset-13-13.0-2.el9.x86_64 gcc-toolset-13-annobin-docs-12.20-1.el9.noarch gcc-toolset-13-annobin-plugin-gcc-12.20-1.el9.x86_64 gcc-toolset-13-binutils-2.40-13.el9.x86_64 gcc-toolset-13-binutils-gold-2.40-13.el9.x86_64 gcc-toolset-13-dwz-0.14-0.el9.x86_64 gcc-toolset-13-gcc-13.1.1-4.2.el9.x86_64 gcc-toolset-13-gcc-c++-13.1.1-4.2.el9.x86_64 gcc-toolset-13-gcc-gfortran-13.1.1-4.2.el9.x86_64 gcc-toolset-13-gdb-12.1-3.el9.x86_64 gcc-toolset-13-libquadmath-devel-13.1.1-4.2.el9.x86_64 gcc-toolset-13-libstdc++-devel-13.1.1-4.2.el9.x86_64 gcc-toolset-13-runtime-13.0-2.el9.x86_64 libgfortran-11.4.1-2.1.el9.x86_64 libquadmath-11.4.1-2.1.el9.x86_64 Complete!
  • 查看 GCC Toolset 13 安装包
[shawnyan@rocky9 ~]$ rpm -qa | grep gcc-toolset-13 gcc-toolset-13-runtime-13.0-2.el9.x86_64 gcc-toolset-13-libstdc++-devel-13.1.1-4.2.el9.x86_64 gcc-toolset-13-annobin-docs-12.20-1.el9.noarch gcc-toolset-13-binutils-gold-2.40-13.el9.x86_64 gcc-toolset-13-binutils-2.40-13.el9.x86_64 gcc-toolset-13-gcc-13.1.1-4.2.el9.x86_64 gcc-toolset-13-libquadmath-devel-13.1.1-4.2.el9.x86_64 gcc-toolset-13-gcc-gfortran-13.1.1-4.2.el9.x86_64 gcc-toolset-13-gcc-c++-13.1.1-4.2.el9.x86_64 gcc-toolset-13-annobin-plugin-gcc-12.20-1.el9.x86_64 gcc-toolset-13-gdb-12.1-3.el9.x86_64 gcc-toolset-13-dwz-0.14-0.el9.x86_64 gcc-toolset-13-13.0-2.el9.x86_64 [shawnyan@rocky9 ~]$
  • 运行会话,查看 gcc 版本
[shawnyan@rocky9 ~]$ scl enable gcc-toolset-13 bash [shawnyan@rocky9 ~]$ gcc --version gcc (GCC) 13.1.1 20230614 (Red Hat 13.1.1-4) Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [shawnyan@rocky9 ~]$

Java 运行环境

在 Rocky 9.2 中,appstream 仓库中包含 OpenJDK 1.9.0/11/17 三个版本。

[shawnyan@rocky9 ~]$ cat /etc/redhat-release Rocky Linux release 9.2 (Blue Onyx) [shawnyan@rocky9 ~]$ yum list java-*-openjdk Last metadata expiration check: 4 days, 18:16:06 ago on Sat 11 Nov 2023 08:35:35 PM UTC. Available Packages java-1.8.0-openjdk.x86_64 1:1.8.0.392.b08-3.el9 appstream java-11-openjdk.x86_64 1:11.0.21.0.9-2.el9 appstream java-17-openjdk.x86_64 1:17.0.9.0.9-2.el9 appstream

而在 Rocky 9.3 中,appstream 仓库新增包含了 OpenJDK 21。

[shawnyan@rocky9 ~]$ cat /etc/redhat-release Rocky Linux release 9.3 (Blue Onyx) [shawnyan@rocky9 ~]$ yum list java-*-openjdk Rocky Linux 9 - AppStream 5.4 MB/s | 7.4 MB 00:01 Rocky Linux 9 - BaseOS 2.5 MB/s | 2.2 MB 00:00 Rocky Linux 9 - Extras 30 kB/s | 13 kB 00:00 Available Packages java-1.8.0-openjdk.x86_64 1:1.8.0.392.b08-3.el9 appstream java-11-openjdk.x86_64 1:11.0.21.0.9-2.el9 appstream java-17-openjdk.x86_64 1:17.0.9.0.9-2.el9 appstream java-21-openjdk.x86_64 1:21.0.1.0.12-3.el9 appstream [shawnyan@rocky9 ~]$

DBMS 数据库

在 Rocky 9.2 中,默认提供四种数据库: MariaDB 10.5, MySQL 8.0, PostgreSQL 13/15, Redis 6。

[shawnyan@rocky9 ~]$ cat /etc/redhat-release Rocky Linux release 9.2 (Blue Onyx) [shawnyan@rocky9 ~]$ yum list mariadb-server* Last metadata expiration check: 5 days, 12:24:51 ago on Sat 11 Nov 2023 08:35:35 PM UTC. Available Packages mariadb-server.x86_64 3:10.5.22-1.el9_2 appstream mariadb-server-galera.x86_64 3:10.5.22-1.el9_2 appstream mariadb-server-utils.x86_64 3:10.5.22-1.el9_2 appstream [shawnyan@rocky9 ~]$ yum list mysql-server* Last metadata expiration check: 5 days, 12:24:53 ago on Sat 11 Nov 2023 08:35:35 PM UTC. Available Packages mysql-server.x86_64 8.0.32-1.el9_2 appstream [shawnyan@rocky9 ~]$ yum list postgresql-server* Last metadata expiration check: 5 days, 12:24:58 ago on Sat 11 Nov 2023 08:35:35 PM UTC. Available Packages postgresql-server.x86_64 13.11-1.el9_2 appstream [shawnyan@rocky9 ~]$ dnf list redis Last metadata expiration check: 5 days, 13:58:28 ago on Sat 11 Nov 2023 08:35:35 PM UTC. Available Packages redis.x86_64 6.2.7-1.el9 appstream [shawnyan@rocky9 ~]$

升级到 Rocky 9.3 之后,由于时间关系,这四种准预装的数据库版本尚未更新。这里暂且留个 TODO,我们之后再看。

此外,从 RHEL 9.2 开始,引入了 postgresql:15 模块流,可以通过以下方式进行安装 PG15.

[shawnyan@rocky9 ~]$ sudo dnf module install postgresql:15/server Last metadata expiration check: 2:39:51 ago on Fri 17 Nov 2023 07:07:33 AM UTC. Dependencies resolved. ========================================================================================================================= Package Architecture Version Repository Size ========================================================================================================================= Installing group/module packages: postgresql-server x86_64 15.3-1.module+el9.2.0+14925+a515b28a appstream 6.1 M Installing dependencies: postgresql x86_64 15.3-1.module+el9.2.0+14925+a515b28a appstream 1.6 M postgresql-private-libs x86_64 15.3-1.module+el9.2.0+14925+a515b28a appstream 137 k Installing module profiles: postgresql/server Enabling module streams: postgresql 15 Transaction Summary ========================================================================================================================= Install 3 Packages Total download size: 7.8 M Installed size: 32 M

iproute

iproute 是高级IP路由和网络设备配置工具,包括常用的网络,如 ip, ss, tc 等。

在 Rocky 9.2 中,iproute 的版本为 6.1.0。

[shawnyan@rocky9 ~]$ cat /etc/redhat-release
Rocky Linux release 9.2 (Blue Onyx)
[shawnyan@rocky9 ~]$ rpm -qa | grep iproute
iproute-6.1.0-1.el9.x86_64
iproute-tc-6.1.0-1.el9.x86_64
[shawnyan@rocky9 ~]$

升级到 Rocky 9.3 后,iproute 的版本为 6.2.0。

[shawnyan@rocky9 ~]$ cat /etc/redhat-release Rocky Linux release 9.3 (Blue Onyx) [shawnyan@rocky9 ~]$ rpm -qa | grep iproute iproute-6.2.0-5.el9.x86_64 iproute-tc-6.2.0-5.el9.x86_64 [shawnyan@rocky9 ~]$

这里介绍一个新命令,ip stats,可以管理、显示接口状态信息,默认显示所有网络设备,包括 bridges 和 bonds,也可以通过 devgroup 过滤信息。

例如:

[shawnyan@rocky9 ~]$ ip stats show dev ens33
2: ens33: group offload subgroup hw_stats_info
    l3_stats off used off
2: ens33: group xstats_slave subgroup bond suite 802.3ad
2: ens33: group xstats_slave subgroup bridge suite mcast
2: ens33: group xstats_slave subgroup bridge suite stp
2: ens33: group xstats subgroup bond suite 802.3ad
2: ens33: group xstats subgroup bridge suite mcast
2: ens33: group xstats subgroup bridge suite stp
2: ens33: group afstats subgroup mpls
2: ens33: group offload subgroup l3_stats off used off
2: ens33: group offload subgroup cpu_hit

2: ens33: group link
    RX:  bytes packets errors dropped  missed   mcast
     137826417   94630      0       0       0       0
    TX:  bytes packets errors dropped carrier collsns
       2292768   36535      0       0       0       0
[shawnyan@rocky9 ~]$

总结

本文演示了如何将 Rocky Linux 9.2 升级到 9.3,并着重介绍了几点值得一看的新特性。

Rocky Linux 9.3 是 23 年发行的第二个大版本,相信已经有企业将 Rocky 9 用于生产环境。

关于 Rocky 9 的更多分享,还将继续。


  1. https://rockylinux.org/news/rocky-linux-9-3-ga-release/ ↩︎

最后修改时间:2023-11-21 15:30:11
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论