Download httpd-2.2.6.tar.bz2 put the httpd-2.2.6.tar.bz2 under the/soft.
[[Email protected] ~] #cd/soft
[[email protected] soft] #tar JXVF httpd-2.2.6.tar.bz2//Unzip the Apache package
[[email protected] soft] #cd httpd-2.2.6//Navigate to the httpd-2.2.6 folder
[[email protected] httpd-2.2.6] #ls//View the contents of the Display httpd-2.2.6 folder
[Email protected] httpd-2.2.6]#./configure--help | More//View install Apache configuration parameters
[[email protected] httpd-2.2.6]#./configure--prefix=/usr/local/apache--enable-so//Configure Apache Path
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.
[[email protected] httpd-2.2.6] #make//Compile Apache
[[email protected] httpd-2.2.6] #make Install//installation Apache
[[email protected] httpd-2.2.6] #cd/usr/local/apache//Enter Apache directory
[Email protected] apache]# CD conf/
[[email protected] conf] #cp-a httpd.conf httpd.conf-//backup Apache configuration file
[[email protected] conf] #chkconfig--list httpd//See if the HTTPD service already exists
[[email protected] conf] #chkconfig httpd off//Shut down system comes with httpd service if there is httpd service
[[email protected] conf] #service httpd status//view your own httpd service status
[[email protected] conf]#/usr/local/apache/bin/apachectl-k start//linux launch Apache command
[[email protected] conf] #netstat-an | GREP:80//See if the linux80 port is turned on
[[email protected] conf] #ps-aux | grep httpd//linux under View Apache process
[[email protected] conf] #cd. /..
[[email protected] local] #cp/usr/local/apache/bin/apachectl/etc/rc.d/init.d/apache//copy Apache boot script
[[email protected] local] #vi/etc/rc.d/init.d/apache//This is the edit Apache startup script
At the beginning of the #! /bin/sh below plus #chkconfig:2345 85 15
- after saving Exit VI Editor, execute the following command to increase Apache service control script execution permissions:
chmod +x/etc/init.d/apache
[[email protected] local] #chkconfig--add Apache//Add Apache Service
[[email protected] local] #chkconfig--list Apache//list Apache Service
- 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.
[[email protected] local] #service Apache stop//Stop Apache Service
[[email protected] local] #netstat-an | GREP:80//Check whether the 80 port of Linux is off
[[email protected] local] #ps-aux | grep httpd//To see if a httpd service exists, and if the previous httpd service starts, the newly added Apache service fails to start
[[email protected] local] #service Apache start//Start Apache Service
- execute the following command to turn off boot: chkconfig Apache off
Open your server IP address to see if there's a Tomcat default home page, and if so, congratulations.
Installing Apache under Linux has been successful.
Linux under Installation Apache detailed