InstallCpanModules

This is my contribution after several frustrating hours of trying to install CPAN modules on Dreamhost servers. Thanks to Andrew for reviewing this page and simplifying the heck out of the instructions.

Basics
The basic idea is to use cpanminus to install all modules which is much easier to use than cpan. We set it up to not run the tests when installing modules. While this is potentially unsafe, it means that you typically don't have to deal with the Killed message if your processes use up too much CPU and/or memory.

Update your profile
Update your .profile or .bashrc files to include the following lines (assuming your local directory is perl5 under your home directory, change the first line if you want it to be called something else)

export PERLMOD=perl5 # name of directory under home where perl modules are installed export PATH="$PATH:$HOME/$PERLMOD/bin" export PERL5LIB="$HOME/$PERLMOD/lib/perl5" export PERL_CPANM_OPT="--local-lib=$HOME/$PERLMOD --notest"

Update your current session
cd source .bashrc # or .profile if that is the file you updated echo $PERL_CPANM_OPT # should show the correct value

Start clean
If you have had prior failed attempts to install local modules using cpan or cpanminus, it is better you start clean. If not, just skip this section.

cd $HOME rm -rf .cpan/ .cpanm/ perl5/ # assuming perl5/ is the local directory that you set up

Install cpanminus
curl -L http://cpanmin.us | perl - --self-upgrade

The code above installs cpanminus for local install of CPAN modules under ~/${PERLMOD} (~/perl5 in the above example)

Test your install
Install a module from CPAN and verify that it installs correctly. I'm using the Acme module as an example.

cpanm Acme # should install Acme under ~/perl5 (or whatever local directory you are using) perl -MAcme -e0 # should return without errors

Consider installing modules with tests enabled
If you want to install packages and run the tests, change your .profile or .bashrc for the line that sets cpanminus options and remove the --notest option

export PERL_CPANM_OPT="--local-lib=$HOME/$PERLMOD "

Note: This should not result in the Killed message since cpanminus installs are not subject to being killed.

Install some modules
cpanm Catalyst Catalyst::Devel # etc.

Krishnan 15:43, 8 March 2011 (PST)