简体   繁体   English

在 linux ubuntu 中使用 CPAN 时,我应该使用 sudo / 作为 root 还是作为我的默认用户运行它

[英]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.我是否仍然能够以我的默认用户身份运行 perl/CPAN 安装的软件/库。

What is the best practice when working with CPAN / Perl on Debian like systems.在类似 Debian 的系统上使用 CPAN/Perl 时的最佳实践是什么。

You should run the cpan command as your normal user.您应该以普通用户身份运行cpan命令。 You have two choices:你有两个选择:

  1. Install modules into a directory under your home dir.将模块安装到您的主目录下的目录中。 local::lib will help you set that up. local::lib将帮助您进行设置。

  2. Configure cpan to use sudo during the install phase.cpan配置为在安装阶段使用sudo You do that by starting the cpan shell and typing:你可以通过启动cpan shell 并输入:

     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 .第一行将MakeMaker配置为使用sudo The second line does the same for Module::Build .第二行对Module::Build执行相同的操作。 The third line saves the changes.第三行保存更改。

If you want to install your modules for your own use, then you should be running it as yourself.如果您想安装自己的模块供您自己使用,那么您应该自己运行它。 Use local::lib to set up your environment variables so that this works nicely.使用local::lib来设置您的环境变量,以便它很好地工作。 You may wish to look at cpan minus as an alternative to the default cpan installer.您可能希望查看cpan minus作为默认 cpan 安装程序的替代方案。

You may also wish to consider using perlbrew to install a newer version of perl that is completely independent from the system perl.您可能还希望考虑使用perlbrew安装完全独立于系统 perl 的较新版本的 perl。

If you want to install them system wide, then I recommend (since you have tagged this ubuntu ) looking at dh-make-perl to produce .deb files that you can install and uninstall with dpkg.如果你想在系统范围内安装它们,那么我建议(因为你已经标记了这个ubuntu )查看dh-make-perl来生成 .deb 文件,你可以使用 dpkg 安装和卸载这些文件。

If you want to install modules as a non-root user, you can configure your cpan to use an install base:如果您想以非 root 用户身份安装模块,您可以将 cpan 配置为使用安装库:

makepl_arg         [INSTALL_BASE=/home/nelaar/perl]
mbuildpl_arg       [--install_base=/home/nelaar/perl]

And set PERL5LIB accordingly to /home/nelaar/perl/lib/perl5 .并将 PERL5LIB 相应地设置为/home/nelaar/perl/lib/perl5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 Linux 上使用 sudo 在后台运行 dotnet 应用程序? - How can I run a dotnet application in the background using sudo on Linux? SSH从我的本地机器到linux主机,sudo到root用户 - SSH from my local machine to linux host and sudo to root user root和用户使用sudo的不同路径变量 - Different path variables for root and user using sudo 使用Linux功能使用sudo运行ifup和ifdown - Run ifup and ifdown with sudo using linux capability 在Linux ubuntu 17.04中运行的R程序中使用“ sudo cp” - Using “sudo cp” in an R program that runs in Linux ubuntu 17.04 如何使用Free Pascal将sudo \ root密码传递给Linux命令 - How to pass sudo\root password to a Linux command using Free Pascal 编写可以以root / sudo身份运行的linux脚本 - Write a linux script that can be run as root/sudo 如何在不使用 sudo 且不在根目录下运行 man ? - How do I run man without using sudo and not under root directory? 如何允许其他用户像我一样像 sudo 一样运行特定程序,但我们俩都不是 Linux 中的 root 用户 - How to allow other user to run a specific program as me like sudo, but both of us are not root in Linux 我在 Linux 上的简单守护程序应该在哪个系统用户上默认运行以获得最佳兼容性? - On which system user my simple daemon on Linux should run as default for best compatibility?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM