SysV init runlevel 的目的是在不同的方式下使用系统。例如,X Window 系统占用一定的系统资源,没有它的话,服务器的运行效率会更高。或者,有时候系统管理员需要在一个更低的运行级别下来执行某些诊断任务,如在运行级别 1 下修复磁盘。
给定运行级别的特征决定了 init
启动和停止哪些服务。例如,运行级别 1(单用户模式)停止所有的网路服务,而运行级别 3 则会启动这些服务。通过在某个运行级别下设定启动和停止的服务,init
可以快速地改变机器运行的模式而不需要用户手工停止和启动服务。
The following runlevels are defined by default under Fedora:
In general, users operate Fedora at runlevel 3 or runlevel 5 — both full multi-user modes. Users sometimes customize runlevels 2 and 4 to meet specific needs, since they are not used.
系统的缺省运行级别在 /etc/inittab
里定义。要找到系统的缺省运行级别,可以在 /etc/inittab
靠顶部的地方找如下的一行:
id:5:initdefault:
如第一个分号后所指出的,这个例子里的缺省运行级别是 5。要改变它,可以根用户来编辑 /etc/inittab
。
Warning
编辑 /etc/inittab
要非常小心。简单的输入错误就可以导致系统不能启动。如果发生了这样的事情,可以使用启动软盘,进入单用户模式,或者进入救援模式来引导系统并修复这个文件。
For more information on single-user and rescue mode, refer to the chapter titled Basic System Recovery in the Red Hat Enterprise Linux Deployment Guide.