Practical mod_perlPractical mod_perlSearch this book

3.8. Installing mod_perl on Multiple Machines

You may want to build httpd once and then copy it to other machines. But the Perl side of mod_perl needs the Apache header files to compile. To avoid dragging and build Apache on all your other machines, there are a few Makefile targets in mod_perl to help you out:

panic% make tar_Apache

This will make a tar file (Apache.tar) of all the files mod_perl installs in your Perl's site_perl directory. You can then unpack this under the site_perl directory on another machine:

panic% make offsite-tar

This will copy all the header files from the Apache source directory against which you configured mod_perl. It will then run make dist, which creates a mod_perl-1.xx.tar.gz file, ready to unpack on another machine to compile and install the Perl side of mod_perl.

If you really want to make your life easy, you should use one of the more advanced packaging systems. For example, almost all Linux distributions use packaging tools on top of plain tar.gz, allowing you to track prerequisites for each package and providing for easy installation, upgrade, and cleanup. One of the most widely used packagers is the Red Hat Package Manager (RPM). See http://www.rpm.org/ for more information.

Under RPM, all you have to do is prepare a source distribution package (SRPM) and then build a binary release. The binary can be installed on any number of machines in a matter of seconds.

RPM will even work on live production machines. Suppose you have two identical machines (with identical software and hardware, although, depending on your setup, identical hardware may be less critical). Let's say that one is a live server and the other is for development. You build an RPM with a mod_perl binary distribution, install it on the development machine, and make sure that it is working and stable. You can then install the RPM package on the live server without any fear. Make sure that httpd.conf is correct, since it generally specifies parameters that are unique to the live machine (for example, the hostname).

When you have installed the package, just restart the server. It's a good idea to keep a package of the previous system, in case something goes wrong. You can then easily remove the installed package and put the old one back in case of problems.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.