Table of Contents
Set up a private Perl Module library for Your User Space
Nowadays, it's common for people providing programs or scripts to assume everyone's an admin, and can load whatever library or do whatever admin-level install they need to do. All their installation instructions assume you can just install files to /usr/local/lib and such. Well as an SDF user on the cluster or Metaarray, you can't do this, so you need to figure out how to install these things not as admin (which used to be pretty common knowledge).
In trying to use CPAN on SDF systems, there are one to three problems to overcome:
First, because of the shared server aspects of SDF:
- Perl modules need to be installed somewhere in your $HOME where you have write access.
And, particular to the cluster (for USER and ARPA level, or META folks using the cluster):
- The `make` command must be run from inside /tmp.
- The `make` command location has to be pointed to the non-standard place that SDF has it
cpanmis not installed on the cluster
The different setups are discussed below.
Cluster Setup
For some reason cpanm (aka cpanminus) is not installed on the cluster, so you can't use the much simpler steps below. Also, the cluster now requires you to 'make' in the /tmp folder, so suddenly things are trickier. You need to use the regular, slow & verbose cpan to install local libraries, and you also need to configure it as follows:
This is solved by bootstrapping local::lib and setting up CPAN so that it uses a directory under /tmp to do its work. Follow these steps:
bootstrap local::lib
cd /tmp wget https://cpan.metacpan.org/authors/id/H/HA/HAARG/local-lib-2.000029.tar.gz tar zxvf local-lib-2.000029.tar.gz cd local-lib-2.000029 perl Makefile.PL --bootstrap eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"
Configure cpan
Run CPAN shell and configure for building in /tmp yet putting the files in your local 'perl5' folder
perl -MCPAN -e shell o conf build_dir /tmp/<your login>-cpan-build o conf make_install_make_command "/usr/local/bin/make" o conf commit quit
The above commands start with “o”, those aren't bullets.
(Replace “<your login>” with your own username so that your build directory doesn't collide with another user's build directory, ex: /tmp/brainiac5-cpan-build)
Next, run the following lines at shell to get this into your .profile:
eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib` echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile echo 'export MANPATH=$HOME/perl5/man:$MANPATH' >> ~/.profile echo 'export PATH=$HOME/perl5/bin:$PATH >> ~/.profile
This setup only needs to be done once. Afterward you can do the following:
Run the CPAN shell
perl -MCPAN -e shell
Run the CPAN shell (assuming your PATH is setup right)
cpan
See what modules you've installed locally.
tree $HOME/perl5/lib/perl5
See what scripts were installed locally.
ls -l $HOME/perl5/bin
Afterwards, you will be able to just run cpan install to add a library that your perl script is complaining about being missing. For example:
cpan install Text::Markdown
(it will spew a whole ton of steps, including seemingly infinite numbers of tests, but eventually should build ok)
Actually, after all that, you should be able to install cpanminus aka cpanm:
cpan install App::cpanminus
Metaarray Setup
This also applies to the vhost server, norge
For the metaarray and the vhost servers, cpanm is a perl package manager that's already installed. Run each of the lines below to create a personal perl module library to be able to add modules that may be missing when you try to run some perl scripts you wrote or obtained.
(If cpanm for some reason isn't installed on the metaarray, run curl http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib before the below)
eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib` echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile echo 'export MANPATH=$HOME/perl5/man:$MANPATH' >> ~/.profile
Afterwards, you will be able to just run cpanm to add a library that your perl script is complaining about being missing. For example:
cpanm Text::Markdown
You can find more tips like this at: Common Configurations for Programs
