3 replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
source | link

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?How to boot Debian into text mode without using GUI?

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?

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?

2 added debian
source | link

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.

Then do a reboot and your system should now be in runlevel 3.

chkconfig

To see if a serivce is configured for given runlevel you can use the command chkconfig:

chkconfig --list | grep ssh
sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off

So ssh is setup to start in runlevels 2,3,4, & 5.

Debian/Ubuntu variant

On Debian/Ubuntu the location of things is different and the runlevels are different too.

RunLevels

0 - shutdown
1 - single user mode
2 - multiuser graphical mode
6 - reboot

The default runlevel is 2. You can confirm this with the command runlevel:

$ runlevel
N 2

The runlevel can be changed with the telinit command:

telinit 3

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
env DEFAULT_RUNLEVEL=2

sysv-rc-conf

The tool 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 upstart.

$ status ssh
ssh start/running, process 928

You can see which runlevel the service will start in like so:

$ initctl show-config ssh
ssh
  start on (filesystem or runlevel [2345])
  stop on runlevel [!2345]

Rather than remove gdm you might want to consider running the system in runlevel 3 rather than runlevel 5.

Then do a reboot and your system should now be in runlevel 3.

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.

Then do a reboot and your system should now be in runlevel 3.

chkconfig

To see if a serivce is configured for given runlevel you can use the command chkconfig:

chkconfig --list | grep ssh
sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off

So ssh is setup to start in runlevels 2,3,4, & 5.

Debian/Ubuntu variant

On Debian/Ubuntu the location of things is different and the runlevels are different too.

RunLevels

0 - shutdown
1 - single user mode
2 - multiuser graphical mode
6 - reboot

The default runlevel is 2. You can confirm this with the command runlevel:

$ runlevel
N 2

The runlevel can be changed with the telinit command:

telinit 3

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
env DEFAULT_RUNLEVEL=2

sysv-rc-conf

The tool 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 upstart.

$ status ssh
ssh start/running, process 928

You can see which runlevel the service will start in like so:

$ initctl show-config ssh
ssh
  start on (filesystem or runlevel [2345])
  stop on runlevel [!2345]
1
source | link

Rather than remove gdm you might want to consider running the system in runlevel 3 rather than runlevel 5.

RunLevels

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 runlevel:

$ runlevel
N 5

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:

telinit 3

Re-running runlevel now shows this:

$ runlevel
5 3

To make this change permanent you can edit the file /etc/inittab and change this line:

$ sudo vim /etc/inittab
id:3:initdefault:

Then do a reboot and your system should now be in runlevel 3.