Assuming system is a Red Hat variant (Debian directions are slightly different) - See U&L Question: How to boot Debian into text mode without using GUI?
Red Hat variants
Rather than remove
gdm you might want to consider running the system in runlevel 3 rather than runlevel 5.
ID Name Description
-- ---- -----------
0 Halt Shuts down the system.
1 Single-user Mode Mode for administrative tasks.
2 Multi-user Mode Does not configure network interfaces
and does not export networks services.
3 Multi-user Mode with Networking Starts the system normally.
4 Not used/User-definable For special purposes.
5 Start the system normally with As runlevel 3 + display manager.
appropriate display manager.
( with GUI )
6 Reboot Reboots the system.
You can see which runlevel a system is in using the command
This is showing you the previous and current runlevels. If there isn't a previous runlevel a
N is substituted in that position.
To change your runlevel you can temporarily do it using the command
telinit <runlevel>, for example:
runlevel now shows this:
To make this change permanent you can edit the file
/etc/inittab and change this line:
$ sudo vim /etc/inittab
Then do a reboot and your system should now be in runlevel 3.
To see if a serivce is configured for given runlevel you can use the command
chkconfig --list | grep ssh
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ssh is setup to start in runlevels 2,3,4, & 5.
On Debian/Ubuntu the location of things is different and the runlevels are different too.
0 - shutdown
1 - single user mode
2 - multiuser graphical mode
6 - reboot
The default runlevel is 2. You can confirm this with the command
The runlevel can be changed with the
To make these changes permanent you can edit the file:
/etc/init/rc-sysinit.conf and change the following line:
$ sudo vim /etc/init/rc-sysinit.conf
sysv-rc-conf can be used from the terminal to interrogate what services are wired to run in a given runlevel. For example:
$ sysv-rc-conf --list|grep rsync
rsync 2:on 3:on 4:on 5:on
Some services aren't going to show up under this, however. Under Debian/Ubuntu the sysV services mechanism is slowly being phased out by a new mechanism called
$ status ssh
ssh start/running, process 928
You can see which runlevel the service will start in like so:
$ initctl show-config ssh
start on (filesystem or runlevel )
stop on runlevel [!2345]