Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install cpanm and local::lib if I can't write to ~/? [closed]

Tags:

perl

cpan

As with many people whose sites are hosted on shared servers, I do not have root access, and the hosting company will not install Perl modules at the request of users.

Unfortunately, I also do not have write privileges to the ~/ folder, only to certain subfolders (such as ~/cgi-bin/).

I've attempted the solution suggested here, changing ~/perl5 to ~/cgi-bin/perl5 (which I created), but I keep getting this error:

"Can't write to cpanm home '~/.cpanm': You should fix it with chown/chmod first."

The problem is, as I stated, I don't have write privileges to ~/.

Is there some way to tell the installer to use ~/cgi-bin/.cpanm instead? I've tried to figure it out by searching on here and elsewhere on the internet, but I'm starting to bash my head against the wall.

EDIT : So I've tried the suggestion by Steven below, using this command:

HOME=$HOME/cgi-bin cpanm local::lib

Now, cpanm successfully runs and tries to install the module, but has numerous warnings throughout the installation and ultimately fails (presumably something is still trying to write to a forbidden folder??).

Here are some sample warnings:

Warning: prerequisite CPAN 1.82 not found. We have 1.7601.

Warning: prerequisite ExtUtils::Install 1.43 not found. We have 1.32.

Warning: prerequisite ExtUtils::MakeMaker 6.42 not found. We have 6.17.

Warning: prerequisite Module::Build 0.36 not found.

Warning: You do not have permissions to install into /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi at /usr/lib/perl5/5.8.5/ExtUtils/Install.pm line 114.

mkdir /usr/lib/perl5/5.8.5/App: Permission denied at /usr/lib/perl5/5.8.5/ExtUtils/Install.pm line 176

make: *** [pure_perl_install] Error 255

like image 418
WinnPh Avatar asked Nov 12 '22 12:11

WinnPh


1 Answers

~ is just a shorthand way of accessing the environment variable $HOME, so you should be able to do something like export HOME=$HOME/cgi-bin to move your effective home directory down into some directory you have write permissions for. This will affect many things, however, so be careful.

like image 70
Chris Dodd Avatar answered Nov 15 '22 07:11

Chris Dodd