Linux Disable and Remove X Windows (

by on July 18, 2009 · 12 comments· LAST UPDATED July 18, 2009

in , ,

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 The X Window System implementation included with the system is called 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:


Replace with:


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 software from the system.

Tweet itFacebook itG+ itDownload PDF versionFound an error/typo on this page?

{ 12 comments… read them below or add one }

1 Trey Blancher July 18, 2009 at 3:37 pm

This is useful for Red Hat based systems. How do I achieve the same for Debian based systems such as Debian and Ubuntu? I understand I could remove it, but what if I need to disable it and not remove it?


2 nixCraft July 18, 2009 at 3:45 pm

@ Trey
Debian use /etc/rc2.d/*gdm or /etc/rc2.d/*kdm or /etc/rc2.d/*xdm to start GUI on a boot. All you’ve to do is move those files to somehwer else and you are done. You can also use

update-rc.d gdm remove < == get rid of Gnome
update-rc.d xdm remove <== get rid of Kde
update-rc.d kdm remove <== get rid of other Xdm

Reboot the server to test the changes. See this FAQ for more info.

Hope this helps.


3 Trey Blancher July 18, 2009 at 8:13 pm

OK, I guess I knew that, but I wasn’t sure it was that simple. Thanks for the clarification.


4 benzm July 18, 2009 at 10:43 pm

this is good, but I get an error on an internal centos box that states “No group names X Window System exists” please let me know what I am doing wrong.

Centos 5.2 updated a short while ago on an old P4 with lotsa ram and lotsa diskspace. : )


5 Skip Flem July 19, 2009 at 1:19 am

update-rc.d kdm remove <== get rid of Kde
update-rc.d xdm remove <== get rid of other Xdm
update-rc.d xdm remove <== get rid of other Xdm
update-rc.d kdm remove <== get rid of Kde


6 Solaris July 20, 2009 at 8:01 am

Vivek what about this situation: I have a server where users work remotely on Gnome, so
I had to manually add xorg and gnome-core and gdm – I was highly recommended to add gdm to avoid the Gnome policy kit hell.

This was done on a Ubuntu server 8.04 64 bit and is working fine.

But when it boots I would like to see the text flowing not the gdm, any idea of how to achive this without removing gdm ?


7 nixCraft July 20, 2009 at 8:38 am

@ Solaris,

Simply use update-rc.d or rcconf command to delete gdm service. It will not remove GDM but it will just disable it on boot. To remove GDM and you need to use apt-get.


8 Susinthiran July 22, 2009 at 11:14 am

Again we see how skillful you are on Redhat based systems :)



9 Danny July 23, 2009 at 7:23 pm

Some of those X libraries are useful to command-line programs, though. Like glib, for example, or GD. A web server is likely to use a lot of graphics libraries which may have been linked to X11, and I personally like to have an xterm available for remote management (why would I emulate one when I’ve got the real thing?). So, don’t be shocked if some of the stuff from the X Windows System group needs to be put back, depending on what’s actually being served. At least yum should prevent admins from breaking stuff… :)

PS – I’ve always used telinit to change runlevels, even though they’re really the same program…


10 M.S. Babaei August 1, 2009 at 3:28 am

I love the gentoo way:
emerge -C x11-base/xorg-x11 x11-base/xorg-server

also in gentoo runlevel 3-5 is called default and it’s the same:
u can simply run:
rc-update del xdm default


11 sam November 16, 2011 at 2:52 am

thanks a bunch.


12 Subhendu July 12, 2013 at 11:49 am

Thanks buddy,
Nice instruction for disable X11 for security and performance.


Leave a Comment

Tagged as: , , , , , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: