Re: Building and installing mod_perl as a complete package

Torsten Förtsch <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On Wednesday, November 24, 2010 02:28:40 Mohit Anchlia wrote:
> 1. Is it possible to build it such that I don't have to run make
> install on every web server?  Is there a way to build mod_perl that
> contains everything including perl modules? This will help in install
> and keeping track of mod_perl in only one place.

How about using a package system like RPM?

Also, "make install" supports the "DESTDIR=..." option. For example

  make DESTDIR=/tmp/buildroot install

That won't install anything under your normal root directory but instead 
/tmp/buildroot will look like / with respect to the installed files.

So, after installing you can pack /tmp/buildroot into a tar file:

  (cd /tmp/buildroot && tar cf - .) | gzip -9 >mp-install.tar.gz

Now, go to the destination machine and unpack the tar as:

  zcat mp-install.tar.gz | (cd / && tar xf -)

Note the different cd commands in packing and unpacking.

> 2. Also, is it possible to Keep all the install modules and files
> local to apache install directory instead of having to create perl
> modules

That can be achieved by setting some variables similar to DESTDIR on the "make 
install" command line. It can also be combined with DESTDIR. For example:

  make DESTDIR=... \
       INSTALLSITEARCH=... \
       INSTALLSITELIB=... \
       ... \
       install

I used to set DESTDIR, INSTALLSITEARCH, INSTALLSITELIB, INSTALLSITEBIN, 
INSTALLSITESCRIPT, INSTALLBIN, INSTALLSCRIPT, INSTALLSITEMAN1DIR and 
INSTALLSITEMAN3DIR in one of my SPEC files. See ExtUtils::MakeMaker for more 
information.

But be aware that you will then have to let Perl know about the different 
locations by setting @INC. That can be done for example by setting PERL5LIB 
prior to starting apache or by using "PerlSwitches -I ..." or by issuing a 
"use lib" or "BEGIN {@INC=(...)}" or something similar. Recent perl versions 
can be compiled with -Dusesitecustomize which can also help here. See INSTALL 
in the root directory of you perl source package.

> 3. Is it possible to deploy the modules that I create local to apache
> install directory? Currently I found one of the paths from @INC and
> created module there. But the problem is that we have too many
> webservers and install is going to be a problem.

You have to install your own modules in a location where perl can find them, 
see above.

> 4. Is there a way to dynamically change perl module without having to
> stop or start apache?

The best approximation is Apache::Reload. Due to the nature of perl it cannot 
catch all possible cases. But if you write your modules with a possible reload 
in mind it can do a good job.

Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.