天天看點

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

總結:可以看到更改預設級别的操作即先删除目前預設配置檔案,然後再建立連結檔案即可。