使用'cpan'安装Perl模块时,如何避免sudo-ing? [英] How can I avoid sudo-ing when installing Perl modules with 'cpan'?

查看:76
本文介绍了使用'cpan'安装Perl模块时,如何避免sudo-ing?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将Perl从源代码安装到/ usr / local,并根据布莱恩·福伊的建议在这里。

I have installed Perl from source into /usr/local, and adjusted my path accordingly, following brian d foy's suggestion here.

我确定我丢失了一些东西,但是,现在我尝试安装带有 cpan命令的文件,它失败了,因为它无法写入/ usr / local。我必须使用sudo,这对我来说是错误的。 CPAN资料应否转到其他位置?

I'm sure I'm missing something, but, now I'm trying to install stuff with the 'cpan' command and it's failing because it can't write to /usr/local. I have to use sudo, which feels wrong to me. Should CPAN stuff go to another location? Is it normal to have to use sudo?

推荐答案

如果确实困扰您使用 sudo

If it really bothers you to use sudo, you can use local::lib and install modules in your home directory - where you don't need super-user privileges.

那是应该的,麻烦您使用 sudo 。不一定没有错。正如Gbacon所说,如果要安装在 / usr / local 中,则需要它,因为 / usr / local 是共享的由系统上的 all 用户(因此其权限反映了这一点):

That said, it shouldn't bother you to use sudo. There's nothing necessarily wrong with it. As Gbacon says, you need it if you want to install in /usr/local because /usr/local is shared by all users on the system (and so its permissions reflect that):


    telemachus ~ $ ls -ld /usr/local/
    drwxr-xr-x 17 root wheel 578 Jan  8 20:00 /usr/local/

这篇关于使用'cpan'安装Perl模块时,如何避免sudo-ing?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆