CentOS6 and CentOS7 boot automatic start service method

Centos6 and Centos7 start up service automatically

< div class="content-detail unsafe markdown-body" data-spm-anchor-id="a2c4e.11153940.0.i7.388d3030RAXT2V">

Let’s talk about the easy way to start the service automatically when Centos6 and Centos7 boot, I use yum install It is installed directly, so it is different from the self-compilation method. I only talk about the self-starting service method after the rpm package is installed;

Centos6: For the Centos6 system, use the chkconfig command directly .

For example, we take nginx service as an example:

#chkconfig –add nginx add nginx service

#chkconfig nginx on boot from Start nginx service

#chkconfig nginx off Turn off self-startup

#chkconfig –list | grep nginx view

Centos7: For Centos7 system, just use enable directly.

Example:

#systemctl enable nginx.service start nginx service after booting

#systemctl disable nginx.service disable nginx.service disable boot

Here is just taking nginx as an example, of course it also applies to other services.

Let’s talk about the simple way to start the service automatically when Centos6 and Centos7 are booted. I installed it directly with yum install, so it is different from the self-compilation method. I only talk about the self-starting service after the rpm package is installed. Method;

Centos6: For Centos6 system, just use the chkconfig command directly.

For example, we take nginx service as an example:

#chkconfig –add nginx add nginx service

#chkconfig nginx on boot from Start nginx service

#chkconfig nginx off Turn off self-startup

#chkconfig –list | grep nginx view

Centos7: For Centos7 system, just use enable directly.

Example:

#systemctl enable nginx.service start nginx service after booting

#systemctl disable nginx.service disable nginx.service disable boot

Here is just taking nginx as an example, of course it also applies to other services.

Let’s talk about the simple way to start the service automatically when Centos6 and Centos7 boot. I installed it directly with yum install, so it is different from the self-compilation method. I only talk about rpm here. The method of self-starting service after package installation;

Centos6: For Centos6 system, just use the chkconfig command directly.

For example, we take nginx service as an example:

#chkconfig –add nginx add nginx service

#chkconfig nginx on boot from Start nginx service

#chkconfig nginx off Turn off self-startup

#chkconfig –list | grep nginx view

Centos7: For Centos7 system, just use enable directly.

Example:

#systemctl enable nginx.service start nginx service after booting

#systemctl disable nginx.service disable nginx.service disable boot

Here is just taking nginx as an example, of course it also applies to other services.

Leave a Comment

Your email address will not be published.