After centos has installed server programs such as apache and mysql, it is not set to start automatically at boot. In order to avoid having to manually start web and other servers after restarting, it is better to set it up. In fact, the setting is very simple, just use the chkconfig command.
For example, if you want to automatically start mysql, apache, vsftpd services after booting, use the following command:
chkconfig mysqld on
chkconfig httpd on
chkconfig vsftpd on
If you want to turn off automatic startup, just change on to off. .
chkconfig mysqld off
However, it should be noted that if a service has not been added to the chkconfig list, you now need to use the –add parameter to add it:
chkconfig –add postfix
If you want to query all current For automatically started services, you can enter:
chkconfig –list
But this displays too many things and looks dizzy. What if I only want to see specified services? At this time, you only need to add the service name after "-list". For example, to check whether the httpd service starts automatically, enter:
chkconfig –list httpd
The output result at this time:
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
At this time, 0~6 are all off, which means that the httpd service will not start automatically when the system starts. After we enter chkconfig httpd on, check the output again and the result becomes:
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
At this time, 2~5 are all on, so It means it will start automatically.