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
tar zxvf httpd-2.2.17.tar.gz
then switch to the decompressed folder
./configure --prefix=/opt/apache
make install

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) 

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.

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


No comments:

Locations of visitors to this page