Apache 2.0.x installation

From SlackWiki
Jump to: navigation, search

Notice

This article is obsolete; Slackware 12.0 includes Apache 2 by default (the httpd package). This information is kept here for users of older versions of Slackware.

Introduction

Sometimes one needs Apache 2.0.x in Slackware, which comes with Apache 1.3.x by default. Apache 2.0.x is necessary for example for Subversion repository setup or for recent mod_python modules.

Prerequisites:

So, first go to http://httpd.apache.org/download.cgi and grab the latest httpd-2.0.x.tar.bz2 file and unpack it:

tar xfvj httpd-2.0.x.tar.bz2

Execute following script in directory just above your unpacked httpd-2.0.

#!/bin/sh

build_apache() {

cd httpd-*

cat >> config.layout <<EOF
#   Layout for Slackware Linux
<Layout Slackware>
    prefix:        /usr
    exec_prefix:   \${prefix}
    bindir:        \${prefix}/bin
    sbindir:       \${prefix}/sbin
    libdir:        \${prefix}/lib
    libexecdir:    \${prefix}/lib/apache2
    mandir:        \${prefix}/man
    sysconfdir:    /etc/apache2
    datadir:       /var/www
    iconsdir:      \${datadir}/icons
    htdocsdir:     \${datadir}/htdocs
    manualdir:     \${datadir}/manual
    cgidir:        \${datadir}/cgi-bin
    includedir:    \${prefix}/include/apache2
    localstatedir: /var
    runtimedir:    \${localstatedir}/run
    logfiledir:    \${localstatedir}/log/apache2
    proxycachedir: \${localstatedir}/cache/apache2
    infodir:       \${exec_prefix}/share/info
    installbuilddir: \${datadir}/build
    errordir:      \${datadir}/error
</Layout>
EOF
./configure --enable-layout=Slackware \
            --enable-module=most \
        --enable-mods-shared=most \
        --enable-ssl=shared \
                --enable-mime-magic \
                --enable-expires \
                --enable-headers \
                --enable-usertrack \
                --enable-cgi \
                --enable-vhost-alias \
                --enable-speling \
                --enable-so \
                --enable-rewrite \
                --enable-deflate \
                --enable-dav \
                --enable-dav-fs \
                --enable-proxy

make clean
time nice make

su -c "checkinstall -y"
}
create_scripts() {
cat > rc.httpd <<EOF
#!/bin/sh
#
# Start the Apache web server
#

case "\$1" in
   'start')
      /usr/sbin/apachectl start ;;
   'stop')
      /usr/sbin/apachectl stop ;;
   'restart')
      /usr/sbin/apachectl restart ;;
   *)
      echo "usage \$0 start|stop|restart" ;;
esac
EOF
chmod 755 rc.httpd

cat > apache2 <<EOF
/var/log/apache2/*_log {
    sharedscripts
    monthly
    rotate 6
    create
    compress
    postrotate
    /bin/kill -HUP `cat /var/run/httpd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}
EOF
}

build_apache
create_scripts

This script will get the job done. It will compile and install Apache 2.0.x together with the startup scripts.