- Linux smart help
- Disable X Windows at System Boot
- Delete X Windows from the Server
- How do I disable X at boot time so that the system boots in text mode?
- 16 Answers 16
- For systems that use systemd
- How to disable X Windows in Linux
- Surendra Anne
- Latest posts by Surendra Anne (see all)
- Disable GUIs and X Windows on Linux VMs
- Share this:
Linux smart help
I revived my new Dell server pre installed with Red Hat Enterprise Linux server v5.2. However, my box boot with a GUI login system ( Gnome ). There is no reason to run X Windows on my dedicated mail and Apache web server. I only need ssh. How do I disable X login and windows without reinstalling the operating system to improve security and performance?
CentOS / RHEL 5.x / Fedora Linux comes with X Windows system called X.org. The X Window System implementation included with the system is called X.org. There is no need to run X on a dedicated server such as web server or mail server or file server. Root (admin) user can login via SSH or on the text console (or may be using KVM).
Disable X Windows at System Boot
The /etc/inittab file describes which processes are started at bootup and during normal operation. This file is used to start X windows system at boot by setting default run level to 5. Edit the file /etc/inittab using a text editor such as vi, enter:
# vi /etc/inittab
Find line:
Save and close the file. Restart the server. You can also drop to text mode by typing init command:
# init 3
Delete X Windows from the Server
To remove the X11 RPMs (all packages) from the server, enter:
# yum groupremove «X Window System»
Above will remove 100-150 packages from the server. This make sure no one can start X on server by typing startx at the shell prompt. This will result into more secure system. Since, your box is dedicated server for web or mail serving, it is safe to delete the X.org software from the system.
How do I disable X at boot time so that the system boots in text mode?
Is it possible to disable X at boot time? I’m setting up a server so it would be nice if it wouldn’t load the graphical interface every time I boot.
On the GDM login screen of 11.04 and earlier, I think there was an xterm session option that would just give you a command line. Alternatively, you may be able to reach something from a recovery option in GRUB, though you probably wouldn’t be able to set it as a default that way.
16 Answers 16
Edit /etc/default/grub with your favourite editor, e.g. nano :
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="text"
For systems that use systemd
This is an additional step for systemd releases, e.g. Ubuntu 15.04, the steps above for grub are still necessary.
You need to tell systemd to not load the graphical login manager:
sudo systemctl enable multi-user.target --force sudo systemctl set-default multi-user.target
You will still be able to use X by typing startx after you logged in.
That works for lightdm, this works for any graphical login manager? This is the proper way of loading a Linux system without loading a X server? Just seems more logical? Choose one. 🙂
Since the question is made for Ubuntu and not the mobile platform (can you even change anything in the mobile version of Ubuntu? Why would that be a good thing? I am guessing you would be locked to a prompt that knows nothing about keyboard input and accepts fancy finger touches and gestures :P) I am assuming we are talking about Ubuntu, the desktop Linux based operative system that I love and can modify to my needs. 🙂 But you are right, there is a semantics issue with the title of the post, feel free to edit it to something more proper! Thanks for the comments.
@Joyce first run systemctl get-default to find out what is the current run-level name and remember its name then use systemctl set-default multi-user.target to change it to «multi-user.target» or run these equals commands instead and see the changes. rm ‘/etc/systemd/system/default.target’ then ln -s ‘/usr/lib/systemd/system/multi-user.target’ ‘/etc/systemd/system/default.target’ . If the issue is still exist redo the default run-level that you remember it via systemctl set-default RunLevelName .
How to disable X Windows in Linux
This is a small how to on how to disable xwindows(GUI) on Redhat/Fedora/Centos server in order to escape from loop holes in x windows, and unused x windows. Most of the time on servers we never use XWindows to manage server. So there is no need to have it installed or set the default run level to 5. In this post we will see how to set the default runlevel to 3.
Step1: Login to the server and open /etc/inittab
Vi /etc/inittab
Step2: Search for id:5:initdefault: and replace it with id:3:initdefault:
Step3: Now save the file and reboot the machine, the system will permanently set 3 as default run level and there will be no gui.
Surendra Anne
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container — June 30, 2020
- Anisble: ERROR! unexpected parameter type in action: Fix — June 29, 2020
- FREE: JOIN OUR DEVOPS TELEGRAM GROUPS — August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) — August 27, 2018
- How to use ohai/chef-shell to get node attributes — July 19, 2018
Disable GUIs and X Windows on Linux VMs
I remember an old story about people having performance issues on their Windows servers. It would happen intermittently, and never when the system administrator was around. Turns out it was the pretty OpenGL screensaver, which would kick in and slow everything down tremendously. When the admin was around he’d be using the console of the server, so no screen saver, and no problems.
Graphical user interfaces make one-off administration tasks easier in some cases, but for virtual environments they come at a cost: additional RAM and CPU overhead. For a virtual environment you should shut them off, or install as little of them as you need, and only run them when you need them.
To disable the GUI from automatically starting at boot change this line in /etc/inittab from:
That way, on boot you’ll enter runlevel 3, which is full multiuser operations but no GUI (runlevel 5 is full multiuser with GUI). You can then start the GUI from the command line with the command ‘startx’ and exit by pressing Ctrl-Alt-Backspace.
Not so bad, eh? But don’t leave it running, and don’t use a fancy screensaver. 🙂
I started calling this series “Tuningmas” as a play on the fact I’m doing it in December and the Christian religious holiday that is nearby, temporally. Did you know that the word “Christmas” is a compound word that means “Christ’s Mass?” Until recently I hadn’t thought about it. Unlike most religious masses I encourage you to comment, especially if you see I’ve missed something, have made a mistake, or there’s something new since I posted this. There’s nothing holy about this blog, for sure. 🙂