How do I install chkconfig on Ubuntu?

Viewed 158350

I am running Ubuntu 13.10, and I'm pretty new to Linux. I tried:

$ sudo apt-get install chkconfig

Package chkconfig is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'chkconfig' has no installation candidate

I manually downloaded the package and unzipped it. The resulting folder has a file called:

chkconfig.install

But how do I run this? I tried this, but it didn't work.

$ sudo chkconfig.install
9 Answers

Install this package in Ubuntu:

apt install sysv-rc-conf

its a substitute for chkconfig cmd.

After install run this cmd:

sysv-rc-conf --list

It'll show all services in all the runlevels. You can also run this:

sysv-rc-conf --level (runlevel number ex:1 2 3 4 5 6 )

Now you can choose which service should be active in boot time.

The following command do the same on Ubuntu:

systemctl list-dependencies

As mentioned by @jerry you can add services with the below command.

update-rc.d <service> defaults
update-rc.d <service> start 20 3 4 5
update-rc.d -f <service>  remove

To validate them check the above commands you can check /etc/rc*.d/ directory where service start with "k" means it will not execute during the boot and service start with "S" will start during the boot.

# for runlevel symlinks:
ls /etc/rc*.d/

In the below screenshot you can see apache2 starting in runlevel2(S02apache2) and stopping in runlevel1(K01apache2)

enter image description here

enter image description here

You can also check the service status with the below command where "+" means service is in running state "-" is in stopped.

service --status-all

enter image description here

OR

install sysv-rc-conf utility.

apt-get install sysv-rc-conf
example
sysv-rc-conf --level 2345 apach22 on
man sysv-rc-conf
Related