Getting Started with mod_perl in 30 Minutes Page 2

Now we download the latest source distributions of Apache and mod_perl. If you have the LWP module installed (also known as libwww and available from CPAN), you should have the lwp-download utility that partly imitates your favorite browser by allowing you to download files from the Internet. You can use any other method to retrieve these files. Just make sure that you save both files in the /usr/src directory, as this will make it easier for you to follow the example installation process. Of course you can install both packages anywhere on your file system:

  % lwp-download http://www.apache.org/dist/apache_1.3.12.tar.gz
  % lwp-download http://perl.apache.org/dist/mod_perl-1.24.tar.gz

You can make sure that you're downloading the latest stable versions by visiting the following distribution directories: http://www.apache.org/dist/ and http://perl.apache.org/dist/. As you have guessed already, the former URL is the main Apache distribution directory, the latter is the same thing for mod_perl.

Untar both sources. You have to uncompress and untar the files. In addition to its main usage for tarring and untarring files, the GNU tar utility is able to uncompress files compressed by the gzip utility, when the -z option is used:

  % tar -zvxf apache_1.3.12.tar.gz
  % tar -zvxf mod_perl-1.24.tar.gz

If you have a non-GNU tar utility, chances are that it will be unable to decompress, so you need to do it in two steps. First uncompress the packages with:

  % gzip -d apache_1.3.12.tar.gz
  % gzip -d mod_perl-1.24.tar.gz

Then untar them with:

  % tar -xvf apache_1.3.12.tar
  % tar -xvf mod_perl-1.24.tar

If you don't have tar or gzip utilities available, either install them or use their equivalents.

Now go into the mod_perl source distribution directory:

  % cd mod_perl-1.24

The next step is to create the Makefile:

  % perl Makefile.PL APACHE_SRC=../apache_1.3.12/src     DO_HTTPD=1 USE_APACI=1 PERL_MARK_WHERE=1 EVERYTHING=1

mod_perl accepts a variety of parameters, in this scenario we are going to use those that will allow you to do almost everything with mod_perl. Once you learn more about mod_perl you will be able to fine tune the list of parameters passed to Makefile.PL. In future articles I'll go through all the available options.

perl Makefile.PL ... execution will check for prerequisites and tell you which required software packages are missing from your system. If you don't have some of the Perl packages installed, you will have to install these before you proceed. They all are available from CPAN and can be easily downloaded and installed.

If you choose to install mod_perl with help of the CPAN.pmmodule, it will install all the missing modules for you. To do so, tell CPAN.pm to install the Bundle::Apachebundle.

This step also executes the ./configure script from Apache's source distribution directory (absolutely transparently for you), which prepares the Apache build configuration files. If you need to pass parameters to Apache's ./configurescript, just pass them as options to perl Makefile.PL .... In future articles we will talk about all the available options.

Now you should build the httpd executable by using the make utility:

  % make

This article was originally published on Jun 23, 2000

Thanks for your registration, follow us on our social networks to keep up-to-date