Install, Remove & Autostart X Window System on CentOS

If you need to add X to the server after install or you installed from the Server ISO and it didn't install X, how do you install X?

Install X Window and Gnome or KDE Desktop on Centos with Yum

The easiest way to install X (and a GUI system) is to use the `yum groupinstall` feature. First you can see all the yum groups available with the command:
yum grouplist
You can install X and Gnome like this:
yum groupinstall "X Window System" "GNOME Desktop Environment"
or for KDE:
yum groupinstall "X Window System" "KDE (K Desktop Environment)"
You may also want to add some other groups from the list like "Graphical Internet" or "Office/Productivity"
NoteNote
Pay close attention to capitalization as Yum is case sensitive e.g. "Gnome desktop environment" won't work.

In some versions of RHEL and Centos 5.x prior to 5.3c, there is a bug that will report a missing dependency error for libgaim.

You can get around this error by adding the following to the end of yum command mentioned above.

--exclude nautilus-sendto

To remove the desktop environment type:
yum groupremove "X Window System" "GNOME Desktop Environment"

Manually start the X server

Two ways:
1. become root and restart xdm:
su / password
/etc/init.d/xdm restart"
2. As a normal user, type:
startx

Configure CentOS for Graphical X11 from Multiuser Mode on Boot

On startup, if CentOS displays the command prompt rather than automatically starting up X Windows, you can configure CentOS to start up in whatever mode you want including graphical mode by editing the file /etc/inittab. To change the startup mode of CentOS open that file with a text editor.

nano /etc/inittab

The file should look like the following:
# Default runlevel. The runlevels used by RHS 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:
(Partial file listing)

As you can see, the comments at the top of the file show the number-to-mode mapping. All you need you do is change the number in the last line listed above. So changing the 3 to a 5 will automatically startup X Server.
id:5:initdefault:

1 comment:

  1. fyi, "X window system" does not show up anymore with grouplist on centos 7

    ReplyDelete