How to Install Gnome/KDE Desktop in Debian Sarge

There are two available X Window system in Debian Sarge.

Using XFree86

Run this command in the console to install XFree86:

apt-get update
apt-get install xserver-xfree86 xbase-clients xfonts-base xterm

or you can run this command

apt-get install x-window-system

Using Xorg

To install Xorg you need to enable backports repository. Add this line in your /etc/apt/source.list

deb sarge-backports main
apt-get update
apt-get install -t sarge-backports xserver-xorg xbase-clients xfonts-base xterm

Then install a Window Manager like KDE or Gnome, its up to you what to install or you can install both.

To install Gnome Desktop

apt-get install gnome gdm gdm-themes

However you can try also minimal version of Gnome

apt-get install gnome-core gdm gdm-themes

Same also with installing KDE

apt-get install kde kdm

apt-get install kde-core kdm

Configuring X Window System

Configuring Xfree86

dpkg-reconfigure xserver-xfree86

Configuring Xorg

dpkg-reconfigure xserver-xorg

To start your X Window System type

/etc/init.d/gdm start

/etc/init.d/kdm start

How to switch between kdm or gdm?

dpkg-reconfigure gdm

Then select which display manager to use.