CentOS-7设置开机进入文本界面(不进入图形界面)
默认CentOS-7安装完毕后会进入图形界面,曾尝试如同CentOS-6那样直接设置/etc/inittab文件:
# Default runlevel. The runlevels used are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:
但是发现在CentOS-7中虽然有这个文件,但是貌似和CentOS-6看起来不一样啊:
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# ll /etc/inittab
-rw-r--r--. 1 root root 511 Nov 19 2015 /etc/inittab
[root@localhost ~]# 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 /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
#
并没有设置级别的地方。
其实在CentOS-7中可以通过命令设置启动直接进入文本界面而不进入图形界面:
[root@localhost ~]# which systemctl
/usr/bin/systemctl
相关用法自己可以 man systemctl,这里不赘述啦~毕竟别跑离了主题,哈~
以下是具体设置的方式:
[root@localhost ~]# systemctl get-default
graphical.target
[root@localhost ~]# systemctl set-default multi-user.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.
[root@localhost ~]# systemctl get-default
multi-user.target
使用systemctl get-default可以获得当前的默认target;
使用systemctl set-default可以设置默认target,target可以是graphical.target、multi-user.target。
恩,基本就这些啦,重启下就直接进入文本界面啦。