Howto Install Gnome/KDE Desktop in CentOS 5

A typical GNU/Linux installation for server doesn't really need a GUI, however if you need a GUI in the future for some reasons, its easy to install. This tutorial assumes a basic knowledge of the Linux Command Line. This tutorial applies to CentOS and other Red Hat-based distro.

Type this command

yum grouplist

and look for X Window System, GNOME Desktop Environment and KDE (K Desktop Environment) in the list.

Setting up Group Process
Setting up repositories
yumgroups.xml             100% |=========================| 558 kB    00:21
yumgroups.xml             100% |=========================| 4.6 kB    00:00
Installed Groups:
   Administration Tools
   Compatibility Arch Support
   DNS Name Server
   FTP Server
   Mail Server
   MySQL Database
   Server Configuration Tools
   Text-based Internet
   Web Server
   Windows File Server
Available Groups:
   AptRPM
   Authoring and Publishing
   Compatibility Arch Development Support
   Development Tools
   Editors
   Engineering and Scientific
   GNOME Desktop Environment
   GNOME Software Development
   Games and Entertainment
   Graphical Internet
   Graphics
   Horde-Apps
   KDE (K Desktop Environment)
   KDE Software Development
   Legacy Network Server
   Legacy Software Development
   Network Servers
   News Server
   Office/Productivity
   PostgreSQL Database
   Printing Support
   Sound and Video
   System Tools
   X Software Development
   X Window System
   XFCE-4.2
   drbd-heartbeat
Done

To install Gnome Desktop type this

yum groupinstall "X Window System" "GNOME Desktop Environment"

and for KDE Desktop

yum groupinstall "X Window System" "KDE (K Desktop Environment)"

Change this line in /etc/inittab

id:3:initdefault:

to

id:5:initdefault:

If you install both Gnome and KDE, the default Desktop will be Gnome. If you want to change your default desktop from Gnome to Kde, open the /etc/sysconfig/desktop file:

vi /etc/sysconfig/desktop

and set DESKTOP variable to KDE:

DESKTOP="KDE"
DISPLAYMANAGER="KDE" 

To switch desktop, run this command:

switchdesk kde

Have Fun!