4 System Startup: Where are the run-levels?

Linux® uses the SysV init system, whereas FreeBSD uses the traditional BSD-style init(8). Under the BSD-style init(8) there are no run-levels and no /etc/inittab, instead startup is controlled by the rc(8) utility. The /etc/rc script reads /etc/defaults/rc.conf and /etc/rc.conf to determine which services are to be started. The specified services are then started by running the corresponding service initialization scripts located in /etc/rc.d/ and /usr/local/etc/rc.d/. These scripts are similar to the scripts located in /etc/init.d/ on Linux systems.

Services are enabled by specifying ServiceName_enable="YES" in /etc/rc.conf (rc.conf(5)). Take a look at /etc/defaults/rc.conf for the system defaults, these default settings are overridden by settings in /etc/rc.conf. Also, when installing additional applications be sure to review the documentation to determine how to enable any associated services.

The following snippet from /etc/rc.conf enables sshd(8) and Apache 2.2. It also specifies that Apache should be started with SSL.

# enable SSHD
sshd_enable="YES"
# enable Apache with SSL
apache22_enable="YES"
apache22_flags="-DSSL"

Once a service has been enabled in /etc/rc.conf, the service can be started from the command line (without rebooting the system):

# /etc/rc.d/sshd start

If a service has not been enabled it can be started from the command line using forcestart:

# /etc/rc.d/sshd forcestart