Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Installing CPAN without root access

by vihar (Acolyte)
on Sep 10, 2013 at 14:04 UTC ( #1053274=perlquestion: print w/replies, xml ) Need Help??
vihar has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to install CPAN so I can install some CPAN Perl modules. I don't have root access so I am trying to install everything on this remote server locally under my user id.

I tried the yum command:  yum -y install perl-CPAN which obviously doesn't work because I am not a root user.

I also tried installing CPAN without yum command, which just returns an error saying CPAN.pm can't be located.

I did my research and gathered info that in order to install these modules locally, I would need to set proper environment variables under perl5 directory. I am not sure how to do that. Also, every time I unzip a tar file for any module and try to run the install command, it returns an error saying that module's .pm file is not located.

Any suggestions or directions on how I can go about doing this? Thanks

Replies are listed 'Best First'.
Re: Installing CPAN without root access
by McA (Priest) on Sep 10, 2013 at 15:19 UTC

    Hi,

    the solution depends heavily on the question whether you want to stick to the system's perl installation or if you want a current Perl version too.

    If you say: Hey, I start by own directory tree for modules why should I not also install a perl for my own, than have a look at http://perlbrew.pl/. (App::perlbrew)

    If you say: No, please, I just want some modules on my own, than have a look at local::lib and for nice installation to App::cpanminus.

    UPDATE: I forgot something. The local::lib thing is meanwhile integrated into the App::perlbrew. So you can think of the App::perlbrew way as a kind of superset.

    McA

      I tried installing App::perlbrew but I keep getting error with the curl command they have provided on the website that curl couldn't connect to host. Thanks for your help though

        but I keep getting error with the curl command they have provided on the website that curl couldn't connect to host.

        And then what happened?

        You probably have an HTTP proxy on your network. Set it in the http_proxy variable. Check the curl man page.
Re: Installing CPAN without root access
by keszler (Priest) on Sep 10, 2013 at 15:46 UTC
Use cpanm and local::lib
by dolmen (Beadle) on Sep 11, 2013 at 14:55 UTC
    Bootstrap:
    $ PATH="$PATH:~/perl5/bin" $ export PERL5LIB=~/perl5/lib/perl5 $ export PERL_MB_OPT="--install_base '$HOME/perl5'" $ export PERL_MM_OPT="INSTALL_BASE=$HOME/perl5" $ curl -L http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local:: +lib
    Then adapt your .profile for local::lib and cpanm by adding this line:
    eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)
    Now you can just do: cpanm any-module

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1053274]
Approved by NetWallah
Front-paged by NetWallah
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2017-07-22 14:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (340 votes). Check out past polls.