Our Sponsors

Download BioinformaticsOnline(BOL) Apps in your chrome browser.



Question: Question: How to install Perl packages on servers?

Shruti Paniwala
298 days ago

Question: How to install Perl packages on servers?

I am problem installing Perl module on cluster/server without root. Can you please recommend me a easy way or alternative way to install it.

Best Answer

I found App::cpanminus very handy in such cases. It create a local Perl5 directory in you profile.

wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
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

Then try cpanm Your::Module

More at http://search.cpan.org/~miyagawa/App-cpanminus-1.7042/lib/App/cpanminus.pm

I tried on my cluster and it work like water ;) Thanks Jit

[10:37:18]shruti@hercules:~$ wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
--2017-02-23 10:37:42--  http://cpanmin.us/
Resolving cpanmin.us (cpanmin.us)...,,, ...
Connecting to cpanmin.us (cpanmin.us)||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 304878 (298K) [text/plain]
Saving to: ‘STDOUT’

-                   100%[=====================>] 297.73K  --.-KB/s   in 0.05s  

2017-02-23 10:37:43 (6.30 MB/s) - written to stdout [304878/304878]

--> Working on App::cpanminus
Fetching http://www.cpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7042.tar.gz ... OK
Configuring App-cpanminus-1.7042 ... OK
Building and testing App-cpanminus-1.7042 ... OK
Successfully installed App-cpanminus-1.7042
--> Working on local::lib
Fetching http://www.cpan.org/authors/id/H/HA/HAARG/local-lib-2.000019.tar.gz ... OK
Configuring local-lib-2.000019 ... OK
==> Found dependencies: ExtUtils::MakeMaker
--> Working on ExtUtils::MakeMaker
Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.24.tar.gz ... OK
Configuring ExtUtils-MakeMaker-7.24 ... OK
Building and testing ExtUtils-MakeMaker-7.24 ... OK
Successfully installed ExtUtils-MakeMaker-7.24 (upgraded from 6.98)
Building and testing local-lib-2.000019 ... OK
Successfully installed local-lib-2.000019
3 distributions installed
[10:40:07]shruti@hercules:~$ eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`
Attempting to create directory /home/shruti/perl5
[10:48:57]shruti@hercules:~$ echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile
[10:49:09]shruti@hercules:~$ echo 'export MANPATH=$HOME/perl5/man:$MANPATH' >> ~/.profile
[10:49:18]shruti@hercules:~$ cpanm
Usage: cpanm [options] Module [...]

Try `cpanm --help` or `man cpanm` for more options.

Shruti Paniwala 295 days ago

Other Answers

App::cpanminus looks intersting, I will give it a try.

This webpage also explain various approaches. http://web.archive.org/web/20120427144232/http://perl.jonallen.info/writing/articles/install-perl-modules-without-root

Hope useful.