首页 > 热门 > 横图列表

Red Hat Enterprise Linux 9 新特性及技术展示

横图列表 会员昵称:印修 关注 投稿量: 粉丝量: 关注量:   2024-07-31 18:18:47A+A-

1 Red Hat Enterprise Linux 9 新特性及技术展示

1.1 国产操作系统的现状

国产信创操作系统包括:麒麟系,UOS系,中科系三大类别

麒麟系

2019年底中国电子宣布合并中标麒麟和银河麒麟,2023年中国电子与华为又决定合并鲲鹏生态和PKS生态,前者基于鲲鹏生态,后者是基于中国电子的飞腾生态,其实均是ARM架构的CPU,鲲鹏和飞腾都是信创事业中最底层CPU的ARM代表者,生态合并后后续鲲鹏生态软件可以在PKS生态(飞腾)大发异彩

目前麒麟软件服务器版V10基于OpenEuler,桌面版基于Debian

UOS系

UOS的前身是武汉深之度公司,2023年国庆查看UOS官网截图,最新版本为V20(1060)

Red Hat Enterprise Linux 9 新特性及技术展示(图1)

可以看出最新的V20版本,支持4种CPU架构(AMD64、ARM64、MIPS64、SW64),6大CPU平台(鲲鹏、龙芯、申威、海光、兆芯、飞腾)

申威服务器本身硬件的原因,对于UOS是否很好的运行在申威服务器,保留意见

其中X86架构和ARM架构,分别有基于龙蜥 OpenAnolis,以及基于欧拉 OpenEuler 的,分别用后缀a和e进行区分

中科系

中科系包括:中科方德、中科龙芯、中科红旗,其中由于龙芯CPU的占有率比较低,所以中科龙芯的操作系统市场占有率比较低,中科海光的海光服务器会大概率使用中科方德操作系统

所以可以看出目前国产操作系统底层基本都是基于欧拉和龙蜥开源操作系统了

龙蜥和欧拉分别背靠阿里巴巴和华为两家大靠山是国内软硬件技术实力最好的企业,就个人而言,阿里巴巴的研发和技术实力更胜一筹,特别是神龙4架构是飞天云操作系统新一代虚拟化技术,并首次搭载了全球唯一的大规模弹性RDMA加速网络,将云计算带进了5微秒时延时代

从官网也可以看出很多商业版本(包括统信、麒麟、中科方德)也都是基于龙蜥OS

Red Hat Enterprise Linux 9 新特性及技术展示(图2)

特别是当下AI算力需求下,龙蜥更是加大对算力进一步研发,对AI基础支持都有更好的提升

包括内置rpm格式的AI组件、主流的框架 tensorflow2、pytorch ,支持一键安装 nvidia GPU 驱动、CUDA 库等

龙蜥社区将基于 Anolis OS 23 构建 AI 容器镜像生态,提供主流的 AI 训练/推理镜像,并发布开箱即用的 modelscope / huggingface AI 大模型实践镜像

龙蜥是号称100%兼容Centos的,OpenEuler虽然没有官方宣传,但某些版本还都是bug级别兼容的,这也是很多论坛提及所谓龙蜥和欧拉是Centos的套壳

CentOS与RHEL是出自相同的源代码,CentOS是RHEL的下游分支,不管2021年12月31日,CentOSLinux8停止更新和维护,RHEL业界老大哥位置依然是无法撼动的

龙蜥还是欧拉,在对于包管理(DNF)、服务管理(systemd)等很多方面都是高度一致的(甚至100%),因此学习RHEL,包括红帽认证都是非常有必要的

Red Hat Enterprise Linux 9(RHEL 9)是红帽公司于2022年5月发布的最新正式版操作系统,除了内核升级到5.1.4以外,还着重加强了安全性,以及容器应用等各方面的增强,本文将对RHEL9新特性进行了技术展示

2 软件仓库

早在RHEL8中,除了单独的RPM软件包外,AppStream软件仓库还包含模块

模块(module)是一组代表组件且通常一起安装的RPM软件包

典型的模块包含

1、应用的软件包

2、应用特定依赖项库的软件包

3、应用文档的软件包

4、帮助程序实用程序的软件包

模块化能够解决一个软件仓库中并存多个不同版本的应用及其依赖软件,解决了管理多个软件仓库的复杂度

RHEL8发行版本中的模块(module)是有的,输入dnf module list显示如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
[root@RHEL8 ~]# dnf module list
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 1:36:59 ago on Thu 21 Sep 2023 04:43:21 PM CST.
AppStream
Name                 Stream          Profiles Summary                                                                                                                                                                  
389-ds               1.4                      389 Directory Server (base)                                                                                                                                              
ant                  1.10 [d]        common [ Java build tool                                                                                                                                                          
                                    d]      
container-tools      rhel8 [d]       common [ Most recent (rolling) versions of podman, buildah, skopeo, runc, conmon, runc, conmon, CRIU, Udica, etc as well as dependencies such as container-selinux built and teste
                                    d]       d together, and updated as frequently as every 12 weeks.
container-tools      1.0             common [ Stable versions of podman 1.0, buildah 1.5, skopeo 0.1, runc, conmon, CRIU, Udica, etc as well as dependencies such as container-selinux built and tested together, and s
                                    d]       upported for 24 months.
container-tools      2.0             common [ Stable versions of podman 1.6, buildah 1.11, skopeo 0.1, runc, conmon, etc as well as dependencies such as container-selinux built and tested together, and supported as
                                    d]       documented on the Application Stream lifecycle page.
container-tools      3.0             common [ Stable versions of podman 3.0, buildah 1.19, skopeo 1.2, runc, conmon, CRIU, Udica, etc as well as dependencies such as container-selinux built and tested together, and
                                    d]       supported as documented on the Application Stream lifecycle page.
container-tools      4.0             common [ Stable versions of podman 4.0, buildah 1.24, skopeo 1.6, runc, conmon, CRIU, Udica, etc as well as dependencies such as container-selinux built and tested together, and
                                    d]       supported as documented on the Application Stream lifecycle page.
eclipse              rhel8           java [d] An open, extensible IDE and application platform                                                                                                                        
freeradius           3.0 [d]         server [ High-performance and highly configurable free RADIUS server                                                                                                              
                                    d]      
gimp                 2.8 [d]         common [ gimp module                                                                                                                                                              
                                    d], deve
                                    l        
go-toolset           rhel8 [d]       common [ Go                                                                                                                                                                      
                                    d]      
httpd                2.4 [d]         common [ Apache HTTP Server                                                                                                                                                      
                                    d], deve
                                    l, minim
                                    al      
idm                  DL1             adtrust, The Red Hat Enterprise Linux Identity Management system module

实际上一个模块可以有多个流,而一条流可以看作某个特定版本软件包,及对应依赖库等等的集合

如果单独显示nginx这个模组对应的多个流,其中[d][e]表示当前1.14版为默认流和已启用流

一个模组只能启用一个流

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@RHEL8 ~]# dnf module list nginx
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 2:08:11 ago on Fri 22 Sep 2023 08:18:21 PM CST.
AppStream
Name                                         Stream                                             Profiles                                          Summary                                              
nginx                                        1.14 [d][e]                                        common [d]                                        nginx webserver                                      
nginx                                        1.16                                               common [d]                                        nginx webserver                                      
nginx                                        1.18                                               common [d]                                        nginx webserver                                      
nginx                                        1.20                                               common [d]                                        nginx webserver                                      

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

实际上生产环境下,RHEL8能够使用的模组还是比较少的

到了RHEL9版本,RHEL9的早期版本并没有Package module,能在后期版本迭代中可能会不断增加

1
2
3
4
5
6
7
[root@RHEL9 ~]# dnf module list
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 2:48:51 ago on Thu 21 Sep 2023 03:26:55 PM CST.

实际上伴随着云原生架构的迭代和发展趋势,容器化的部署方式已成为主流,所以操作系统中的软件仓库已经不是那么重要,可以通过容器去解决版本依赖问题

3 网络配置

RHEL7可使用network.serviceNetworkManager.service两个服务用于网络管理

RHEL8默认使用NetworkManager.service,而不再默认安装network.service

RHEL8仍可以使用配置文件的方式管理网络,RHEL8的网卡配置文件具体位置如下

1
2
[root@RHEL8 ~]# ll /etc/sysconfig/network-scripts/ifcfg-*
-rw-r--r--. 1 root root 334 Sep 4 15:51 /etc/sysconfig/network-scripts/ifcfg-ens33

network.service网络管理工具需要人为的指定配置文件和网卡名字的关系

NetworkManager.service则提供了更加方便的nmcli命令行和nmtui图形化工具

RHEL9则不再提供network-scripts软件包,只能使用NetworkManager.service去做相应的网络配置

网卡配置文件从原来的/etc/sysconfig/network-scripts/调整至/etc/NetworkManager/system-connections/目录下

可以验证

1
2
3
4
5
6
[root@localhost ~]# ll /etc/NetworkManager/system-connections/
total 4
-rw-------. 1 root root 249 Aug  1 22:25 ens33.nmconnection

[root@localhost ~]# ll /etc/sysconfig/network-scripts/
total 0

在RHEL9下,建议使用/etc/NetworkManager/system-connections/目录下配置文件

与此RHEL9的网络配置文件格式也发生了变化,即从多年的ifcfg格式调整为ini格式

例如RHEL9下ens33.nmconnection配置文件具体如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@localhost ~]# cat /etc/NetworkManager/system-connections/ens33.nmconnection 
[connection]
id=ens33
uuid=3abf6cd5-8ef9-3b6b-a2ff-dc68dcdfc7a7
type=ethernet
autoconnect-priority=-999
interface-name=ens33

[ethernet]

[ipv4]
address1=172.18.3.16/24,172.18.3.254
method=manual

[ipv6]
addr-gen-mode=eui64
method=disabled

[proxy]

在RHEL9下,NetworkManager.service仍然提供nmcli命令行和图形化工具(包括nmtui、nmtui-connect、nmtui-edit)

Red Hat Enterprise Linux 9 新特性及技术展示(图3)

4 安全

RHEL9对安全性提供了各项增强,这里罗列了重点几个部分

4.1 OpenSSH

4.1.1 禁止root登录

RHEL9默认禁止root账户进行SSH登录,例如我们使用远程SSH登录到RHEL9系统时,会提示Permission denied

1
2
root@172.18.3.16's password:
Permission denied, please try again.

查看OpenSSH的配置文件

1
2
3
[root@localhost ~]# grep -i permitroot /etc/ssh/sshd_config
#PermitRootLogin prohibit-password
# the setting of "PermitRootLogin without-password".

可以看到配置文件已经禁用了root账户的SSH登录权限

RHEL9自带的OpenSSH版本是8.7p1

1
2
3
4
[root@localhost /]# rpm -qa | grep openssh
openssh-8.7p1-8.el9.x86_64
openssh-clients-8.7p1-8.el9.x86_64
openssh-server-8.7p1-8.el9.x86_64

RHEL8自带的OpenSSH版本为8.0p1

1
2
3
4
[root@RHEL8 ~]# rpm -qa | grep openssh
openssh-8.0p1-16.el8.x86_64
openssh-clients-8.0p1-16.el8.x86_64
openssh-server-8.0p1-16.el8.x86_64

在RHEL9安装过程中,可以选择Allow root SSH login with password

Red Hat Enterprise Linux 9 新特性及技术展示(图4)

当勾上Allow root SSH login with password,细心的朋友可能发现/etc/ssh/sshd_config配置文件仍然是#PermitRootLogin prohibit-password

系统怎么能够允许root访问?实际上在/etc/ssh/sshd_config.d/创建了01-permitrootlogin.conf新配置文件,优先级更高,进行了部分参数覆盖

1
2
3
4
[root@RHEL9 ~]# cat /etc/ssh/sshd_config.d/01-permitrootlogin.conf 
# This file has been generated by the Anaconda Installer.
# Allow root to log in using ssh. Remove this file to opt-out.
PermitRootLogin yes

关于禁止root登录的重要性

实际上用户登陆最佳实践是通过普通用户登陆,然后使用sudo或者sudo su -进行root角色的切换

这样攻击者起码要猜到可远程登录的用户名及其密码,以及root账户的密码,这样系统的安全的级别相对提高了

实际上要习惯不使用root进行登录,以及抛弃使用root账户登录的坏习惯

4.2 防火墙

实际上在RHEL Linux中我们一直听到iptable以及firewall,或者更新的nftable,这三者的关系和区别如下

1、这三者都是与系统防火墙有关系

2、iptables与firewalld、包括nftables都不是真正的防火墙,它们都只是用来定义防火墙策略的防火墙管理工具而已

3、在RHEL7之前,我们一般使用iptables防火墙管理工具

4、从RHEL7开始,我们开始使用firewall来进行防火墙管理工具

相较于传统的防火墙管理配置工具,firewalld支持动态更新技术并加入了区域(zone)的概念

区域就是firewalld预先准备了几套防火墙策略集合(策略模板),用户可以根据生产场景的不同而选择合适的策略集合,从而实现防火墙策略之间的快速切换

4、RHEL7使用firewalld来管理netfilter,不过底层调用的命令仍然是iptables

4、RHEL8也使用firewalld服务作为用户配置防火墙规则的工具,只不过后端默认使用了nftable去实现了防火墙规则

通过配置查看,发现FirewallBackend=nftables

1
2
3
4
5
6
7
8
9
10
11
[root@RHEL8 ~]# grep -C 5 backend /etc/firewalld/firewalld.conf 
# in zones. Possible values are: all, unicast, broadcast, multicast and off.
# Default: off
LogDenied=off

# FirewallBackend
# Selects the firewall backend implementation.
# Choices are:
#       - nftables (default)
#       - iptables (iptables, ip6tables, ebtables and ipset)
FirewallBackend=nftables

4.2.1 firewalld

除了firewall-cmd命令行方式,还可以使用firewall-config图形化界面进行防火墙配置

Red Hat Enterprise Linux 9 新特性及技术展示(图5)

关于预定义区域

预定义区域存储在 /usr/lib/firewalld/zones/ 目录中,并可立即应用于任何可用的网络接口。只有在修改后,这些文件才会复制到 /etc/firewalld/zones/ 目录中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@RHEL8 zones]# ll /usr/lib/firewalld/zones/
total 44
-rw-r--r--. 1 root root 299 Feb 24  2022 block.xml
-rw-r--r--. 1 root root 293 Feb 24  2022 dmz.xml
-rw-r--r--. 1 root root 291 Feb 24  2022 drop.xml
-rw-r--r--. 1 root root 304 Feb 24  2022 external.xml
-rw-r--r--. 1 root root 397 Feb 24  2022 home.xml
-rw-r--r--. 1 root root 412 Feb 24  2022 internal.xml
-rw-r--r--. 1 root root 809 Jan 14  2022 libvirt.xml
-rw-r--r--. 1 root root 729 Aug 26  2022 nm-shared.xml
-rw-r--r--. 1 root root 343 Feb 24  2022 public.xml
-rw-r--r--. 1 root root 162 Feb 24  2022 trusted.xml
-rw-r--r--. 1 root root 339 Feb 24  2022 work.xml

[root@RHEL8 zones]# ll /etc/firewalld/zones/
total 8
-rw-r--r--. 1 root root 343 Sep  4 15:44 public.xml
-rw-r--r--. 1 root root 343 Sep  4 15:44 public.xml.old

firewalld 是一个防火墙服务守护进程,通过 D-Bus 接口提供动态可定制的主机防火墙。如果是动态的,它可在每次修改规则时启用、修改和删除规则,而不需要在每次修改规则时重启防火墙守护进程。

firewalld 使用区域和服务的概念来简化流量管理。区域是预定义的规则集。服务是预定义的规则,覆盖了允许特定服务进入流量的所有必要设置

RHEL7的firewall和iptables关系

Red Hat Enterprise Linux 9 新特性及技术展示(图6)

4.2.2 iptables和netfilter关系

iptables包含命令行工具和内核模块两部分

iptables用户态命令行是防火墙的配置工具,工作在用户态

用户可以通过iptables命令作用于内核态的netfilter,由后者触发相应的回调函数(hook 机制)执行相应的防护动作

iptables的过滤转发流程包括经典的四表五链,这里不详细展开

4.2.3 iptables和nftables关系

iptables是一个整体框架,但是存在一定诸多弊端,包括在内核态存在冗余代码,比如对于TCP和UDP而言,取sport,dport没有什么不同,但是iptables却使用了两套代码

nftables用于替代iptables,诸如iptables替代ipchains

nftables 框架对数据包进行分类,它是 iptablesip6tablesarptablesebtables 和 ipset 实用程序的后续者。与之前的数据包过滤工具相比,它在方便、特性和性能方面提供了大量改进,最重要的是:

  • 内置查找表而不是线性处理
  • IPv4 和 IPv6 协议的单一框架
  • 规则会以一个整体被应用,而不是分为抓取、更新和存储完整的规则集的步骤
  • 支持在规则集(nftrace)和监控追踪事件(nft)中调试和追踪
  • 更加一致和压缩的语法,没有特定协议的扩展
  • 用于第三方应用程序的 Netlink API

nftables主要由三个组件组成:内核实现、libnl netlink 通信和 nftables 用户空间。 其中内核提供了一个 netlink 配置接口以及运行时规则集评估,libnl 包含了与内核通信的基本函数,用户空间可以通过 nft 和用户进行交互

RHEL9提供了iptables-translate规则转换工具用于将iptable命令行转换成nft命令行

1
2
[root@RHEL9 yum]# iptables-translate -A INPUT -s 192.0.2.0/24 -j ACCEPT
nft add rule ip filter INPUT ip saddr 192.0.2.0/24 counter accept

4.2.4 firewall和nftables关系

在RHEL9下,firewall命令行配置的会转换为nftables下的规则,例如

使用firewall-cmd命令firewall-cmd --add-port=80/tcp针对public区域添加对80/tcp端口的放行

对应的nftables规则会添加以下配置信息

1
2
3
chain filter_IN_public_allow {
               tcp dport 80 ct state { new, untracked } accept
       }

4.3 WireGuard VPN技术

WireGuard轻量级服务提供了VPN功能,具有新的加密技术和更快的响应时间,从2020年1月开始在Linux Kernel5.6版本中已经集成WireGuard

WireGuard是由Jason A. Donenfeld开发的开放源代码VPN,基于Linux内核实现,利用Curve25519进行密钥交换,ChaCha20用于加密,Poly1305用于数据认证,BLAKE2用于散列函数运算,支持IPv4和IPv6的第3层。WireGuard旨在获得比IPsec和OpenVPN更好的性能

RHEL9中Linux kernel为5.14.0, kernel已支持WireGuard功能,目前还处于技术预览阶段,但不推荐在生产环境中使用

wg命令由wireguard-tools软件包提供

1
2
3
4
5
6
7
8
9
10
11
[root@RHEL9 ~]# yum provides wg
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:12:09 ago on Fri 29 Sep 2023 04:21:55 PM CST.
wireguard-tools-1.0.20210424-3.el9.x86_64 : Fast, modern, secure VPN tunnel
Repo        : Appstream
Matched from:
Filename    : /usr/bin/wg

生成私钥和公钥,保存在/etc/wireguard目录下

1
2
3
4
5
6
7
8
[root@RHEL9 ~]# wg genkey > /etc/wireguard/server.key
[root@RHEL9 ~]# wg pubkey < /etc/wireguard/server.key > /etc/wireguard/server.key.pub

[root@RHEL9 ~]# cat /etc/wireguard/server.key /etc/wireguard/server.key.pub
GBz9IABhlwudqnFI/AbNVY/s3pUYOO4lSIEyDFB6q38=
lm8AIEpldr3GoOmmFHuroUFwGfeeJOk5NBcxfFI2S0I=

[root@RHEL9 ~]# chmod 0600 /etc/wireguard/server.key /etc/wireguard/server.key.pub

在RHEL9中,可以直接使用nmtui图形化界面直接创建类型为WireGuard的配置文件

新建的connection类型已经内置了wireguard类型

Red Hat Enterprise Linux 9 新特性及技术展示(图7)

这里列出基本的配置方法,具体会单独另起一篇文章进行专题讲解

4.4 SELinux

RHEL9现在无法通过/etc/selinux/config禁用 SELinux 的支持

SELinux启用后,SELinux有两个模式,分别是enforcing 和 permissive

sestatus 命令返回 SELinux 状态以及正在使用的 SELinux 策略

1
2
3
4
5
6
7
8
9
10
11
[root@RHEL9 ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     actual (secure)
Max kernel policy version:      33

当您只通过 /etc/selinux/config 禁用SELinux 时,系统会在启用SELinux 的情况下启动,但不会载入策略

如果您需要禁用SELinux,请在内核命令行中添加 selinux=0 参数

可以使用grubby 更改RHEL8和RHEL9的默认内核

1
2
3
4
5
6
[root@RHEL9 ~]# rpm -q grubby
grubby-8.40-55.el9.x86_64

[root@RHEL9 ~]# grubby --update-kernel ALL --args selinux=0

[root@RHEL9 ~]# reboot

重新引导后,确认 getenforce 命令返回 Disabled

4.5 rsync命令替代SCP协议

文件传输协议SCP(Secure Copy Protocol)是基于SSH的文件传输协议

但实际上SCP存在的多个漏洞,RHEL9推荐采用rsync命令去进行替代原来的scp命令

rsync命令可以在本地计算机与远程计算机之间,或者两个本地目录之间同步文件(但不支持两台远程计算机之间的同步)

RHEL8和RHEL9最小安装均未安装rsync注意:本地和远程传输方必须都安装rsync软件

RHEL9自带仓库源中rsync版本为3.2.3

RHEL9自带仓库源中rsync版本为3.1.3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
[root@RHEL9]# yum provides rsync
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 2:39:56 ago on Thu 21 Sep 2023 10:51:55 AM CST.
rsync-3.2.3-9.el9.x86_64 : A program for synchronizing files over a network
Repo        : BaseOS
Matched from:
Provide    : rsync = 3.2.3-9.el9

[root@RHEL8]# yum provides rsync
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 2:25:52 ago on Thu 21 Sep 2023 11:10:27 AM CST.
rsync-3.1.3-19.el8.x86_64 : A program for synchronizing files over a network
Repo        : BaseOS
Matched from:
Provide    : rsync = 3.1.3-19.el8

注意

rsync使用所谓的“rsync算法”来使本地和远程两个主机之间的文件达到同步,这个算法只传送两个文件的不同部分,而不是每次都整份传送,因此速度相当快。

意味着传输的双方都必须安装rsync

否则会报错

1
2
3
bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.3]

4.5.1 常用参数使用

基本参数使用为-a-v-P

-a,–archive 归档模式,表示以递归方式传输文件,并保持所有文件属性

-v,–verbose 详细模式输出

-P,注意这里是大写的P,表示保留传输失败的文件,用于下一次传输过程中继续传输之前失败的文件,意味着传输中如果被打断了,已经传输的文件继续保留在目标文件

而配合参数--append--append-verify,则本次传输会从中断的点开始

一般而言使用-avP是最佳参数,例如

1
rsync -avP source/ root@172.18.3.15:/root

还有一个经常使用的参数是--delete

当目标文件夹存在,而源文件夹不存在时候,则会删除目标文件夹,可以理解为总是确保目标是源目标的完全镜像,不会多内容

4.5.2 其他使用技巧

注意的就是源目标参数中的源文件夹后是否带/

例如rsync -avP /root/dir root@172.18.3.15:/root则会在远程机器的/root目录下创建/dir文件夹,将/dir文件夹下文件全部复制到该目录下

rsync -avP /root/dir/ root@172.18.3.15:/root则会在将本地的/root/dir下的所有文件全部复制到远程机器的/root下,而不会去创建/root/dir文件夹

需要特别对上述区别进行注意

4.5 安全增强

SHA-1 生成的摘要不被视为是安全的,因为已发现多个基于哈希进行的安全攻击。RHEL核心加密组件不再默认使用SHA-1创建签名

在RHEL9中已经启用了SHA-1的签名算法

意味着使用RHEL9在使用SSH登录Centos4/5的时候会报错

可以使用update-crypto-policies去启用它

1
# update-crypto-policies --set DEFAULT:SHA1

5 存储相关

RHEL9现在支持exFAT,可通过安装 exfatprogs 软件包,使用 mkfs.exfat 创建exFAT文件系统

1
2
3
4
5
6
7
8
9
10
11
[root@RHEL9 ~]# yum provides mkfs.exfat
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 3:41:10 ago on Fri 22 Sep 2023 04:23:55 PM CST.
exfatprogs-1.1.2-2.el9.x86_64 : Userspace utilities for exFAT filesystems
Repo        : BaseOS
Matched from:
Filename    : /usr/sbin/mkfs.exfat

RHEL9下XFS文件系统现在支持bigtimeinnobtcount功能

注意

1、由于默认参数使用了bigtimeinnobtcount

2、使用默认参数创建的XFS文件系统将无法在RHEL7中挂载

例如使用mkfs.xfs命令,提示bigtime=1 inobtcount=1

1
2
3
4
5
6
7
8
9
10
11
[root@RHEL9 /]# mkfs.xfs -f /dev/sdb1
meta-data=/dev/sdb1              isize=512    agcount=4, agsize=196544 blks
        =                       sectsz=512   attr=2, projid32bit=1
        =                       crc=1        finobt=1, sparse=1, rmapbt=0
        =                       reflink=1    bigtime=1 inobtcount=1
data     =                       bsize=4096   blocks=786176, imaxpct=25
        =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=2560, version=2
        =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

如果此时在RHEL7挂载,会报错

1
2
3
4
5
6
[root@rhel7 /]# mount /dev/sdb1 /sdb1
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
      missing codepage or helper program, or other error

      In some cases useful info is found in syslog - try
      dmesg | tail or so.

经笔者测试在RHEL8中挂载,可正常使用

VDO管理软件己被删除,但是RHEL9新增了LVM-VDO功能

6 容器

在RHEL8中就已经使用podman替代docker作为新一代容器管理工具

在RHEL9中还提供了两个强大的容器管理镜像,分别是SkopeoBulidah

Podman在RHEL9中版本升级为4.0,Podman包括DNS名称解析、改进的IPv6支持和双栈支持,Podman 4.0.x 在兼容 CNI的基础上又新增原生的网络模式 Netavark 与 Aardvark-DNS 以更好的支持

RHEL9的CGroup升级到CGroup2,容器现在原生集成到cgroup2中,通过进程定义提高资源利用率

具体会单独另起一篇文章进行新版Podman讲解,以及Skopeo和Bulidah工具的讲解

7 其他

7.1 内核升级

RHEL9内核的版本从RHEL8的4.18升级为5.14

1
2
3
4
5
[root@RHEL8 ~]# uname -r
4.18.0-425.3.1.el8.x86_64

[root@localhost ~]# uname -r
5.14.0-70.22.1.el9_0.x86_64

7.2 移除info命令

GNU info命令被移除

RHEL8中保留GNU info命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[root@RHEL8 ~]# info --version
info (GNU texinfo) 6.5


[root@RHEL8 ~]# info cp
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Next: dd invocation,  Up: Basic operations

11.1 ‘cp’: Copy files and directories
=====================================

cp’ copies files (or, optionally, directories).  The copy is completely
independent of the original.  You can either copy one file to another,
or copy arbitrarily many files to a destination directory.  Synopses:

    cp [OPTION]... [-T] SOURCE DEST
    cp [OPTION]... SOURCE... DIRECTORY
    cp [OPTION]... -t DIRECTORY SOURCE...

  • If two file names are given, ‘cp’ copies the first file to the
    second.

  • If the ‘--target-directory’ (‘-t’) option is given, or failing that
    if the last file is a directory and the ‘--no-target-directory’
    (‘-T’) option is not given, ‘cp’ copies each SOURCE file to the
    specified directory, using the SOURCEs’ names.

  Generally, files are written just as they are read.  For exceptions,
see the ‘--sparse’ option below.

RHEL9中则移除了GUN info命令


部分内容需要登录查看

本次有 徐州鑫坤机电设备有限公司 网站:www.xzxkjd.com 展现 转载分享注明本文地址!有疑问,请联系我们:xzxkjd@qq.com 谢谢!

点击这里复制本文地址 以上内容由用户上传和网络在 徐州鑫坤机电设备有限公司 整理呈现,如有侵权请联系站长:xzxkjd@qq.com !

相关内容

加载中~

Copyright © 2012-2024 徐州鑫坤机电设备有限公司 版权所有
苏ICP备2023032739号-1 苏ICP备2023032739号-2 苏公网安备32038202000884
开发中 | 关键词 | 网站地图 | 网站地图 | 网站地图 | TAG集合

今日IP人数 0 今日浏览量(PV) 0 昨日IP人数 0 昨日浏览量(PV) 0 30天浏览量(PV) 0 总访浏览量(PV) 0

网站已运行:

在线客服
服务热线

服务热线

0516-86596070

联系邮箱

服务热线

xzxkjd.@qq.com

微信咨询
我的网站名称
交流群
我的网站名称
返回顶部
X我的网站名称

截屏,微信识别二维码

微信号:xkyinxiu

(点击微信号复制,添加好友)

  打开微信

微信号已复制,请打开微信添加咨询详情!