This document shows you the steps to install PERL modules locally without root access on a node.

PERL comes with a single library $PERL_HOME/lib which contains the standard and recommended modules. This is usually in a system location where you cannot install your modules. PERL also has a default value for a directory where users can install their own PERL modules. On workstations we suggest using the ~/local/perl5libs/lib/perl5 location. This directory doesn't exist by default. The first time a user installs a PERL module, it will be created. You have to include this path in your PERL5LIB environment variable.

Install Module From Web

First you need to load the module for PERL:

module load perl

To install package DBD::SQLite, use this command:

cpanm --local-lib ~/local/perl5libs DBD::SQLite

Its output should be something similar to this:

--> Working on DBD::SQLite
Fetching http://www.cpan.org/authors/id/I/IS/ISHIGAKI/DBD-SQLite-1.64.tar.gz ... OK
Configuring DBD-SQLite-1.64 ... OK
Building and testing DBD-SQLite-1.64 ... OK
Successfully installed DBD-SQLite-1.64
1 distribution installed

Now let's check that perl can find DBD::SQLite:

> export PERL5LIB=~/local/perl5libs/lib/perl5
> perl -MDBD::SQLite -le 'print $INC{"DBD/SQLite.pm"}'
/home/<YOUR USERNAME>/local/perl5libs/lib/perl5/x86_64-linux-thread-multi/DBD/SQLite.pm

This command shows PERL include path:

perl -e 'print "@INC"'

Install Module From Local File

First you need to load the module for PERL:

module load perl

We're assuming you have a directory structure as outlined in Creating My Own Modules.

Let's download or copy the package to your local directory:

cd ~/local/src/packages
cp <SOMEWHERE SHARED>/DBD-SQLite-1.64.tar.gz .

Or you can download it:

cd ~/local/src/packages
wget http://www.cpan.org/authors/id/I/IS/ISHIGAKI/DBD-SQLite-1.64.tar.gz

To install package DBD::SQLite, use this command:

cpanm --local-lib ~/local/perl5libs ~/local/src/packages/DBD-SQLite-1.64.tar.gz

Its output should be something similar to this:

--> Working on DBD::SQLite
--> Working on /home/<YOUR USERNAME>/local/src/pakacges/DBD-SQLite-1.64.tar.gz
Fetching file:///home/<YOUR USERNAME>/local/src/pakacges/DBD-SQLite-1.64.tar.gz ... OK
Configuring DBD-SQLite-1.64 ... OK
Building and testing DBD-SQLite-1.64 ... OK
Successfully installed DBD-SQLite-1.64
1 distribution installed

Now let's check that perl can find DBD::SQLite:

> export PERL5LIB=~/local/perl5libs/lib/perl5
> perl -MDBD::SQLite -le 'print $INC{"DBD/SQLite.pm"}'
/home/<YOUR USERNAME>/local/perl5libs/lib/perl5/x86_64-linux-thread-multi/DBD/SQLite.pm

This command shows PERL include path:

perl -e 'print "@INC"'

Removing packages

Just delete the files in your local PERL library path.

References

Documentation from CPAN Minus.