install apache

Now it’s time to install the apache web server.

  • First, need to remove the existing httpd stuff. I removed the following RPMS.

rpm -e mod_python-3.1.3-5.1.i386
rpm -e mod_ssl-2.0.52-22.ent.centos4.i386
rpm -e mod_perl-1.99_16-4.centos4.i386
rpm -e webalizer-2.01_10-25.i386
rpm -e httpd-2.0.52-22.ent.centos4 httpd-manual-2.0.52-22.ent.centos4 system-config-httpd-1.3.1-1 httpd-suexec-2.0.52-22.ent.centos4

The Perl and Python stuff depend on the httpd so I went ahead removed them.

  • Then I downloaded apache 2.2.3 source code, unpacked them and then compile:

Oops…
configure –enable-so tells me gcc is not there.

./configure –enable-so –enable-ssl –enable-rewrite –enable-speling=shared

Ok, I didn’t install the developer’s package during system installation to try to save some space, not it came back to bite me.

After some research, the following rpms are installed:
gcc-3.4.5-2.i386.rpm
glibc-headers-2.3.4-2.19.i386.rpm
pkgconfig-0.15.0-3.i386.rpm
glib2-devel-2.4.7-1.i386.rpm
glibc-kernheaders-2.4-9.1.98.EL.i386.rpm
glibc-devel-2.3.4-2.19.i386.rpm

  • Apache compiled and installed succefully.

./apachectl start

“It works!”

Now we want to add Apache httpd server to the services:

  • first, make sure we have the startup script ready, copy the following script to /etc/init.d

————————————————————————
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: – 85 15
# description: Apache is a World Wide Web server. It is used to serve # HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid

RETVAL=0

# The semantics of these two functions differ from the way apachectl does
# things — attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $”Starting $prog: ”
/usr/local/apache2/bin/apachectl start
RETVAL=$?
return $RETVAL
}
stop() {
echo -n $”Stopping $prog: ”
/usr/local/apache2/bin/apachectl stop
RETVAL=$?
return $RETVAL
}

# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $”Usage: $prog {start|stop|restart|condrestart|status|fullstatus|graceful|help|configtest}”
exit 1
esac

exit $RETVAL

————————————————————————

The script is not going to win me any award but it is functional….status check is not in the service since it is quite easy to check on port 80…

  • Second, add the service:

chkconfig –add httpd

  • Third, turn it on:

chkconfig –level 3 httpd on

  • Ok, do a little testing:

service httpd restart

This entry was posted in server setup. Bookmark the permalink.