Saturday, March 23, 2013

Running perl system and cpan as non-root user...

The easiest method I have found so far is to say
wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
or for non wgetters..
curl -L http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
Then:
eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile
On Linux Systems
echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.bash_profile
This assumes your profile is named .profile, you may need to change that to be .bash_profile, .bashrc, etc. After that you can install modules by saying
cpanm Module::Name
and simply use them the same way you would if the were installed in the root directories. In some cases the install does not work... then you can split things up (for the http_proxy it seems it explicitly needs 'http:' or 'https:'). The second item would add the ignore expired certificate on the wget command.
export http_proxy=http://my.proxy.org:3128
export https_proxy=http://my.proxy.org:3128
export PERL5LIB=~/perl5/lib/perl5/
wget --no-check-certificate -O cpan.pl http://cpanmin.us
perl cpan.pl -l ~/perl5 App::cpanminus local::lib
At times this even fails and use --force
perl cpan.pl --force -l ~/perl5 App::cpanminus local::lib

No comments:

Post a Comment