Configuring CPAN.pm to use sudo to install
by bigpresh on Mar.31, 2011, under Perl, System Administration
For security, I like to run CPAN.pm as a normal user so building & testing modules are all performed as a user rather than root, but of course the final installation needs to be done as root so that files can be copied to paths not writeable by normal users.
I always forget the options I need, so for my future reference as well as anyone else who finds it useful:
o conf make_install_make_command 'sudo make' o conf mbuild_install_build_command 'sudo ./Build'
That means that the actual installation gets run via sudo, with everything else just being done as the user you started the CPAN client as.
(Of course, these days, you could also use cpanm (cpanminus) with its –sudo option…)
August 11th, 2011 on 3:14 am
you need try cpanm install perl mod
August 11th, 2011 on 9:28 am
I do use cpanm these days – it’s far faster and easier :)
To make cpanm use sudo as appropriate, and also use my mirror, I have the following in my .profile: