Installing Apache
1. Get the Software: http://httpd.apache.org/httpd-2.2.21.tar.gz
2. Installation steps:
Unzip the source file:
2 CD httpd-2.2.21
4 Make
5 Make Install
Run the./configure command to compile the source code,
--PREFIX=/USR/LOCAL/APACH2 is to set the system directory to which the compilation is installed.
The--enable-s parameter is to enable the HTTPD service to dynamically load the module function,
--enable-rewrite is a feature that enables the HTTPD service to have page address rewriting.
3. Launch Apache:
/usr/local/apache2/bin/apachectl start
4. Add Apache to the system service and use service commands to control Apache start and stop
- first, build the Apache Service control script for the template with the Apachectl script:
Grep-v "#"/usr/local/apache2/bin/apachectl >/etc/init.d/apache
- Edit Apache Service Control script/etc/init.d/apache with VI:
Vi/etc/init.d/apache
- Insert the following line at the front of the file so that it supports the Chkconfig command:
#!/bin/sh
# chkconfig:2345 85 15
# Description:apache is a world Wide Web server.
- after saving Exit VI Editor, execute the following command to increase Apache service control script execution permissions:
chmod +x/etc/init.d/apache
- Execute the following command to join the Apache service to the system service:
Chkconfig--add Apache
- execute the following command to check if the Apache service is in effect:
Chkconfig--list Apache
- the command output resembles the following result:
Apache 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Indicates that the Apache service is in effect and starts automatically with the system boot at the 2, 3, 4, 5 runlevel and can later use the service command to control Apache startup and stop.
- start Apache services: service Apache Start
- Stop Apache service: service Apache Stop
- execute the following command to turn off boot: chkconfig Apache off
Appendix
You need to install the GCC compilation package to compile the 2 binary
#安装gccyum-y Install gcc
You need to surf the Internet, make the virtual machine URL into a local network segment and you can get online.
Linux learn a little every day (03)