4. System Startup

Many Linux® distributions use 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 /etc/inittab does not exist. Instead, startup is controlled by rc(8) scripts. At system boot, /etc/rc reads /etc/rc.conf and /etc/defaults/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.

The scripts found in /etc/rc.d/ are for applications that are part of the base system, such as cron(8), sshd(8), and syslog(3). The scripts in /usr/local/etc/rc.d/ are for user-installed applications such as Apache and Squid.

Since FreeBSD is developed as a complete operating system, user-installed applications are not considered to be part of the base system. User-installed applications are generally installed using Packages or Ports. In order to keep them separate from the base system, user-installed applications are installed under /usr/local/. Therefore, user-installed binaries reside in /usr/local/bin/, configuration files are in /usr/local/etc/, and so on.

Services are enabled by adding an entry for the service in /etc/rc.conf . The system defaults are found in /etc/defaults/rc.conf and these default settings are overridden by settings in /etc/rc.conf. Refer to rc.conf(5) for more information about the available entries. When installing additional applications, review the application's install message to determine how to enable any associated services.

The following entries in /etc/rc.conf enable sshd(8), enable Apache 2.4, and specify that Apache should be started with SSL.

# enable SSHD
# enable Apache with SSL

Once a service has been enabled in /etc/rc.conf, it can be started without rebooting the system:

# service sshd start
# service apache24 start

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

# service sshd onestart

All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.
Send questions about this document to <freebsd-doc@FreeBSD.org>.