linux运行级别
文章目录
相关目录
CentOS8相关目录由/etc/inittab弄成/etc/systemd/system/default.target
[ranan@hadoop102 ~]$ cat /etc/systemd/system/default.target
# SPDX-License-Identifier: LGPL-2.1+
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=Graphical Interface
Documentation=man:systemd.special(7)
Requires=multi-user.target
Wants=display-manager.service
Conflicts=rescue.service rescue.target
After=multi-user.target rescue.service rescue.target display-manager.service
AllowIsolate=yes
查看、设置默认运行级别
0poweroff.target:死机,系统默认运行级别不能设为0,否则不能正常启动
1rescue.target:单用户寻回遗失密码有用,root权限linux运行级别linux运行级别linux 安装,用于系统维护,严禁远程登陆
2:多用户无网路
3multi-user.target:多用户有网路服务,登入后步入控制台命令行模式
4:保留
5graphical.target:图形化界面
6reboot.target:系统正常关掉重启,默认运行级别不能设为6,否则不能正常启动
查看默认运行级别
形式1:systemctlget-default
[ranan@hadoop102 ~]$ systemctl get-default
graphical.target
方法2:runlevel
[ranan@hadoop102 ~]$ runlevel
N 5
设置默认运行级别命令
设置默认命令行启动
[ranan@hadoop102 ~]# systemctl set-default multi-user.target
设置图形界面启动
[ranan@hadoop102 ~]# systemctl set-default graphical.target
切换当前运行级别
方式1:systemctl
//从命令行模式切换到图型模式
[ranan@hadoop102 ~]# systemctl isolate graphical.target
//切换到多用户的命令行模式
[ranan@hadoop102 ~]# systemctl isolate multi-user.target
方式2:init
init 0|1|3|5|6
常见问题
1.若果不留神将默认的运行级设置成0或7,如何处理?
步入单用户模式红帽子linux下载,更改成正常。