Home > Package & System Management > chkconfig

chkconfig: System Service Runlevel Management

chkconfig is a utility used to manage the runlevels at which services start during boot on systems using System V init scripts. This command allows you to configure services to start or stop at specific runlevels, providing fine-grained control over system boot behavior.

Overview

chkconfig controls the start and stop behavior of services in the System V init system. You can set the status of a service for each runlevel (0-6), playing a crucial role in determining which services are enabled during system boot.

Key Features

The key features of chkconfig are as follows:

  • Management of service enablement/disablement per runlevel
  • Querying the list and status of registered services on the system
  • Adding and removing new System V init script services

Key Options

These are the main options used with the chkconfig command.

Querying Service Status

Enabling/Disabling Services

Adding/Deleting Services

Generated command:

Try combining the commands.

Description:

`chkconfig` Executes the command.

Combine the above options to virtually execute commands with AI.

Usage Examples

Practical examples of using the chkconfig command.

Check runlevel status for all services

chkconfig --list

Checks the enablement/disablement status of all registered services and their respective runlevels on the system.

Check runlevel status for a specific service (httpd)

chkconfig --list httpd

Checks which runlevels the httpd service is enabled in.

Enable httpd service on default runlevels

chkconfig httpd on

Configures the httpd service to start on the system's default multi-user runlevels (typically 2, 3, 5).

Enable httpd service only on runlevels 3 and 5

chkconfig --level 35 httpd on

Configures the httpd service to start only on specific runlevels (here, 3 and 5).

Disable httpd service on all runlevels

chkconfig httpd off

Configures the httpd service to not start automatically on any runlevel.

Add a new init script service

chkconfig --add myservice

Adds the /etc/init.d/myservice script to the chkconfig management list. The script file must exist beforehand.

Installation

chkconfig is primarily provided by default on Red Hat-based (RHEL, CentOS, Fedora) Linux distributions. On other distributions, especially Debian/Ubuntu-based systems, chkconfig is not available by default, and commands like update-rc.d or systemctl should be used instead.

Red Hat-based systems (RHEL, CentOS, Fedora)

sudo yum install chkconfig
# Or on newer versions:
sudo dnf install chkconfig

On Red Hat-based systems, you can install chkconfig using the following command. In most cases, it is already installed.

Tips & Notes

Useful tips and points to note when using chkconfig.

Comparison with systemd

In modern Linux distributions, systemd is increasingly adopted as the default init system instead of System V init. In systemd environments, the systemctl command is used instead of chkconfig.

  • chkconfig: Service management in System V init systems
  • systemctl: Service management in systemd systems (modern alternative)

Understanding Runlevels

Linux runlevels define the operating modes of the system. To effectively use chkconfig, it's important to understand the meaning of each runlevel.

  • Runlevel 0: System halt
  • Runlevel 1: Single-user mode
  • Runlevel 2: Multi-user mode (no networking)
  • Runlevel 3: Multi-user mode (text-based, networking enabled)
  • Runlevel 4: Unused (can be user-defined)
  • Runlevel 5: Multi-user mode (graphical environment, networking enabled)
  • Runlevel 6: System reboot

Caution

Incorrectly configuring critical system services can lead to system boot issues or security vulnerabilities. It is always recommended to carefully review changes before applying them and to perform backups if necessary.


Same category commands