develooper Front page | perl.qa | Postings from October 2007

Running CPAN as a regular user, installing as root

From:
Matisse Enzer
Date:
October 18, 2007 10:32
Subject:
Running CPAN as a regular user, installing as root
I was following the comments in http://use.perl.org/~Alias/journal/ 
34680 and came across something that was new to me, and seemed worthy  
of repeating here - if only one other person learns this it'll be  
worth it:

In comment http://use.perl.org/comments.pl?sid=37249&cid=58370 brian  
d foy points out that these days there is a really easy way to run  
CPAN as a normal user, and install as root. Here's how to set your  
CPAn config to do this:


 From your shell prompt:

   sudo cpan

Then from the cpan shell:

   o conf make_install_make_command 'sudo make'
   o conf mbuild_install_build_command 'sudo ./Build'
   o conf commit
   quit

 From now on, run cpan as a regular user:

   cpan Some::New::Module

That will build as you, and install as root.

You may also need to change the permissions on your cpan_home  
directory so that your regular user can write to it.

Brian points out that Normal first-time configuration these days  
offers that, but if you are like me and have been upgrading CPAN on  
an old configuration you may have overlooked this very useful addition.

This public service announcement brought to you while I should be  
working for The Man.

-M

-------------------------------------------------------
Matisse Enzer <matisse@matisse.net>
http://www.matisse.net/  - http://www.eigenstate.net/






Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About