Debian Lenny comes with KDE 3.5.10 and GNOME 2.22, and will install by default the entire GNOME desktop environment and the X Window System. This means many applications which you may never use will also be installed, so here is a solution in order to get only a basic system and then install only the packages you need.
This tutorial will briefly show what you have to do in order to have a basic and minimum Debian installation on your PC.
First, when the installer reaches the window where it asks what software you want to install (like Desktop Environment, Web Server, Basic System etc.), just de-select the Desktop Environment option using the SPACE key, and also make sure the Basic System option remains selected.
After the installation is over, Debian will ask to reboot the computer, then it will boot to a shell login. Login as root, then type the following commands in order to only get the core packages for the X Window System and your desktop environment of choice:
If you want GNOME, type:
apt-get install xserver-xorg-core gdm gnome-core
If you want KDE, type:
apt-get install xserver-xorg-core kdm kde-core
Either of those commands will only install a minimum needed for running Debian graphically, so you will be able after that to install only the applications which you actually need.
gdm and kdm stand for GNOME Display Manager and, respectively, K Display Manager and they are, as the name suggests, the login applications for GNOME and KDE. gnome-core and kde-core will only fetch and install the basic libraries and applications needed to run GNOME and, respectively, KDE. This means that in KDE, for example, only applications like KControl, Kate or Konqueror (but not applications like noatun or kdegames) will be installed. You then get to choose which image viewer, music and video players will install.
Next, to start the X Server, use one of the commands as root:
If you installed GNOME and GDM:
If you installed KDE and KDM:
If the X server fails to start, try, as root:
And specify the driver vesa in section Device inside the /etc/X11/xorg.conf file. You may need to install the specific video driver for your video card.
Notice that you can also install any other (read: lighter) desktop environments, like Xfce or even Enlightenment for example.
Notice: This is a later, revised version of the tutorial I initially posted here.