Tuesday, August 18, 2009

Linux Disable and Remove X Windows (X.org)

SkyHi @ Tuesday, August 18, 2009
Linux Disable and Remove X Windows (X.org)

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:

id:5:initdefault:

Replace with:

id:3:initdefault:

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.


Reference: http://www.cyberciti.biz/faq/centos-rhel-fedora-linux-disable-remove-x-windows-org/