Installation of mod_perl-enabled Apache Without Superuser Privileges
As you have seen from my previous articles, mod_perl-enabled Apache consists of two main components: Perl modules and Apache itself. While installing Apache without root privileges is a very easy task, one should know how to install Perl modules in a non-systemwide location. In this article I'll show different ways to tackle this task.While installing Apache without root privileges is a very easy task, one should know how to install Perl modules in a non-systemwide location. In this tutorial, Stas Bekman describes how to do just that.
In the examples used in this article I'll use
stas as a
/home/stas as a home directory of that user.
Since without superuser permissions you aren't allowed to install modules
into system directories like
/usr/lib/perl5, you need to find out
how to install the modules under your home directory. It's easy.
First you have to decide where to install the modules. The simplest
approach is to simulate the portion of the
/ file system relevant
to Perl under your home directory. Actually we need only two directories:
We don't have to create them, since that will be done automatically when
the first module is installed. 99 percent of the files will go into the
lib directory. Occasionally, when some module distribution comes
with Perl scripts, these will go into the
bin directory. This
directory will be created if it doesn't exist.
Let's install the
CGI.pm package, which includes a few other
CGI::* modules. As usual, download the package from the CPAN
repository, unpack it and
chdir to the newly-created directory.
Now do a standard
perl Makefile.PL to prepare a Makefile, but
this time tell
MakeMaker to use your Perl installation directories
instead of the defaults:
% perl Makefile.PL PREFIX=/home/stas
PREFIX=/home/stas is the only part of the installation process
which is different from usual. Note that if you don't like how
MakeMaker chooses the rest of the directories, or if you are using
an older version of it which requires an explicit declaration of all the target
directories, you should do this:
% perl Makefile.PL PREFIX=/home/stas INSTALLPRIVLIB=/home/stas/lib/perl5 INSTALLSCRIPT=/home/stas/bin INSTALLSITELIB=/home/stas/lib/perl5/site_perl INSTALLBIN=/home/stas/bin INSTALLMAN1DIR=/home/stas/lib/perl5/man INSTALLMAN3DIR=/home/stas/lib/perl5/man3
The rest is as usual:% make % make test % make install
make installinstalls all the files in the private repository. Note that all the missing directories are created automatically, so there is no need to create them in first place. Here (slightly edited) is what it does :Installing /home/stas/lib/perl5/CGI/Cookie.pm Installing /home/stas/lib/perl5/CGI.pm Installing /home/stas/lib/perl5/man3/CGI.3 Installing /home/stas/lib/perl5/man3/CGI::Cookie.3 Writing /home/stas/lib/perl5/auto/CGI/.packlist Appending installation info to /home/stas/lib/perl5/perllocal.pod
If you have to use the explicit target parameters, instead of a single
PREFIXparameter, you will find it useful to create a file called (for example)
/home/stasin our example) containing:PREFIX=/home/stas INSTALLPRIVLIB=/home/stas/lib/perl5 INSTALLSCRIPT=/home/stas/bin INSTALLSITELIB=/home/stas/lib/perl5/site_perl INSTALLBIN=/home/stas/bin INSTALLMAN1DIR=/home/stas/lib/perl5/man INSTALLMAN3DIR=/home/stas/lib/perl5/man3