Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

when using CPAN in linux ubuntu should I run it using sudo / as root or as my default user

I get errors like this

Running make install
Prepending blib/arch and blib/lib of 17 build dirs to PERL5LIB; for 'install'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/usr/local/man/man3'
Do not have write permissions on '/usr/local/man/man3'
  You may have to su to root to install the package
  (Or you may want to run something like
    o conf make_install_make_command 'sudo make'

Will I still be able to run the software / library's that perl / CPAN installs as a my default user.

What is the best practice when working with CPAN / Perl on Debian like systems.

like image 416
nelaaro Avatar asked Feb 23 '12 09:02

nelaaro


People also ask

Are sudo and root the same?

What is Sudo? The sudo (superuser do) command is a command-line utility that allows a user to execute commands as the root or a different user. It provides an efficient way to grant certain users the appropriate permissions to use specific system commands or run scripts as the root user.

How do I use sudo as a root user?

To use sudo when using the command line, simply type "sudo" before the command you wish to run. Sudo will then prompt you for your password. Sudo will remember your password for a set amount of time (15 minutes by default).

What is CPAN Linux?

The Comprehensive Perl Archive Network (CPAN in short) is a popular central repository of currently 188,714 Perl modules in 40,986 distributions. It is a single location where you can find, download and install any of the incredible (and still growing) collection of Perl libraries.

What is the point of sudo?

Sudo (superuser do) is a utility for UNIX- and Linux-based systems that provides an efficient way to give specific users permission to use specific system commands at the root (most powerful) level of the system. Sudo also logs all commands and arguments.


1 Answers

You should run the cpan command as your normal user. You have two choices:

  1. Install modules into a directory under your home dir. local::lib will help you set that up.

  2. Configure cpan to use sudo during the install phase. You do that by starting the cpan shell and typing:

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

    The first line configures MakeMaker to use sudo. The second line does the same for Module::Build. The third line saves the changes.

like image 155
cjm Avatar answered Oct 26 '22 08:10

cjm