Installing Apache (and modules) From Scratch

This page describes how to do a fresh installation of Apache and integrate it with important modules.


Contents


Mission

This page will explain step-by-step how to install Apache from scratch, with the following modules:


Getting Started

Note: For this page, I have used mod_perl 1.21, Apache 1.3.9, Open SSL 0.9.4, RSAref 2.0, mm 1.0.12 and mod_ssl 2.4.9 (the latest for each package as of December 08/99).
I mention this because I have used the full path names when describing the install. You version number may be different, so don't be puzzled...

This procedure has also worked with older versions of the packages (ie. Apache 1.3.6).


Compiling Each Module

Note: Each module will have to be compiled in order and this was rather messy to find out. You must do each package in order, as illustrated below:

Step 1: Building mod_perl

# cd /export/installs/apache/mod_perl-1.21
# perl Makefile.PL USE_APACI=1 EVERYTHING=1
You must answer y to the first question - "Configure mod_perl with Apache?".
For the second question asked by the Makefile, answer n - "Should I build httpd for you"?

After answering these questions a the Makefile will configure itself for the make.

After this is done, simply type make followed by make install.
(You should confirm that mod_perl was installed by looking at the files in ../apache_1.3.9/src/modules/perl - you should see mod_perl.*)

Step 2: Building RSARef

To build Open SSL, you first need to build RSARef:

# cd /export/installs/apache/rsaref
# cp -rp install/unix local
# cd local
# make
# mv rsaref.a librsaref.a

Do not make install.

Step 3: Building Open SSL

Now, you are ready to build Open SSL:
# cd /export/installs/apache/openssl-0.9.4
# sh config -L`pwd`/../rsaref/local rsaref -fPIC
# make
# make test
Make sure the test works. Do not make install.

Step 4: Building mm

Now build the memory management module:
# cd /export/installs/apache/mm-1.0.12
# ./configure --disable-shared
# make
You must keep the --disable-shared tag in the configure call. Do not make install.

Step 5: Building mod_ssl

# cd /export/installs/apache/mod_ssl-2.4.9-1.3.9
# ./configure --with-apache=../apache_1.3.9
Do not make or make install.


Last Step: Building and Installing Apache

From the modules that you have built above, we can setup Apache. Go into the Apache source directory ( /export/installs/apache/apache_1.3.9)

Please Note: Firstly, the configure command for Apache should be put into a shell script file, so you can add more modules to Apache at a later time (and not accidenatly forgetting a module).
This is easier, as the next time you want to add a module, just open the shell script file and add the configuration line and re-run the configuration.

For configuring Apache with all the modules above (and mod_rewrite - which comes within the Apache source package), I did the following:

You will need to chmod 775 default.config and then ./default.config
The above sets Apache to be installed into the /usr/apache directory (with --prefix) and sets all the system variables for the SSL stuff.
Note: You may not see libperl.a in the src/modules/perl directory, but the modules will be created during making the source code.

This should run smoothly. If it doesn't, the configuration must have been wrong. Check all path names and compiler options.

If everything is fine, you will see the following after running ./default.config:

Configuring for Apache, Version 1.3.9
 + using installation path layout: Apache (config.layout)
 + activated perl module (modules/perl/libperl.a)
 + activated rewrite module (modules/standard/mod_rewrite.o)
Creating Makefile
.....

Making Sure It Worked

Edit the /usr/apache/conf/httpd.conf file to reflect the server's IP numbers and name.
Do not edit the Docuemnt Root - if the installation worked, we should see what is says about how it went.

apachectl

Within the /usr/apache/httpd-[site]/bin directory there will be a file called apachectl.

It is advised that you add/replace these lines to the configuration section:

ROOT=/usr/apache/httpd-[site]
HTTPD="/usr/apache/httpd-[site]/bin/httpd -d $ROOT"

Activating SSL

I wrote up another page to get into the specifics of SSL, which you may read here.

To activate SSL, replace the above line (starting with HTTPD=) with the following:

HTTPD="/usr/apache/httpd-[site]/bin/httpd -d $ROOT -DSSL"
In the httpd.conf file, point the following variables to the right locations for the .key and .crt certificates:

SSLCertificateKeyFile /usr/apache/httpd-[site]/conf/server.key # public key
SSLCertificateFile /usr/apache/httpd-[site]/conf/server.crt # key recieved from Thawte

Starting The Server

Then you may run /usr/apache/httpd-[site]/apachectl start . If you have SSL activated, Apache will ask you for the key's paraphrase.

Now check the error log..ie. tail -f /usr/apache/logs/error_log and you should see the following:

[notice] Apache/1.3.9 (Unix) mod_perl/1.21 mod_ssl/2.4.9 OpenSSL/0.9.4 configured -- resuming normal operations

Now point your browser to the server and you should see a friendly message from Apache and SSL confirming the installation.


Afra Ahmad 1999