单纯提供一个相对的解答,并不是标准答案!
单纯就是个解答的参考,写完之后再来这边查查看答案跟你想的一样不一样!?
# 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.centos sshd[1214]: Received SIGHUP; restarting. 5月 26 17:25:13 station200.centos sshd[1214]: Server listening on 0.0.0.0 port 22. 5月 26 17:25:13 station200.centos 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 --switched-root --system --deserialize 17 2167 0 19 /usr/lib/systemd/systemd --user 2621 0 19 /usr/lib/systemd/systemd --user 32630 0 19 /usr/lib/systemd/systemd --user 32754 0 19 grep --color=auto systemd # B. 上述的指令是由那一个软件所提供? [root@station200 ~]# rpm -qf /usr/lib/systemd/systemd systemd-239-18.el8_1.5.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.2.6-28.el8.x86_64 # C. 使用 rpm 查找该软件的功能为何? [root@station200 ~]# rpm -qi cups Name : cups Epoch : 1 Version : 2.2.6 Release : 28.el8 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) Active: active (running) since Tue 2020-05-26 15:29:58 CST; 6h ago Docs: man:cupsd(8) Main PID: 1215 (cupsd) Status: "Scheduler is running..." Tasks: 1 (limit: 11486) Memory: 2.0M CGroup: /system.slice/cups.service └─1215 /usr/sbin/cupsd -l # 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/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) Active: inactive (dead) Docs: man:cupsd(8) # G. 观察注册表有没有记录 cups 这个服务的相关数据? [root@station200 ~]# journalctl -u cups ..... 5月 26 21:52:09 station200.centos systemd[1]: Stopping CUPS Scheduler... 5月 26 21:52:09 station200.centos systemd[1]: Stopped CUPS Scheduler.
# A. 找出系统中以 ksm 为开头的所有的服务名称,并观察其状态 [root@station200 ~]# systemctl list-units | grep '^ksm' ksm.service loaded active exited Kernel Samepage Merging ksmtuned.service loaded active running Kernel Samepage Merging (KSM) Tuning Daemon [root@station200 ~]# systemctl status ksm ksmtuned ● ksm.service - Kernel Samepage Merging Loaded: loaded (/usr/lib/systemd/system/ksm.service; enabled; vendor preset: enabled) Active: active (exited) since Tue 2020-05-26 15:29:56 CST; 7h ago Main PID: 1051 (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 11486) Memory: 0B CGroup: /system.slice/ksm.service ● ksmtuned.service - Kernel Samepage Merging (KSM) Tuning Daemon Loaded: loaded (/usr/lib/systemd/system/ksmtuned.service; enabled; vendor preset: enab> Active: active (running) since Tue 2020-05-26 15:29:56 CST; 7h ago Main PID: 1076 (ksmtuned) Tasks: 2 (limit: 11486) Memory: 11.3M CGroup: /system.slice/ksmtuned.service ├─1076 /bin/bash /usr/sbin/ksmtuned └─1541 sleep 60 # 两个都是 enabled 且 active 喔! # B. 将该服务设置为『开机不启动』且『目前立刻关闭』的情况 [root@station200 ~]# systemctl disable ksm ksmtuned Removed /etc/systemd/system/multi-user.target.wants/ksm.service. Removed /etc/systemd/system/multi-user.target.wants/ksmtuned.service. [root@station200 ~]# systemctl stop ksm ksmtuned
# 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:111 0.0.0.0:* LISTEN 1/systemd tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2136/dnsmasq tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1214/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1582/master tcp6 0 0 :::111 :::* LISTEN 1/systemd tcp6 0 0 :::22 :::* LISTEN 1214/sshd tcp6 0 0 ::1:25 :::* LISTEN 1582/master udp 0 0 0.0.0.0:44961 0.0.0.0:* 1769/rsyslogd udp 0 0 192.168.122.1:53 0.0.0.0:* 2136/dnsmasq udp 0 0 0.0.0.0:67 0.0.0.0:* 2136/dnsmasq udp 0 0 0.0.0.0:111 0.0.0.0:* 1/systemd udp 0 0 0.0.0.0:5353 0.0.0.0:* 1070/avahi-daemon: udp 0 0 127.0.0.1:323 0.0.0.0:* 1073/chronyd udp 0 0 0.0.0.0:514 0.0.0.0:* 1769/rsyslogd udp 0 0 0.0.0.0:60999 0.0.0.0:* 1070/avahi-daemon: udp6 0 0 :::50088 :::* 1070/avahi-daemon: udp6 0 0 :::111 :::* 1/systemd udp6 0 0 :::5353 :::* 1070/avahi-daemon: udp6 0 0 ::1:323 :::* 1073/chronyd udp6 0 0 :::514 :::* 1769/rsyslogd # 确认在一般纯文本界面就会有很多常驻程序在系统中! # B. 请在本机目前的状态下,将操作界面模式更改为 rescue.target 这个救援模式 [root@station200 ~]# systemctl isolate rescue.target # 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 tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 2136/dnsmasq udp 0 0 192.168.122.1:53 0.0.0.0:* 2136/dnsmasq udp 0 0 0.0.0.0:67 0.0.0.0:* 2136/dnsmasq # 救援模式本来就是在救援,所以不会有太多的网络服务被启动! # 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 --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 服务是否正确启动了。 # 请直接到虚拟机启动浏览器输入『 https://# 』或 # 『 http://172.16.60.XX 』去看自己与他人的环境!
[root@station200 ~]# systemctl list-units --all | grep local ● cloud-init-local.service not-found inactive dead cloud-init-local.service rc-local.service loaded inactive dead /etc/rc.d/rc.local Compatibility local-fs-pre.target loaded active active Local File Systems (Pre) local-fs.target loaded active active Local File Systems [root@station200 ~]# systemctl list-unit-files | grep local dbus-org.freedesktop.locale1.service static halt-local.service static 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 4月 10 05:52 /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;> Active: inactive (dead) Docs: man:systemd-rc-local-generator(8)
# A. 在内核模块的目录下,使用 find 找出系统有没有 fat 关键字的模块? [root@station200 ~]# uname -r 4.18.0-147.8.1.el8_1.x86_64 [root@station200 ~]# find /lib/modules/4.18.0-147.8.1.el8_1.x86_64/ | grep fat /lib/modules/4.18.0-147.8.1.el8_1.x86_64/kernel/fs/fat /lib/modules/4.18.0-147.8.1.el8_1.x86_64/kernel/fs/fat/fat.ko.xz /lib/modules/4.18.0-147.8.1.el8_1.x86_64/kernel/fs/fat/msdos.ko.xz /lib/modules/4.18.0-147.8.1.el8_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 81920 0 # C. 再次检查有无 cifs 模块,若无,请加载,并查找该模块的功能为何? [root@station200 ~]# find /lib/modules/4.18.0-147.8.1.el8_1.x86_64/ | grep cifs /lib/modules/4.18.0-147.8.1.el8_1.x86_64/kernel/fs/cifs /lib/modules/4.18.0-147.8.1.el8_1.x86_64/kernel/fs/cifs/cifs.ko.xz [root@station200 ~]# modprobe cifs [root@station200 ~]# modinfo cifs filename: /lib/modules/4.18.0-147.8.1.el8_1.x86_64/kernel/fs/cifs/cifs.ko.xz softdep: pre: ccm ..... version: 2.19 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 1073152 0 dns_resolver 16384 1 cifs [root@station200 ~]# modprobe -r cifs <==卸载指令在此 [root@station200 ~]# lsmod | egrep 'Module|cifs' Module Size Used by # E. 在内核模块的目录下,有没有 ntfs 的关键字? [root@station200 ~]# find /lib/modules/4.18.0-147.8.1.el8_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 ntfsprogs.x86_64 : NTFS filesystem libraries and utilities ntfs-3g-devel.x86_64 : Development files and libraries for ntfs-3g ntfs-3g-system-compression.x86_64 : NTFS-3G plugin for reading "system compressed" files # 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/mycentos.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/mycentos.conf
# A. 观察你的系统内的内核版本 [root@station200 ~]# ll /lib/modules drwxr-xr-x. 7 root root 4096 5月 25 21:31 4.18.0-147.8.1.el8_1.x86_64 drwxr-xr-x. 6 root root 4096 5月 25 21:31 4.18.0-147.el8.x86_64 [root@station200 ~]# uname -r 4.18.0-147.8.1.el8_1.x86_64 # 如上所示,我们有两个内核,因为系统缺省都会使用新内核开机,所以会看到目前是新内核。 # B. 重新开机后,使用旧版内核开机,并确认确实为旧版内核 [root@station200 ~]# reboot # 开机过程中,要在菜单的环境中,选择旧版内核才行!不能让系统自己一直开机! [root@station200 ~]# uname -r 4.18.0-147.el8.x86_64 # 这时就会使用旧内核了!也就仿真了新内核无法开机时使用旧内核开机的机制! # C. 前往 /boot 目录,将新版的 initramfs 暂时更名为其他文件 [root@station200 ~]# cd /boot [root@station200 boot]# ls initramfs-* initramfs-0-rescue-502dbaaf2a074134909a59ef9ab651c1.img initramfs-4.18.0-147.el8.x86_64.img initramfs-4.18.0-147.8.1.el8_1.x86_64.img initramfs-4.18.0-147.el8.x86_64kdump.img initramfs-4.18.0-147.8.1.el8_1.x86_64kdump.img [root@station200 boot]# mv initramfs-4.18.0-147.8.1.el8_1.x86_64.img initramfs-4.18.0-147.8.1.el8_1.x86_64.img.raw # D. 使用 dracut 重新建置该新版内核的 initramfs,加入 ixbge 这个网络卡模块 [root@station200 boot]# dracut -v --add-drivers ixbge initramfs-4.18.0-147.8.1.el8_1.x86_64.img 4.18.0-147.8.1.el8_1.x86_64 [root@station200 boot]# lsinitrd initramfs-4.18.0-147.8.1.el8_1.x86_64.img | grep -i ixgbe Arguments: -v --add-drivers 'ixgbe' drwxr-xr-x 2 root root 0 Jan 4 02:12 usr/lib/modules/4.18.0-147.8.1.el8_1.x86_64/kernel/drivers/net/ethernet/intel/ixgbe -rw-r--r-- 1 root root 146276 Jan 4 02:12 usr/lib/modules/4.18.0-147.8.1.el8_1.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 ~]# systemctl restart firewalld.service [root@station200 ~]# firewall-cmd --list-services ftp http https ssh syslog # E. 测试 # 通过一些简易的方法检查~例如通过浏览器输入网址列『 ftp://# 』即可!
[root@station200 ~]# tuned-adm profile network-latency [root@station200 ~]# tuned-adm active Current active profile: network-latency
[root@station200 ~]# vim /etc/sysctl.d/mycentos.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/mycentos.conf
# 1. 找出新内核版本 [root@station200 ~]# ll /lib/modules drwxr-xr-x. 7 root root 4096 5月 25 21:31 4.18.0-147.8.1.el8_1.x86_64 drwxr-xr-x. 6 root root 4096 5月 25 21:31 4.18.0-147.el8.x86_64 # 2. 开始跑到 /boot/loader/entries 制作新菜单 [root@station200 entries]# ls *4.18.0-147.8.1.el8_1.x86_64* 502dbaaf2a074134909a59ef9ab651c1-4.18.0-147.8.1.el8_1.x86_64.conf [root@station200 entries]# cp 502dbaaf2a074134909a59ef9ab651c1-4.18.0-147.8.1.el8_1.x86_64.conf 502dbaaf2a074134909a59ef9ab651c1-4.18.0-147.8.1.el8_1.x86_64-gui.conf [root@station200 entries]# vim 502dbaaf2a074134909a59ef9ab651c1-4.18.0-147.8.1.el8_1.x86_64-gui.conf title CentOS Linux (4.18.0-147.8.1.el8_1.x86_64) 8 (Core) - GUI mode version 4.18.0-147.8.1.el8_1.x86_64 linux /vmlinuz-4.18.0-147.8.1.el8_1.x86_64 initrd /initramfs-4.18.0-147.8.1.el8_1.x86_64.img $tuned_initrd options $kernelopts $tuned_params systemd.unit=graphical.target id mygui grub_users $grub_users grub_arg --unrestricted grub_class kernel # 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