The following is the complete code for installing Apache in Linux. The system is redhat5.5.
Download httpd-2.2.6.tar.bz2 and put httpd-2.2.6.tar.bz2 under/soft.
[Root @ localhost ~] # Cd/soft
[Root @ localhost soft] # tar jxvf httpd-2.2.6.tar.bz2 // decompress Apache's compressed package
[Root @ localhost soft] # cd httpd-2.2.6 // locate under the httpd-2.2.6 folder
[Root @ localhost httpd-2.2.6] # ls // View display contents under the httpd-2.2.6 folder
[Root @ localhost httpd-2.2.6] #./configure -- help | more // view Apache installation configuration parameters
[Root @ localhost httpd-2.2.6] #./configure -- prefix =/usr/local/Apache -- enable-So // configure the Apache path
[Root @ localhost httpd-2.2.6] # Make // compile Apache
[Root @ localhost httpd-2.2.6] # make install // install Apache
[Root @ localhost httpd-2.2.6] # cd/usr/local/Apache // enter the Apache directory
[Root @ localhost Apache] # cd CONF/
[Root @ localhost conf] # cp-a httpd. conf httpd. conf-// back up the Apache configuration file
[Root @ localhost conf] # chkconfig -- list httpd // check whether the HTTPd service already exists
[Root @ localhost conf] # chkconfig httpd off // disable the HTTPd service that comes with the system. If the HTTPd service exists
[Root @ localhost conf] # service httpd status // view the built-in HTTPd service status
[Root @ localhost conf] #/usr/local/Apache/bin/apachectl-K start // start Apache command in Linux
[Root @ localhost conf] # netstat-an | grep: 80 // check whether port linux80 is enabled
[Root @ localhost conf] # ps-Aux | grep httpd // view the Apache process in Linux
[Root @ localhost conf] # cd ../..
[Root @ localhost local] # cp/usr/local/Apache/bin/apachectl/etc/rc. d/init. d/Apache // copy Apache Startup Script
[Root @ localhost local] # vi/etc/rc. d/init. d/Apache // edit the Apache STARTUP script.
Starting #! Add
# Chkconfig: 2345 85 15
[Root @ localhost local] # chkconfig -- add Apache // Add apache service
[Root @ localhost local] # chkconfig -- list Apache // list Apache services
[Root @ localhost local] # service Apache stop // stop the apache service
[Root @ localhost local] # netstat-an | grep: 80 // check whether port 80 of Linux is disabled
[Root @ localhost local] # ps-Aux | grep httpd // check whether the HTTPd service exists. If the built-in HTTPd service is started, the newly added apache service fails to be started.
[Root @ localhost local] # service Apache start // start the apache service
Open your server IP address and check whether the default homepage of Apche is displayed. If yes, congratulations.
Apache is successfully installed in Linux.
Source: http://zhidao.zgsj.com/article/4/2011119113716.shtml