I am currently renting a VPS that is running CentOS 6.5. I am using it to run a basic forum site, and obviously, I need a web server and MySQL to power that. I have chosen Apache for my web server, and I am using the standard mysql-server
package for CentOS.
My question is… whenever I reboot my server manually via the reboot
command, I always have to manually start Apache and MySQL with the following commands:
service mysqld start
service httpd start
This can be a pain if I happen to forget to start up the individual service. Is there a way I can make it automatically start up whenever I manually reboot my server?
I have done some looking into other questions on ServerFault, and after looking at this question and installing strace
, I ran strace /etc/init.d/mysqld start
and had a very strange output that didn't make much sense to me. It didn't have any easily decipherable information, but I'm a novice at this type of thing, so I may have not been looking for the right thing.
I have found other pages across the Internet, but they usually seem to be for Debian-based operating systems, and I never seem to be able to use them for what I'm doing.
Best Answer
The services on a CentOS operating system are managed using
chkconfig
.Use
chkconfig --list
to review the currently managed services.You can mark a service to automatically start at a defined runlevel by issuing:
Read the
chkconfig(8)
manpage for the details.