Monday, February 7, 2011

How to: install apache 2.2 on centos

It’s pretty straightforward to install apache 2.2 on centos. download the source file and compile it, then make install.

cd /tmp
wget http://download.nextag.com/apache//httpd/httpd-2.2.17.tar.gz
tar zxvf httpd-2.2.17.tar.gz
then switch to the decompressed folder
./configure --prefix=/opt/apache
make
make install
#Done


After that, start the httpd, there is one apachectl utility to control the start/stop operation of httpd

/opt/apache/bin/apachectl start
#start the httpd daemon

then browse to localhost:80, you will get the It works page. (httpd is working and listens on port 80) 
image

you can change the index.html located in the /opt/apache/htdocs/ to something else like hello world.

run “ps -aux|grep httpd”, you will see the processes.
image

To add the httpd to  service.

ln -s /opt/apache/bin/apachectl  /etc/init.d/apache2
add two lines to the /etc/init.d/apache2
#chkconfig:3 80 80
#description:my apache web server

add it to the chkconfig
chkconfig –add apache2

now you can query chkconfig –list apache2

image

No comments:

 
Locations of visitors to this page