單純提供一個相對的解答,並不是標準答案!
單純就是個解答的參考,寫完之後再來這邊查查看答案跟你想的一樣不一樣!?
# 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