Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
themeDJango
# Change dir to whichever working directory you want to use
$ cd /opt


# Change version number/archive type as required  - current version is 2.4.9
$ wget --no-check-certificate https://archive.apache.org/dist/httpd/httpd-2.24.239.tar.bz2 [ -e use-proxy=yes -e https_proxy=xxxxx ]


# Apache also provides MD5 hashes to verify your downloads, so you could do the following to generate a local MD5 hash to compare
wget -O - https://archive.apache.org/dist/httpd-2.4.299.tar.bz2 | tee httpd-2.24.239.tar.bz2 | md5sum > md5sum.local

...

Section
bordertrue
Column
width50%

Unix/Solaris

Code Block
languagebash
themeDJango
# Use -k switch to preserve the original archive
$ bzip2 -d[k] httpd-2.24.329.tar.bz2
$ tar -xvf httpd-2.24.329.tar -C /opt/httpd/
Column
width50%

Linux

Code Block
languagebash
themeDJango
$ tar -xzvf httpd-2.24.329.tar.gz -C /opt/httpd/

2) Compile Apache

Next, we will compile apache.Apache. Different versions require different steps, so choose your version below:

Warning
titleApache 2.2 and earlier setup
Apache 2.2 and earlier:

Code Block
languagebash
themeDJango
$ cd /opt/httpd


# First we configure the build using the following syntax
# ./configure --prefix=/opt/apache2 --enable-mods-shared=few [--enable-{modname}] [--disable-{modname}] [with-apr=included] [with-pcre=/opt/pcre] 


# Here is the most common configuration
./configure --prefix=/opt/apache2 --enable-mods-shared=few --enable-rewrite --enable-headers --enable-ssl --disable-userdir --disable-autoindex --disable-status --disable-env --disable-setenvif --disable-cgi --disable-actions --disable-negotiation --disable-alias --disable-include --disable-filter --disable-version --disable-asis --with-apr=included --with-pcre=/opt/pcre


$make


$make install



Warning
titleApache 2.4 Setup

Since Apache 2.4, the Apache Portable Runtime and the Perl Compatible Regex modules are no longer packaged with the original source. However, these modules are mandatory for Apache to compile and run.


Click here to
Expand
titleClick here to see the additonal steps for 2.4
Expand
title
find out why you need these libraries...

APR

The APR library provides a set of APIs that map to the underlying O/S and emulate functions if they are not available, making Apache platform-agnostic.

PCRE

The PCRE library provides more powerful and flexible regex expression functionality than other flavours and is used by mod_rewrite, etc.

Apache provides the flexibility to point to existing instances of these when compiling. If you do not have these modules you can add them as follows:

First, download the module source files:

Code Block
languagebash
themeDJango
$ wget http://archive.apache.org/dist/apr/apr-1.6.3.tar.bz2
$ wget http://archive.apache.org/dist/apr/apr-util-1.6.1.tar.bz2

# Apache 2 requires pcre, not pcre2
$ wget --no-check-certificate https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.bz2


Extract the source files:

Code Block
languagebash
themeDJango
# APR and APR utils can be compiled with Apache out of the box provided they are in the srclib directory.   # NOTE, the contents of the untarred folders must be copied to a folder under srclib with the exact names   # below: 
$ tar -x[z]vf apr-1.6.3.tar[.gz] --directory /opt/httpd-2.4.x/srclib/apr
$ tar -x[z]vf apr-util-1.6.1.tar[.gz] -- directory /opt/httpd-2.4.x/srclib/apr-util


# PCRE will not be automatically compiled in the srclib directory, so either manipulate the build script or simply keep it separate.
$ tar -x[z]vf pcre-8.41.tar[.gz]


If you've placed PCRE in its own folder, you will have to build it first:

Code Block
languagebash
themeDJango
$ ./configure --prefix=/opt/pcre --enable-pcre16 --enable-pcre32
$ make
$ make install


Apache 2.4 requires the use of specific options for APR and APR utils to install. Here is a standard configuration for Apache 2.4:

Code Block
languagebash
themeDJango
$ cd /opt/httpd

# First we configure the build using the following syntax
# ./configure --prefix=/opt/apache2 --enable-mods-shared=few [--enable-{modname}] [--disable-{modname}] [with-apr=included] [with-pcre=/opt/pcre] 

# Here is the most common configuration
$./configure --prefix=/opt/apache2 --enable-mods-shared=few --enable-rewrite --enable-headers --enable-ssl --disable-userdir --disable-autoindex --disable-status --disable-env --disable-setenvif --disable-cgi --disable-actions --disable-negotiation --disable-alias --disable-include --disable-filter --disable-version --disable-asis --with-
apr=included
included-apr --with-included-apr-util --with-pcre=/opt/pcre


$make
$make install


Here it is important to understand what each switch is doing and the implications of each.

...