How do I install chkconfig on Ubuntu?
Categories:
Installing and Using chkconfig on Ubuntu

Learn how to install and use the chkconfig utility on Ubuntu, a tool commonly found on RHEL/CentOS for managing system services.
While chkconfig
is a staple utility for managing services and runlevels on Red Hat-based systems like CentOS and Fedora, it is not natively available on Debian-based distributions such as Ubuntu. Ubuntu primarily uses systemd
(or Upstart
in older versions) for service management. However, there are scenarios where you might encounter documentation or scripts that assume the presence of chkconfig
. This article will guide you through installing a compatible version of chkconfig
on Ubuntu and explain how to use it, along with its systemd
equivalents.
Why chkconfig on Ubuntu?
The primary reason to install chkconfig
on Ubuntu is compatibility. If you're migrating scripts or configurations from a RHEL/CentOS environment, or if you're working with legacy applications that expect chkconfig
to be present, having it can simplify your workflow. It provides a familiar interface for those accustomed to its syntax, even though systemd
offers more powerful and granular control.
flowchart TD A[User needs chkconfig on Ubuntu] --> B{Why?} B --> C[Compatibility with RHEL/CentOS scripts] B --> D[Familiarity for users from RHEL/CentOS] C --> E[Install chkconfig-sysv] D --> E E --> F[Use chkconfig or systemctl] F --> G{Service Management}
Decision flow for installing chkconfig on Ubuntu
Installation of chkconfig on Ubuntu
Ubuntu provides a package called chkconfig-sysv
which emulates the functionality of the original chkconfig
for System V init scripts. While systemd
is the default init system, this package allows you to use chkconfig
commands for services that still rely on traditional init scripts or for a consistent command-line experience.
1. Update Package Lists
Before installing any new packages, it's good practice to update your local package index.
2. Install chkconfig-sysv
Use apt
to install the chkconfig-sysv
package. This package provides the chkconfig
command.
3. Verify Installation
After installation, you can verify that chkconfig
is available and check its version.
sudo apt update
sudo apt install chkconfig-sysv
chkconfig --version
Commands to install and verify chkconfig-sysv on Ubuntu
chkconfig-sysv
package primarily interacts with System V init scripts. For services managed directly by systemd
, it's generally recommended to use systemctl
for full control and better integration.Using chkconfig and its systemd Equivalents
Once installed, chkconfig
can be used to list services and manage their runlevel configurations. However, for modern Ubuntu systems, systemctl
is the native and more powerful tool. Below, we'll compare common chkconfig
commands with their systemd
counterparts.
List all services
# chkconfig
chkconfig --list
# systemctl
systemctl list-unit-files --type=service
Check service status
# chkconfig (less direct, shows runlevel config)
chkconfig --list <service_name>
# systemctl (shows active status)
systemctl status <service_name>
Enable service at boot
# chkconfig
chkconfig <service_name> on
# systemctl
systemctl enable <service_name>
Disable service at boot
# chkconfig
chkconfig <service_name> off
# systemctl
systemctl disable <service_name>
Start a service
# chkconfig (does not directly start/stop)
# Use service command or systemctl
# systemctl
systemctl start <service_name>
Stop a service
# chkconfig (does not directly start/stop)
# Use service command or systemctl
# systemctl
systemctl stop <service_name>
chkconfig-sysv
provides a compatibility layer, it's crucial to understand that it primarily manages System V init scripts. For services that are native systemd
units, systemctl
is the authoritative and recommended tool for management. Mixing chkconfig
and systemctl
for the same service can lead to unexpected behavior or configuration conflicts.In summary, while chkconfig
can be installed on Ubuntu for compatibility reasons, systemctl
remains the preferred and more powerful tool for managing services on modern Ubuntu systems. Understanding both can be beneficial, especially in mixed environments or when dealing with legacy configurations.