In the case of CentOS or redhat other systems, the system will not start automatically after installation, such as httpd, mysqld, postfix, etc., if the service is installed later. Even if the service is started manually by/etc/init.d/mysqld start, the service will not start automatically as long as the server restarts.
at this time, we need to set up after the installation, let the system automatically start these services, to avoid unnecessary loss and trouble.
In fact, the command is very simple, use chkconfig can. For example, to set the mysqld to boot automatically:
#chkconfig mysqld on
In the same vein, to cancel a service auto-start, you only need to change the last parameter "on" to "Off". For example, to cancel the auto-start of postfix:
#chkconfig postfix off
It is important to note that if the service has not been added to the Chkconfig list, it is now necessary to add it using the –add parameter:
#chkconfig –add Postfix
If you want to query all currently started services automatically, you can enter:
#chkconfig –list
But it shows too many things and looks dizzy. What if you want to see only the services you specify? This time only need to add the service name after the "–list", such as to see if the HTTPD service is automatically started, enter:
#chkconfig –list httpd
The result of this time output:
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
When the 0~6 is off, the HTTPD service does not start automatically when the system starts. After we enter Chkconfig httpd on, check again that the output is changed to:
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
This time the 2~5 is on, which indicates that it will start automatically.
How to set up service auto-start under CentOS