You can prevent automatic running of the GUI by disabling your login manager be it KDM, GDM or XDM from running at boot time. To disable the login manager from automatically running at boot up, do
#update-rc.d -f gdm remove
Replace gdm with kdm or xdm if they are what you use.
To start X manually, you would then have to login at the command prompt and enter the command startx.
To reset your login manager so that it runs at boot up, do
#update-rc.d -f gdm defaults
To install xwindows environment:
apt-get install xorg synaptic kdm kde