Ubuntu and Debian
There are several ways to make the system boot to a tty prompt without
starting X. The most direct way is to edit the file
/etc/X11/default-display-manager
and comment out the "/usr/sbin/gdm" or equivalent "kdm" line . Substitute
"false" without quotes. You could also simply clobber it with
echo "false" | sudo tee /etc/X11/default-display-manager
You can edit /etc/inittab file to set custom runlevel for your system.