单纯提供一个相对的解答,并不是标准答案!
单纯就是个解答的参考,写完之后再来这边查查看答案跟你想的一样不一样!?
# A. 使用 ps 这个指令,列出系统全部进程的『 pid, nice值, pri值, command 』信息 [root@station200 ~]# ps -eo pid,ni,pri,comm PID NI PRI COMMAND 1 0 19 systemd 2 0 19 kthreadd 3 -20 39 rcu_gp ....... # B. 找出系统内进程运行文件名为 sshd 的 PID [root@station200 ~]# ps -eo pid,ni,pri,comm | grep sshd 1214 0 19 sshd [root@station200 ~]# pstree -p | grep sshd |-sshd(1214) # 上面两个方法都可以! # C. 将上述的 PID 给予 signal 1 的方式为何? [root@station200 ~]# kill -1 1214 [root@station200 ~]# killall -1 sshd # 上面两个方法都可以! # D. 观察一下 /var/log/secure 的内容是否正确的输出相关的进程行为? [root@station200 ~]# journalctl -u sshd -n 10 5月 26 17:25:13 station200.rocky sshd[1214]: Received SIGHUP; restarting. 5月 26 17:25:13 station200.rocky sshd[1214]: Server listening on 0.0.0.0 port 22. 5月 26 17:25:13 station200.rocky sshd[1214]: Server listening on :: port 22. # E. 如何将系统上所有的 bash 进程通通删除? [root@station200 ~]# killall bash [root@station200 ~]# killall -9 bash # 第一个方法,只会杀掉别人的 bash,自己保留,第二个方法,连同自己的通通删除!
# A. 通过 ps 找出 systemd 这个运行档的完整路径 [root@station200 ~]# ps -eo pid,ni,pri,args | grep 'systemd ' 1 0 19 /usr/lib/systemd/systemd rhgb --switched-root --system --deserialize 31 1137 0 19 /usr/lib/systemd/systemd --user 1818 0 19 /usr/lib/systemd/systemd --user 2086 0 19 grep --color=auto systemd # B. 上述的指令是由那一个软件所提供? [root@station200 ~]# rpm -qf /usr/lib/systemd/systemd systemd-250-12.el9_1.3.x86_64 # C. 该软件提供的全部文件名如何查找? [root@station200 ~]# rpm -ql systemd
# A. 查找系统有没有 cupsd 这个指令? [root@station200 ~]# type -a cupsd cupsd 是 /usr/sbin/cupsd # 是有的,位置就在 /usr/sbin/cupsd 这里 # B. 使用 rpm 查找该指令属于哪个软件? [root@station200 ~]# rpm -qf /usr/sbin/cupsd cups-2.3.3op2-16.el9.x86_64 # C. 使用 rpm 查找该软件的功能为何? [root@station200 ~]# rpm -qi cups Name : cups Epoch : 1 Version : 2.3.3op2 Release : 16.el9 Architecture: x86_64 ...... URL : http://www.cups.org/ Summary : CUPS printing system Description : CUPS printing system provides a portable printing layer for UNIX® operating systems. It has been developed by Apple Inc. to promote a standard printing solution for all UNIX vendors and users. CUPS provides the System V and Berkeley command-line interfaces. # 看起来似乎是一个可携式打印层级的打印系统喔!专给 UNix 系统使用的 # D. 请观察 cups 这个服务目前是启动或关闭?开机时会不会启动这个服务? [root@station200 ~]# systemctl status cups ● cups.service - CUPS Scheduler Loaded: loaded (/usr/lib/systemd/system/cups.service; enabled; vendor preset: enabled) Drop-In: /usr/lib/systemd/system/cups.service.d └─server.conf Active: active (running) since Fri 2023-05-26 01:47:50 CST; 7h left TriggeredBy: ● cups.path ● cups.socket Docs: man:cupsd(8) Main PID: 876 (cupsd) Status: "Scheduler is running..." Tasks: 1 (limit: 10940) Memory: 3.1M CPU: 15ms CGroup: /system.slice/cups.service └─876 /usr/sbin/cupsd -l # 除了 cups.service 之外,还有相依的 cups.path 与 cups.socket 喔! # E. 请将 cups 关闭,且下次开机还是会关闭 [root@station200 ~]# systemctl stop cups.[tab][tab] cups.path cups.service cups.socket [root@station200 ~]# systemctl stop cups.path cups.socket cups.service [root@station200 ~]# systemctl disable cups.path cups.socket cups.service Removed "/etc/systemd/system/multi-user.target.wants/cups.path". Removed "/etc/systemd/system/multi-user.target.wants/cups.service". Removed "/etc/systemd/system/sockets.target.wants/cups.socket". Removed "/etc/systemd/system/printer.target.wants/cups.service". # 其实 cups 共用到 3 种类型的服务数据,都要关闭才能完整关闭! # F. 再次观察 cups 这个服务。 [root@station200 ~]# systemctl status cups ○ cups.service - CUPS Scheduler Loaded: loaded (/usr/lib/systemd/system/cups.service; disabled; vendor preset: enabled) Drop-In: /usr/lib/systemd/system/cups.service.d └─server.conf Active: inactive (dead) TriggeredBy: ○ cups.socket Docs: man:cupsd(8) # G. 观察注册表有没有记录 cups 这个服务的相关数据? [root@station200 ~]# journalctl -u cups ..... 5月 25 18:13:03 station200.rockylinux systemd[1]: Stopping CUPS Scheduler... 5月 25 18:13:03 station200.rockylinux systemd[1]: cups.service: Deactivated successfully. 5月 25 18:13:03 station200.rockylinux systemd[1]: Stopped CUPS Scheduler.
# A. 找出系统中以 Modem 为名的所有的服务名称,并观察其状态 [root@station200 ~]# systemctl list-units | grep -i 'modem' ModemManager.service loaded active running Modem Manager [root@station200 ~]# systemctl status ModemManager ● ModemManager.service - Modem Manager Loaded: loaded (/usr/lib/systemd/system/ModemManager.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2023-05-26 01:47:49 CST; 4h 2min left Main PID: 796 (ModemManager) Tasks: 4 (limit: 10940) Memory: 7.6M CPU: 65ms CGroup: /system.slice/ModemManager.service └─796 /usr/sbin/ModemManager # 是 enabled 且 active 喔! # B. 将该服务设置为『开机不启动』且『目前立刻关闭』的情况 [root@station200 ~]# systemctl disable ModemManager Removed "/etc/systemd/system/multi-user.target.wants/ModemManager.service". Removed "/etc/systemd/system/dbus-org.freedesktop.ModemManager1.service". [root@station200 ~]# systemctl stop ModemManager
# A. 使用 netstat -tlunp 查看一下系统的网络监听端口口 [root@station200 ~]# systemctl get-default multi-user.target [root@station200 ~]# systemctl isolate multi-user.target [root@station200 ~]# netstat -tlunp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 877/sshd: /usr/sbin tcp6 0 0 :::22 :::* LISTEN 877/sshd: /usr/sbin udp 0 0 0.0.0.0:36003 0.0.0.0:* 740/avahi-daemon: r udp 0 0 0.0.0.0:5353 0.0.0.0:* 740/avahi-daemon: r udp 0 0 127.0.0.1:323 0.0.0.0:* 790/chronyd udp 0 0 0.0.0.0:514 0.0.0.0:* 748/rsyslogd udp6 0 0 :::5353 :::* 740/avahi-daemon: r udp6 0 0 ::1:323 :::* 790/chronyd udp6 0 0 :::35278 :::* 740/avahi-daemon: r udp6 0 0 :::514 :::* 748/rsyslogd # 确认在一般纯文本界面就会有很多常驻程序在系统中! # B. 请在本机目前的状态下,将操作界面模式更改为 rescue.target 这个救援模式 [root@station200 ~]# systemctl isolate rescue.target # 在进入 rescue 的时候,系统会要求输入 root 的密码喔! # C. 使用 netstat -tlunp 查看一下系统的网络监听端口口是否有变少? [root@station200 ~]# netstat -tlunp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name # 救援模式底下,完全没有任何的网络端口口被激活! # D. 将环境改为原本的操作界面 (缺省为图形、变更为 GUI) [root@station200 ~]# systemctl isolate graphical.target [root@station200 ~]# systemctl set-default graphical.target Removed "/etc/systemd/system/default.target". Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target.
# A. 安装:WWW 网络服务是由 httpd 这个软件所提供的,请先安装该软件 [root@station200 ~]# yum install httpd # B. 启动:启动该服务,并且查找该服务启动的端口口为何 [root@station200 ~]# systemctl start httpd [root@station200 ~]# netstat -tlunp | grep httpd tcp6 0 0 :::80 :::* LISTEN 5829/httpd # 所以,启动的端口口当然就是缺省的 80 port 了! # C. 开机启动:设置为缺省启动该服务,并查找该服务的状态是否正确 [root@station200 ~]# systemctl enable httpd Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service. [root@station200 ~]# systemctl status httpd ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: active (running) since Wed 2020-05-27 09:10:54 CST; 36s ago Docs: man:httpd.service(8) Main PID: 5829 (httpd) Status: "Running, listening on: port 80" Tasks: 213 (limit: 11486) Memory: 46.6M CGroup: /system.slice/httpd.service ├─5829 /usr/sbin/httpd -DFOREGROUND ├─5830 /usr/sbin/httpd -DFOREGROUND ├─5831 /usr/sbin/httpd -DFOREGROUND ├─5832 /usr/sbin/httpd -DFOREGROUND └─5833 /usr/sbin/httpd -DFOREGROUND # D. 防火墙:将 http 服务的防火墙端口口放行 [root@station200 ~]# firewall-cmd --permanent --list-all public (active) target: default icmp-block-inversion: no interfaces: ens3 sources: services: ftp http https ssh syslog ports: protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: rule family="ipv4" source address="172.16.100.254" accept rule family="ipv4" source address="172.16.0.0/16" service name="ssh" accept # 前几个小节就已经放行过,所以这里查阅一下 double check 即可! # E. 测试:使用浏览器查找本机 WWW 服务是否正确启动了。 # 请直接到虚拟机启动浏览器输入『 http://localhost 』或 # 『 http://172.16.60.XX 』去看自己与他人的环境!
[root@station200 ~]# systemctl list-units --all | grep local rc-local.service loaded inactive dead /etc/rc.d/rc.local Compatibility local-fs-pre.target loaded active active Preparation for Local File Systems local-fs.target loaded active active Local File Systems [root@station200 ~]# systemctl list-unit-files | grep local dbus-org.freedesktop.locale1.service alias - rc-local.service static - systemd-localed.service static - local-fs-pre.target static - local-fs.target static - # 看起来应该是有需要的时候,这个服务才会被启动!因此,目前是 inactive 的! [root@station200 ~]# systemctl show rc-local.service Type=forking Restart=no ..... ExecStart={ path=/etc/rc.d/rc.local ; argv[]=/etc/rc.d/rc.local start ; > .....最终看起来,应该是与 /etc/rc.d/rc.local 有关喔!
[root@station200 ~]# cat /etc/rc.d/rc.local #!/bin/bash # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES ..... # # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure # that this script will be executed during boot. ..... # 看起来得要处理成为可运行档才行喔! [root@station200 ~]# chmod a+x /etc/rc.d/rc.local [root@station200 ~]# ll /etc/rc.d/rc.local -rwxr-xr-x. 1 root root 474 5月 9 16:48 /etc/rc.d/rc.local [root@station200 ~]# systemctl daemon-reload [root@station200 ~]# systemctl status rc-local ○ rc-local.service - /etc/rc.d/rc.local Compatibility Loaded: loaded (/usr/lib/systemd/system/rc-local.service; enabled-runtime; preset: disabled) Active: inactive (dead) Docs: man:systemd-rc-local-generator(8)
# A. 在内核模块的目录下,使用 find 找出系统有没有 fat 关键字的模块? [root@station200 ~]# uname -r 5.14.0-162.23.1.el9_1.x86_64 [root@station200 ~]# find /lib/modules/5.14.0-162.23.1.el9_1.x86_64 | grep fat /lib/modules/5.14.0-162.23.1.el9_1.x86_64/kernel/fs/exfat /lib/modules/5.14.0-162.23.1.el9_1.x86_64/kernel/fs/exfat/exfat.ko.xz /lib/modules/5.14.0-162.23.1.el9_1.x86_64/kernel/fs/fat /lib/modules/5.14.0-162.23.1.el9_1.x86_64/kernel/fs/fat/fat.ko.xz /lib/modules/5.14.0-162.23.1.el9_1.x86_64/kernel/fs/fat/msdos.ko.xz /lib/modules/5.14.0-162.23.1.el9_1.x86_64/kernel/fs/fat/vfat.ko.xz # B. 是否已经有加载 fat 相关的模块了?若无,请加载该模块,再次检查是否加载成功 [root@station200 ~]# lsmod | grep fat [root@station200 ~]# modprobe fat [root@station200 ~]# lsmod | egrep 'Module|fat' Module Size Used by fat 86016 0 # C. 再次检查有无 cifs 模块,若无,请加载,并查找该模块的功能为何? [root@station200 ~]# find /lib/modules/5.14.0-162.23.1.el9_1.x86_64 | grep cifs /lib/modules/5.14.0-162.23.1.el9_1.x86_64/kernel/fs/cifs /lib/modules/5.14.0-162.23.1.el9_1.x86_64/kernel/fs/cifs/cifs.ko.xz /lib/modules/5.14.0-162.23.1.el9_1.x86_64/kernel/fs/smbfs_common/cifs_arc4.ko.xz /lib/modules/5.14.0-162.23.1.el9_1.x86_64/kernel/fs/smbfs_common/cifs_md4.ko.xz [root@station200 ~]# modprobe cifs [root@station200 ~]# modinfo cifs filename: /lib/modules/5.14.0-162.23.1.el9_1.x86_64/kernel/fs/cifs/cifs.ko.xz softdep: gcm ..... version: 2.34 ..... description: VFS to access SMB3 servers e.g. Samba, Macs, Azure and Windows (and also older servers complying with the SNIA CIFS Specification) license: GPL ..... # 在描述的地方,看起来就是 windows / Linux 的文件系统访问模块喔! # D. 卸载 cifs 模块。 [root@station200 ~]# lsmod | egrep 'Module|cifs' Module Size Used by cifs 1327104 0 cifs_arc4 16384 1 cifs rdma_cm 139264 1 cifs ib_core 446464 4 rdma_cm,cifs,iw_cm,ib_cm cifs_md4 16384 1 cifs dns_resolver 16384 1 cifs [root@station200 ~]# modprobe -r cifs <==卸载指令在此 [root@station200 ~]# lsmod | egrep 'Module|cifs' # E. 在内核模块的目录下,有没有 ntfs 的关键字? [root@station200 ~]# find /lib/modules/5.14.0-162.23.1.el9_1.x86_64 | grep ntfs # 所以,并没有 ntfs 的关键字喔! # F. 在 yum 的使用上,激活 epel 软件库,搜索 ntfs 这个关键字软件 [root@station200 ~]# yum --enablerepo=epel search ntfs ================================= Name & Summary 符合: ntfs ================================== ntfs-3g.x86_64 : Linux NTFS userspace driver ntfs-3g-devel.x86_64 : Development files and libraries for ntfs-3g ntfs-3g-libs.x86_64 : Runtime libraries for ntfs-3g ntfs-3g-system-compression.x86_64 : NTFS-3G plugin for reading "system compressed" files ntfsprogs.x86_64 : NTFS filesystem libraries and utilities # G. 尝试安装上述找到的软件名称 [root@station200 ~]# yum --enablerepo=epel install ntfs-3g [root@station200 ~]# rpm -qi ntfs-3g ...... Summary : Linux NTFS userspace driver Description : NTFS-3G is a stable, open source, GPL licensed, POSIX, read/write NTFS driver for Linux and many other operating systems. It provides safe handling of the Windows XP, Windows Server 2003, Windows 2000, Windows Vista, Windows Server 2008 and Windows 7 NTFS file systems. NTFS-3G can create, remove, rename, move files, directories, hard links, and streams; it can read and write normal and transparently compressed files, including streams and sparse files; it can handle special files like symbolic links, devices, and FIFOs, ACL, extended attributes; moreover it provides full file access right and ownership support. # 原来就是 NTFS 文件系统的支持模块!
[root@station200 ~]# vim /etc/sysctl.d/myrocky.conf net.ipv4.icmp_echo_ignore_all = 0 net.ipv4.ip_forward = 1 dev.raid.speed_limit_min = 40000 dev.raid.speed_limit_max = 50000 [root@station200 ~]# sysctl -p /etc/sysctl.d/myrocky.conf
# A. 观察你的系统内的内核版本 [root@station200 ~]# ll /lib/modules drwxr-xr-x. 7 root root 4096 5月 26 03:11 5.14.0-162.12.1.el9_1.0.2.x86_64 <==最旧 drwxr-xr-x. 7 root root 4096 5月 26 03:11 5.14.0-162.23.1.el9_1.x86_64 drwxr-xr-x. 8 root root 4096 5月 26 03:11 5.14.0-284.11.1.el9_2.x86_64 [root@station200 ~]# uname -r 5.14.0-162.23.1.el9_1.x86_64 # 如上所示,我们有 3 个内核,我们使用了旧版内核做 TEXT 模式练习,因此可能会取的不同内核 # B. 重新开机后,使用旧版内核开机,并确认确实为旧版内核 [root@station200 ~]# reboot # 开机过程中,要在菜单的环境中,选择旧版内核才行!不能让系统自己一直开机! [root@station200 ~]# uname -r 5.14.0-162.12.1.el9_1.0.2.x86_64 # 这时就会使用旧内核了!也就仿真了新内核无法开机时使用旧内核开机的机制! # C. 前往 /boot 目录,将新版的 initramfs 暂时更名为其他文件 [root@station200 ~]# cd /boot [root@station200 boot]# ls initramfs-* initramfs-0-rescue-d587a2c04fbb458e8015aef30df28fec.img initramfs-5.14.0-162.12.1.el9_1.0.2.x86_64.img initramfs-5.14.0-162.12.1.el9_1.0.2.x86_64kdump.img initramfs-5.14.0-162.23.1.el9_1.x86_64.img initramfs-5.14.0-162.23.1.el9_1.x86_64kdump.img initramfs-5.14.0-284.11.1.el9_2.x86_64.img initramfs-5.14.0-284.11.1.el9_2.x86_64kdump.img [root@station200 boot]# mv initramfs-5.14.0-284.11.1.el9_2.x86_64.img initramfs-5.14.0-284.11.1.el9_2.x86_64.img.raw # D. 使用 dracut 重新建置该新版内核的 initramfs,加入 ixbge 这个网络卡模块 [root@station200 boot]# dracut -v --add-drivers ixgbe ..... dracut: *** Creating image file '/boot/initramfs-5.14.0-284.11.1.el9_2.x86_64.img' *** dracut: dracut: using auto-determined compression method 'pigz' dracut: *** Creating initramfs image file '/boot/initramfs-5.14.0-284.11.1.el9_2.x86_64.img' done *** [root@station200 boot]# lsinitrd initramfs-5.14.0-284.11.1.el9_2.x86_64.img | grep -i ixgbe Arguments: -v --add-drivers 'ixgbe' drwxr-xr-x 2 root root 0 Apr 13 13:40 usr/lib/modules/5.14.0-284.11.1.el9_2.x86_64/kernel/drivers/net/ethernet/intel/ixgbe -rw-r--r-- 1 root root 200984 Apr 13 13:40 usr/lib/modules/5.14.0-284.11.1.el9_2.x86_64/kernel/drivers/net/ethernet/intel/ixgbe/ixgbe.ko.xz # E. 重新开机之后,选择新内核开机,看看是否可以顺利开机进入系统 # 直接以新内核开机测试一下,基本上应该是可以顺利开机没啥大问题才对!
[root@station200 ~]# pstree -p | grep atd |-atd(1543) [root@station200 ~]# kill -1 1543 [root@station200 ~]# systemctl reload atd Failed to reload atd.service: Job type reload is not applicable for unit atd.service. [root@station200 ~]# systemctl restart atd [root@station200 ~]# pstree -p | grep atd |-atd(2652)看起来 systemctl 控制底下的 atd 只能重启,不能重新加载!所以改成 restart 重启。要注意的是,使用 kill -1 不会改变原有进程的 PID, 但是 restart 会改变喔!因为 restart 是关闭后启动的意思,与 reload 加载设置档并不相同。
[root@station200 ~]# systemctl get-default graphical.target [root@station200 ~]# systemctl set-default multi-user.target Removed /etc/systemd/system/default.target. Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/multi-user.target. [root@station200 ~]# systemctl get-default multi-user.target [root@station200 ~]# systemctl isolate graphical.target
# A. 安装 [root@station200 ~]# yum install vsftpd [root@station200 ~]# rpm -ql vsftpd | grep systemd /usr/lib/systemd/system-generators/vsftpd-generator /usr/lib/systemd/system/vsftpd.service /usr/lib/systemd/system/vsftpd.target /usr/lib/systemd/system/vsftpd@.service # B. 启动 [root@station200 ~]# systemctl start vsftpd [root@station200 ~]# netstat -tlunp | grep vsftpd tcp6 0 0 :::21 :::* LISTEN 2839/vsftpd # C. 开机启动 [root@station200 ~]# systemctl enable vsftpd Created symlink /etc/systemd/system/multi-user.target.wants/vsftpd.service → /usr/lib/systemd/system/vsftpd.service. [root@station200 ~]# systemctl status vsftpd ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2020-05-28 10:25:26 CST; 1min 31s ago Main PID: 2839 (vsftpd) Tasks: 1 (limit: 11484) Memory: 604.0K CGroup: /system.slice/vsftpd.service └─2839 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf # D. 防火墙 [root@station200 ~]# firewall-cmd --permanent --add-service=ftp [root@station200 ~]# firewall-cmd --reload [root@station200 ~]# firewall-cmd --list-services ftp http https ssh syslog # E. 测试 # 通过一些简易的方法检查~例如通过浏览器输入网址列『 ftp://localhost 』即可!
[root@station200 ~]# tuned-adm profile network-latency [root@station200 ~]# tuned-adm active Current active profile: network-latency
[root@station200 ~]# vim /etc/sysctl.d/myrocky.conf net.ipv4.icmp_echo_ignore_all = 0 net.ipv4.ip_forward = 1 dev.raid.speed_limit_min = 40000 dev.raid.speed_limit_max = 50000 vm.dirty_ratio = 40 vm.dirty_background_ratio = 5 vm.swappiness = 10 [root@station200 ~]# sysctl -p /etc/sysctl.d/myrocky.conf
# 1. 找出新内核版本 [root@station200 ~]# ll /lib/modules drwxr-xr-x. 7 root root 4096 5月 26 03:11 5.14.0-162.12.1.el9_1.0.2.x86_64 drwxr-xr-x. 7 root root 4096 5月 26 03:11 5.14.0-162.23.1.el9_1.x86_64 drwxr-xr-x. 8 root root 4096 5月 26 03:11 5.14.0-284.11.1.el9_2.x86_64 <==最新 # 2. 开始跑到 /boot/loader/entries 制作新菜单 [root@station200 ~]# cd /boot/loader/entries/ [root@station200 entries]# ls *5.14.0-284.11.1.el9_2.x86_64* d587a2c04fbb458e8015aef30df28fec-5.14.0-284.11.1.el9_2.x86_64.conf [root@station200 entries]# cp d5...5.14.0-284.11.1.el9_2.x86_64.conf custom-GUI-5.14.0-284.11.1.el9_2.x86_64.conf [root@station200 entries]# vim custom-GUI-5.14.0-284.11.1.el9_2.x86_64.conf title Rocky Linux (5.14.0-284.11.1.el9_2.x86_64) 9.2 (Blue Onyx) - GUI version 5.14.0-284.11.1.el9_2.x86_64 linux /vmlinuz-5.14.0-284.11.1.el9_2.x86_64 initrd /initramfs-5.14.0-284.11.1.el9_2.x86_64.img $tuned_initrd options root=/dev/mapper/rocky-root .... systemd.unit=graphical.target id mygui grub_users $grub_users grub_arg --unrestricted grub_class rocky # 3. 设置缺省开机菜单的 id 为 mygui 即可! [root@station200 entries]# vim /etc/default/grub ..... GRUB_DEFAULT=mygui ..... # 4. 重新建置 grub.cfg 文件内容,并测试开机 [root@station200 entries]# grub2-mkconfig -o /boot/grub2/grub.cfg [root@station200 entries]# reboot