CentOS 7.x 更改預設的執行層級

之前的 CentOS Linux 要更改預設的執行層級,是在 /etc/inittab 中設定
但在 CentOS 7.x 中有稍許的不同
# cat /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 name>.target /etc/systemd/system/default.target
#
[@more@]目前的執行層級
# ll /etc/systemd/system/default.target
lrwxrwxrwx. 1 root root 37  7月 10 19:24 /etc/systemd/system/default.target -> /lib/systemd/system/multi-user.target

# ll /lib/systemd/system/multi-user.target
-rw-r–r–. 1 root root 524  6月 10 13:35 /lib/systemd/system/multi-user.target

改成圖形模式
# ln -fs /lib/systemd/system/graphical.target /etc/systemd/system/default.target

# ll /etc/systemd/system/default.target
lrwxrwxrwx. 1 root root 37  7月 12 19:24 /etc/systemd/system/default.target -> /lib/systemd/system/graphical.target