Linux Centos7设置默认启动图形界面

阅读(4517)

Centos7下的默认启动方式和之前不同,查看 /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 /usr/lib/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 view current default target, run:
systemctl get-default

To set a default target, run:
systemctl set-default TARGET.target

大意是使用targets取代了原来的runlevels。

获取当前默认启动的方式

systemctl get-default

默认启动图形界面

systemctl set-default graphical.target

设置成功后,会回显类似:

Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.

默认启动终端界面

systemctl set-default multi-user.target
Tags: centos