Installing apache2 tar.gz

by Administrator 14. May 2009 03:52

Iam use centos 5.2 on my PC

Download the package httpd-2.0.54.tar.gz from http://apache.org.

Download the patch from the zlib http://smithii.com/files/httpd-2.0.54_zlib-1.2.2.patch

Download the patch from openssl http://smithii.com/files/httpd-2.0.54_openssl-0.9.8.patch

Open the package tarbal it

# tar -zxvf httpd-2.0.54.tar.gz

# patch -p0 < httpd-2.0.54_zlib-1.2.2.patch

# patch -p0 < files/httpd-2.0.54_openssl-0.9.8.patch

# useradd -d /usr/local/httpd apache

# cd  httpd-2.0.54

# ./configure -prefix=/usr/local/httpd \

--enable-access=shared --enable-auth=shared --enable-auth-dbm=shared \

--enable-auth-digest=shared --enable-file-cache=shared \

--enable-echo=shared --enable-cache=shared --enable-disk-cache=shared \

--enable-mem-cache=shared --enable-case-filter=shared --enable-case-filter-in=shared \

--enable-ext-filter=shared --enable-deflate=shared \

--enable-log-config=shared --enable-log-forensic=shared --enable-logio=shared \

--enable-mime-magic=shared --enable-cern-meta=shared --enable-expires=shared \

--enable-headers=shared --enable-usertrack=shared --enable-unique-id=shared \

--enable-proxy=shared --enable-proxy-connect=shared --enable-proxy-ftp=shared \

--enable-proxy-http=shared --enable-ssl=shared --enable-optional-hook-export=shared \

--enable-optional-hook-import=shared --enable-optional-fn-import=shared \

--enable-optional-fn-export=shared --enable-bucketeer=shared --enable-static-support=shared \

--enable-static-htpasswd=shared --enable-static-htdigest=shared \

--enable-static-rotatelogs=shared --enable-static-logresolve=shared \

--enable-static-htdbm=shared --enable-static-ab=shared --enable-static-checkgid=shared \

--enable-dav=shared --enable-info=shared --enable-suexec=shared \

--enable-cgi=shared --enable-cgid=shared --enable-dav-fs=shared --enable-vhost-alias=shared \

--enable-dir=shared --enable-imap=shared --enable-actions=shared \

--enable-userdir=shared --enable-speling=shared --enable-alias=shared \

--enable-rewrite=shared --enable-so

# make

# make install

Edit file /usr/local/httpd/conf/httpd.conf

# vi /usr/local/httpd/conf/httpd.conf

Find the line
User # -1
Group # -1
ServerAdmin root @ localhost
Change to
User apache
Group apache
ServerAdmin admin@chamceul.com This e-mail address is being protected from spambots. You need JavaScript enabled to view it

Create a file for initscript service httpd
# vi /etc/rc.d/init.d/httpd

 

#!/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

 

# Source function library.

. /etc/rc.d/init.d/functions

 

if [ -f /etc/sysconfig/httpd ]; then

        . /etc/sysconfig/httpd

fi

 

# Start httpd in the C locale by default.

HTTPD_LANG=${HTTPD_LANG-"C"}

 

# This will prevent initlog from swallowing up a pass-phrase prompt if

# mod_ssl needs a pass-phrase from the user.

INITLOG_ARGS=""

 

# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server

# with the thread-based "worker" MPM; BE WARNED that some modules may not

# work correctly with a thread-based MPM; notably PHP will refuse to start.

 

# Path to the apachectl script, server binary, and short-form for messages.

apachectl=/usr/local/httpd/bin/apachectl

httpd=${HTTPD-/usr/local/httpd/bin/httpd}

prog=httpd

OPTIONS=

pidfile=${PIDFILE-/var/run/httpd.pid}

lockfile=${LOCKFILE-/var/lock/subsys/httpd}

RETVAL=0

 

# check for 1.3 configuration

check13 () {

        CONFFILE=/usr/local/httpd/conf/httpd.conf

        GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"

        GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"

        GONE="${GONE}AccessConfig|ResourceConfig)"

        if LANG=C grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then

                echo

                echo 1>&2 " Apache 1.3 configuration directives found"

                echo 1>&2 " please read /usr/share/doc/httpd-2.0.54/migration.html"

                failure "Apache 1.3 config directives test"

                echo

                exit 1

        fi

}

 

# 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: "

        check13 || exit 1

        LANG=$HTTPD_LANG daemon $httpd $OPTIONS

        RETVAL=$?

        echo

        [ $RETVAL = 0 ] && touch ${lockfile}

        return $RETVAL

}

stop() {

        echo -n $"Stopping $prog: "

        killproc $httpd

        RETVAL=$?

        echo

        [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}

}

reload() {

    echo -n $"Reloading $prog: "

    if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then

        RETVAL=$?

        echo $"not reloading due to configuration syntax error"

        failure $"not reloading $httpd due to configuration syntax error"

    else

        killproc $httpd -HUP

        RETVAL=$?

    fi

    echo

}

 

# 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

        ;;

  reload)

        reload

        ;;

  graceful|help|configtest|fullstatus)

        $apachectl $@

        RETVAL=$?

        ;;

  *)

        echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"

        exit 1

esac

 

exit $RETVAL

Change httpd init script to be executable
# Chmod 755 /etc/rc.d/init.d/httpd

Create a run-level httpd as a service
# chkconfig - add httpd

So that the httpd service running when booting Linux system, turn on run-level
# chkconfig httpd on

Run service httpd / apache.
# Service httpd start

Make sure httpd already work well.
# ps-ax | grep httpd
30138 ?  Ss  0:00 /usr/local/httpd/bin/httpd
30139 ?  S  0:00 /usr/local/httpd/bin/httpd
 
 # netstat -tapn
tcp     0     0 0.0.0.0:80      0.0.0.0:*    LISTEN    30205/httpd
 
Use a web browser to http://localhost
 
done :)

Tags: ,

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

 

My Quote :P

Each morning when I open my eyes I say to myself: I, not events, have the power to make me happy or unhappy today. I can choose which it shall be. Yesterday is dead, tomorrow hasn’t arrived yet. I have just one day, today, and I’m going to be happy in it.

Month List

Page List