update-rc.d like command on Redhat Enterprise / CentOS Linux

Q. I’m using Debian Linux for last 4 years. I’m not able to find out update-rc.d like command ( install and remove System-V style init script links) on Redhat enterprise Linux (RHEL 5). Can you specify equivalent command for the same task?

A. update-rc.d updates the System V style init script links /etc/rcrunlevel.d/NNname whose target is the script /etc/init.d/name. These links are run by init when it changes runlevels; they are generally used to start and stop system services such as daemons. runlevel is one of the runlevels supported by init, namely, 0123456789S, and NN is the two-digit sequence number that determines where in the sequence init will run the scripts. Please note that this program was designed for use in package maintainer scripts and, accordingly, has only the very limited functionality required by such scripts. System administrators are not encouraged to use update-rc.d to manage runlevels. They should edit the links directly or use runlevel editors such as sysv-rc-conf and bum instead.

Under RHEL / CentOS you use command called ntsysv or chkconfig.

Redhat ntsysv tool

ntsysv is a simple interface for configuring runlevel services which are also configurable through chkconfig. By default, it configures the current runlevel. Just type ntsysv and select service you want to run:
# ntsysv

(Fig.01: ntsysv in action under Red Hat Linux)

Redhat chkconfig tool

chkconfig provides a simple command-line tool for maintaining the /etc/rc[0-6].d directory hierarchy by relieving system administrators of the task of directly manipulating the numerous symbolic links in those directories. chkconfig has five distinct functions: adding new services for management, removing services from management, listing the current startup information for services, changing the startup information for services, and checking the startup state of a particular service.

Add service called foo

This option adds a new service for management by chkconfig:
# chkconfig --add foo

Delete service called foo

The service is removed from chkconfig management, and any symbolic links in /etc/rc[0-6].d which pertain to it are removed:
# chkconfig --del foo

List status for foo service

This option lists all of the services which chkconfig knows about, and whether they are stopped or started in each runlevel.
# chkconfig --list foo

Turn on or off services:
# chkconfig foo on
# chkconfig foo off
# chkconfig --level 2 foo on

Note that –level 35 specifies run levels 3 and 5, so following will turn on httpd service for 3 and 5 only:
# chkconfig --level 35 httpd on

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 4 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
4 comments… add one
  • Tam Scollard Oct 4, 2010 @ 1:38

    What a excellent design you have. your weblog posts are pretty helpful too! Thank you :-D

  • LAHMAM Mostafa Feb 11, 2011 @ 16:11

    I need to have how ta update ‘rc.d’; why?
    I m working on Centos5 and I have to execute the following commands:
    # ln -s /etc/init.d/abi /etc/rc2.d/S99abi
    #update-rc.d abi defaults 99

    The ‘abi’ is script written by Malcom A. Hussain-Gambles,William C. House
    I have try to use a ‘ntsysv’ but I dont no wish service to act.

    Can you help for this matter
    Best Regards


    • Ivan Apr 9, 2014 @ 15:12

      Hello LAHMAM. I’m thinking that maybe you could try adding ‘chkconfig –add abi’ to /etc/rc.local or ‘chkconfig –add [full_path_to_abi_script]. If you don’t want any service to be added, you could try placing full_path_to_abi_script/abi_script_file_name into /etc/rc.local. Script needs to have +x permissions.

      Hope that helps. Let me know.

  • Axel Mar 13, 2013 @ 15:21

    Your save me!!!. Thanks for the post.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum