Unix Stuff

Apache Environment

I wrote this a couple years ago for building Apache 1.x on RH Linux 7.3, RHEL3, and HP-UX 11.00 in a uniform manner.




Apache 1.3 Documentation


1. Stuff to Download
2. Prerequisite Libraries
3. Patching in the EAPI
4. Building Apache
5. Building mod_ssl
6. Building mod_perl
7. Building PHP4




1. What to Download:



Berkeley DB 3.3.11: http://www.sleepycat.com/
mm 1.3.0: http://www.ossp.org/pkg/lib/mm/
Apache 1.3.29+: http://httpd.apache.org/
mod_ssl 2.8.16+: http://www.modssl.org/
mod_perl 1.29: http://perl.apache.org
php 4.3.4+ (optional): http://www.php.net/



2. Building Prerequisite Libraries: Sometime during or after this step, check /etc/ld.so.conf and make sure /opt/apache/lib is there. If it was not present, run "ldconfig" after adding it and after each "make install".

    tar -xzvf db-3.3.11.tar.gz
    cd db-3.3.11/build_unix
    ../dist/configure --prefix=/opt/apache \
        --disable-static \
        --disable-java \
        --disable-tcl \
        --disable-dump185 \
        --disable-cxx \
        --disable-compat185
    make -j3
    make install
    tar -xzvf mm-1.3.0.tar.gz
    cd mm-1.3.0
    ./configure --prefix=/opt/apache \
        --disable-static \
        --with-pic
    make -j3
    make install
    /sbin/ldconfig -v -n /opt/apache/lib



3. Patching the EAPI into Apache: EAPI is an interface to Apache that makes it possible to build mod_perl and other modules without having to have an Apache source tree available. It also makes it easier for modules like mod_perl and PHP to co-exist in the same webserver.

Upgrading one component of Apache should be possible without modifying other components (i.e. upgrade just httpd and not have to rebuild mod_ssl or mod_perl).

Make sure to keep the source from this step for building Apache and mod_ssl later.

    tar -xzvf mod_ssl-2.8.16-1.3.29.tar.gz
    tar -xzvf apache_1.3.29.tar.gz
    cd mod_ssl-2.8.16-1.3.29
    ./configure \
        --with-apache=../apache_1.3.29 \
        --with-eapi-only
    cd ..
4. Build Apache: We add the kerberos library & include paths here so that APXS will propagate them for other modules, like mod_ssl.
    cd apache_1.3.29
    export CFLAGS="-fPIC -L/opt/apache/lib -I/opt/apache/include \
                   -I/usr/kerberos/include -L/usr/kerberos/lib"
    LIBS="-ldb -lpthread" ./configure \
        --prefix=/opt/apache \
        --enable-module=all \
        --enable-shared=max \
        --enable-module=auth_dbm \
        --enable-rule=EAPI \
        --disable-rule=EXPAT \
        --with-perl=/usr/local/bin/perl
    make -j3
    make install


6. Build mod_ssl: This was unpacked earlier when patching Apache. cd into the same directory where you ran configure to do the patching.
    export PATH=/opt/apache/bin:$PATH
    ./configure \
        --with-apxs=/opt/apache/bin/apxs \
        --with-mm=SYSTEM
    make -j3
    make install


6. Build mod_perl (1.x):
    cd mod_perl-1.29
    perl Makefile.PL \
        USE_APXS=1 \
        WITH_APXS=/opt/apache/bin/apxs \
        PERL_USELARGEFILES=0 \
        EVERYTHING=1 \
        CCFLAGS="-O2 -fPIC"
    make -j3
    make install


7. Build PHP4: Various -devel RPM's are required for this stage to succeed. Make sure they're installed - running configure and letting it fail is one way of finding all of the depenencies. The -devel packages are only required on the build host.
    cd php-4.3.4
    ./configure  --prefix=/opt/apache \
        --with-pic \
        --enable-cli \
        --with-apxs=/opt/apache/bin/apxs \
        --with-openssl \
        --with-zlib \
        --with-bz2 \
        --enable-calendar \
        --enable-sigchild \
        --with-curl \
        --with-gdbm \
        --with-gd \
        --with-mysql \
        --enable-sockets \
        --enable-trans-sid \
        --enable-track-vars
    make -j3
    make install