1. Preface
Recently learn to build WordPress, need to use APAHCE and MySQL. I download the source code for installation, installed in the/url/local directory, each boot will need to start manually, a bit troublesome. If you want to set up boot, from the online check, how to set up, summarize, convenient for later use.
2. Setting method
There are two ways to modify a configuration file, one by adding a startup item.
Method One: Modify the configuration file according to the system startup initialization process
The operating modes 2, 3, and 5 in CentOS all make/etc/rc.d/rc.local the last one in the init script, so users can add in this file their own commands that need to be executed before the other initialization work. The introduction of RC.D can be consulted: http://blog.csdn.net/it1988888/article/details/8051657.
Edit rc.local file: #vim/etc/rc.d/rc.local
Add the following start command:
#启动apahce
/usr/local/apache/bin/apachectl start
#启动mysql
/usr/local/mysql/bin/mysqld Start or/usr/local/mysql/bin/mysqld start
Method Two: Use the chkconfig command to implement
Chkconfig is often used in command-line operations, and it is easy to set up and query the system service Chkconfig syntax at different run levels :
Chkconfig [--add] [--del] [--list] [System Services] chkconfig [--level/levels] [Level code] [System Services] [On/off/reset] Level code: The operating level of the Linux system. Linux divides the operating environment into the following 7 levels, i.e.
0: Turn off the machine
1: Single user mode (single user, no network)
2: Multi-user mode without network support (multiuser, no network)
3: Multi-user mode with network support (multi-user, network)
4: reserved, not used
5: Network support with X-window support multi-user mode (multi-user, network, X-window interface)
6: Reboot the system, that is, restart with chkconfig list query Apache and MySQL service exists, does not exist and needs to be added manually. Add Apache Service Item command:
chkconfig--add httpdTo finish adding the settings startup item:
chkconfig--level 2345 httpd on
chkconfig--level 2345 mysqld on
Reference:
Http://www.jb51.net/LINUXjishu/86331.html
Http://www.ok165.com/article/5333.html
Source: >
From for notes (Wiz)
CentOS Setup boot up Apache and mysql[summary]