There are various reasons for installing a full Ubuntu desktop, but wanting to run the system in text-only mode by default. Perhaps your machine is a server, and you want as much RAM available as possible for its server activities. Maybe it’s an LTSP server, which needs all the nice GUI stuff for its clients, but doesn’t need them itself. Or perhaps you just did a standard install and don’t need a GUI that often. Whatever the reason, your goal is to disable GDM, the graphical login manager. Fortunately, this is simplicity itself.
GDM’s configuration is in the file /etc/init/gdm.conf. At the top of this file are two commands that specify when GDM starts, and when it stops. In Lucid Lynx (10.04), these lines look like this:
start on (filesystem and started dbus and (graphics-device-added fb0 PRIMARY_DEVICE_FOR_DISPLAY=1 or drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1 or stopped udevtrigger)) stop on runlevel 
All we need to do, then, is to alter the start criteria. The easiest way is to replace the multi-line start command with this:
start on runlevel 
The runlevel approach tells GDM to start or stop when a given runlevel is entered. And if we give it an empty list on runlevels, it never starts. Simple!