Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install Perl modules without root privileges?

I am on a Linux machine where I have no root privileges. I want to install some packages through CPAN into my home directory so that when I run Perl, it will be able to see it.

I ran cpan, which asked for some coniguration options. It asked for some directory, which it suggested ~/perl "for non-root users". Still, when I try to install a package, it fails at the make install step, because I don't have write access to /usr/lib/perl5/whatever.

How can I configure CPAN so that I can install packages into my home directory?

like image 995
petersohn Avatar asked Sep 17 '10 13:09

petersohn


People also ask

How do I install Perl modules in CPAN?

To install Perl modules using CPAN, you need to use the cpan command-line utility. You can either run cpan with arguments from the command-line interface, for example, to install a module (e.g Geo::IP) use the -i flag as shown.


1 Answers

See local::lib.

Once you have it installed, you can do:

perl -MCPAN -Mlocal::lib -e 'CPAN::install(LWP)'

like image 141
Sinan Ünür Avatar answered Oct 03 '22 10:10

Sinan Ünür