When you install self-compiled Apache and MySQL, they are not added as system services by default, so we need to manually add them as services.
Adding Apache as a System Service
Copy
apachectl
to theinit.d
directory# cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
Edit
httpd
# vi /etc/rc.d/init.d/httpd
Add the following comment lines:
# chkconfig: 345 85 15 # description: Apache server
Add Apache to the system services
# chkconfig --add httpd
Adding MySQL as a System Service
Copy MySQL to the
init.d
directory# cp /usr/local/mysql5/share/mysql/mysql.server /etc/init.d/mysqld
Add
mysqld
to the system services# chkconfig --add mysqld
After completing the above steps, you can use:
# service httpd/mysqld restart/start/stop
to control the start, stop, and restart of Apache/MySQL.