First download the latest stable sources of Apache 2.0, mod_perl 2.0, and Perl 5.8.0.[59] Remember that mod_perl 1.0 works only with Apache 1.3, and mod_perl 2.0 requires Apache 2.0. You can get the sources from:

[59]Perl 5.6.1 can be used with prefork, but if you build from source why not go for the best?

  • mod_perl 2.0—http://perl.apache.org/dist/

  • Apache 2.0—http://httpd.apache.org/dist/

  • Perl 5.8.0—http://cpan.org/src/

You can always find the most up-to-date download information at http://perl.apache.org/download/.

Next, build Apache 2.0:

  1. Extract the source (as usual, replace x with the correct version number):

    panic% tar -xzvf httpd-2.0.xx

    If you don't have GNU tar(1), use the appropriate tools and flags to extract the source.

  2. Configure:

    panic% cd httpd-2.0.xx
    panic% ./configure --prefix=/home/httpd/httpd-2.0 --with-mpm=prefork

    Adjust the —prefix option to the directory where you want Apache 2.0 to be installed. If you want to use a different MPM, adjust the —with-mpm option. The easiest way to find all of the configuration options for Apache 2.0 is to run:

    panic% ./configure --help
  3. Finally, build and install:

    panic% make && make install

If you don't have Perl 5.6.0 or higher installed, or you need to rebuild it because you want to enable certain compile-time features or you want to run one of the threaded MPMs, which require Perl 5.8.0, build Perl (we will assume that you build Perl 5.8.0):

  1. Extract the source:

    panic% tar -xzvf perl-5.8.0.tar.gz
  2. Configure:

    panic% cd perl-5.8.0
    panic% ./Configure -des -Dprefix=$HOME/perl/perl-5.8.0 -Dusethreads

    This configuration accepts all the defaults suggested by the Configure script and produces a terse output. The -Dusethreads option enables Perl ithreads. The -Dprefix option specifies a custom installation directory, which you may want to adjust. For example, you may decide to install it in the default location provided by Perl, which is /usr/local under most systems.

    For a complete list of configuration options and for information on installation on non-Unix systems, refer to the INSTALL document.

  3. Now build, test, and install Perl:

    panic% make && make test && make install

Before proceeding with the installation of mod_perl 2.0, it's advisable to install at least the LWP package into your newly installed Perl distribution so that you can fully test mod_perl 2.0 later. You can use CPAN.pm to accomplish that:

panic% $HOME/perl/perl-5.8.0/bin/perl -MCPAN -e 'install("LWP")'

Now that you have Perl 5.8.0 and Apache 2.0 installed, you can proceed with the mod_perl 2.0 installation:

  1. Extract the source:

    panic% tar -xzvf mod_perl-2.0.x.tar.gz
  2. Remember the nightmare number of options for mod_perl 1.0? You need only two options to build mod_perl 2.0. If you need more control, read install.pod in the source mod_perl distribution or online at http://perl.apache.org/docs/2.0/user/. Configure:

    panic% cd mod_perl-2.0.x
    panic% perl Makefile.PL MP_AP_PREFIX=/home/stas/httpd/prefork \
           MP_INST_APACHE2=1

    The MP_AP_PREFIX option specifies the base directory of the installed Apache 2.0, under which the include/ directory with Apache C header files can be found. For example, if you have installed Apache 2.0 in the directory \Apache2 on Win32, you should use:

    MP_AP_PREFIX=\Apache2

    The MP_INST_APACHE2 option is needed only if you have mod_perl 1.0 installed under the same Perl tree. You can remove this option if you don't have or don't plan to install mod_perl 1.0.

  3. Now build, test, and install mod_perl 2.0:

    panic% make && make test && make install

    On Win32 you have to use nmake instead of make, and the && chaining doesn't work on all Win32 platforms, so instead you should do:

    C:\modperl-2.0\> nmake
    C:\modperl-2.0\> nmake test
    C:\modperl-2.0\> nmake install