天天看点

linux7开机更改启动级别,RHEL7更改默认启动级别

[[email protected] ~]# more /etc/inittab

# inittab is no longer used when using systemd.

#

# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.

#

# Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target

#

# systemd uses 'targets' instead of runlevels. By default, there are two main targets:

#

# multi-user.target: analogous to runlevel 3

# graphical.target: analogous to runlevel 5

#

# To set a default target, run:

#

# ln -sf /lib/systemd/system/.target /etc/systemd/system/default.target

#

查看当前的启动运行模式

[[email protected] ~]# systemctl get-default

graphical.target

设置默认启动为多用户字符界面:

[[email protected] ~]# systemctl set-default multi-user.target

rm '/etc/systemd/system/default.target'

ln -s '/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target'

查看默认启动的运行模式:

[[email protected] ~]# systemctl get-default

multi-user.target  字符模式

[[email protected] ~]#

设置默认启动为多用户图形界面:

[[email protected] ~]# systemctl set-default graphical.target

rm '/etc/systemd/system/default.target'

ln -s '/usr/lib/systemd/system/graphical.target' '/etc/systemd/system/default.target'

[[email protected] ~]#

查看默认启动的运行模式:

[[email protected] ~]#systemctl get-default

graphical.target  图形模式

[[email protected] ~]#

从字符界面切换到图形界面:

方法1:执行#startx

方法2:执行#systemctl  isolate graphical.target

总结:可以看到更改默认级别的操作即先删除当前默认配置文件,然后再创建链接文件即可。