Page 1 of 1

Boot without X?

Posted: 2014/08/03 18:26:41
by altiris
Upgrading my existing Centos 6 box with centos 7 (testing in virtual machine of course). I want to know if it's possible to (after installing centos 7 with gui) make it boot without X or essentially turn it off but still have the ability to turn it back on whenever (reboot being required is fine). Is this possible?

I've bee reading online and many are saying that having a GUI on a server is pretty much unneeded and just uses more system resources. I am beginning to like this idea but I would prefer to have a GUI initially to set up the system, then once it's set up and configured I would like to disable X so that it will just run without a GUI.

Re: Boot without X?

Posted: 2014/08/03 19:54:32
by bertan
Probably you want runlevel 3, except it's not called runlevel 3 any more.

Code: Select all

$ 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
#

Re: Boot without X?

Posted: 2014/08/03 23:17:20
by altiris
Soo, this isnt possible anymore or I need to do something different?

Re: Boot without X?

Posted: 2014/08/03 23:25:01
by bertan
Oh, it is possible, in fact there's a command to do that for you:

Code: Select all

systemctl set-default multi-user.target
See upstream vendor's documentation

Re: Boot without X?

Posted: 2014/08/03 23:27:51
by MIDNITER32
From what I understand, CentOS 7 no longer uses /etc/inittab to configure runlevels, use this to change default runlevels:

http://www.server-world.info/en/note?os ... p=runlevel

Re: Boot without X?

Posted: 2014/08/03 23:33:49
by jenaniston
bertan wrote:... you want runlevel 3, except it's not called runlevel 3 any more.

Code: Select all

$ cat /etc/inittab
...
# To set a default target, run:
#
# ln -sf /lib/systemd/system/<target name>.target /etc/systemd/system/default.target
#
man runlevel . . . "This is a legacy command available for compatibility only.
It should not be used anymore, as the concept of runlevels is obsolete."

but command still gives same output

Code: Select all

# runlevel
N 5
# systemctl get-default
graphical.target
So, to reboot to runlevel 3

Code: Select all

# systemctl set-default multi-user.target
which produces the output:

Code: Select all

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

Centos 7 will then boot into runlevel 3 with that new default set.
Use

Code: Select all

 # systemctl set-default graphical.target
to get back to boot into runlevel 5 again.

I also noticed that this link says that systemd distinguishes between halt (as in # shutdown -h now) and poweroff ?
"so halt without parameters now does exactly what it says - it merely stops the system without turning it off."
https://fedoraproject.org/wiki/Systemd

Re: Boot without X?

Posted: 2014/08/04 04:03:10
by altiris
jenaniston wrote:
bertan wrote:... you want runlevel 3, except it's not called runlevel 3 any more.

Code: Select all

$ cat /etc/inittab
...
# To set a default target, run:
#
# ln -sf /lib/systemd/system/<target name>.target /etc/systemd/system/default.target
#
man runlevel . . . "This is a legacy command available for compatibility only.
It should not be used anymore, as the concept of runlevels is obsolete."

but command still gives same output

Code: Select all

# runlevel
N 5
# systemctl get-default
graphical.target
So, to reboot to runlevel 3

Code: Select all

# systemctl set-default multi-user.target
which produces the output:

Code: Select all

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

Centos 7 will then boot into runlevel 3 with that new default set.
Use

Code: Select all

 # systemctl set-default graphical.target
to get back to boot into runlevel 5 again.

I also noticed that this link says that systemd distinguishes between halt (as in # shutdown -h now) and poweroff ?
"so halt without parameters now does exactly what it says - it merely stops the system without turning it off."
https://fedoraproject.org/wiki/Systemd
Thanks guys for the extra information, I can't try this yet as I am still configuring the CO7 but hopefully it will work.

Re: Boot without X?

Posted: 2017/11/28 15:34:09
by edenCC
This kinda generic topic, like this one https://www.admon.org/faqs/disable-grap ... os7-rhel7/