[英]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:你有两个选择:
Install modules into a directory under your home dir.将模块安装到您的主目录下的目录中。 local::lib will help you set that up.
local::lib将帮助您进行设置。
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.