使用非root用户和不使用CPAN来安装Perl模块和依赖项

使用非root用户和不使用CPAN来安装Perl模块和依赖项

本文介绍了使用非root用户和不使用CPAN来安装Perl模块和依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在为自己的工作编写Perl脚本,而要使用的机器使安装Perl模块变得困难:

I have been writing Perl scripts for my work and the machine that I have been given to work on makes installing Perl modules difficult:

  • 出于安全原因,我们无法在计算机上安装gcc,因此对于大多数模块,我无法使用CPAN来安装模块.
  • 我无权访问root帐户.
  • We cannot have gcc on my machine for security reasons, so I cannot use CPAN to install modules, for most modules.
  • I do not have access to the root account.

通常,当我想安装模块时,我提出了一个请求,必须等待一两天才能安装它.我知道没有人会麻烦我自己安装它们,因此为了节省大家的时间和理智,我想自己安装它们.这只是如何最好地做到这一点的问题.我已经与各种人交谈过,他们说要使用RPM来安装它们(绕过没有gcc的位置).但是,当尝试从RPM安装模块时,它无法处理依赖关系,因此我需要手动处理依赖关系,这可能需要一段时间.

Usually, when I want to install a module, I put in a request and I have to wait a day or two before it gets installed. I know that nobody would have a problem with me installing them myself, so to save everyone's time and my sanity I would like to install them myself. It's just an issue of how to best do that. I have talked to various people and they said to use an RPM to install them (to get around not having gcc). However, when trying to install modules from RPMs, it does not handle the dependencies so I would manually need to handle the dependencies, which could take a while.

如何最好地安装具有这些限制的Perl模块?

How can I best install Perl modules with these limitations?

推荐答案

在具有类似Perl的类似机器上,使用

On a similar machine with a similarly built Perl, install the module(s) using

mkdir ~/foo
cpan
o conf makepl_arg 'PREFIX=~/foo LIB=~/foo/lib/perl5'
o conf mbuildpl_arg '--prefix ~/foo --lib ~/foo/lib/perl5'
install Some::Module

只要您不执行o conf commit,配置更改都是临时的,因此请勿执行.

As long as you don't do o conf commit, the configuration change will be temporary, so don't do that.

复制~/foo,并设置env var PERL5LIB以包括LIB目录.您可以将较新的~/foo合并到较旧的~/foo中,以添加新的模块.

Copy ~/foo over, and set env var PERL5LIB to include the LIB directory. You can merge a newer ~/foo into an older one to add new modules.

这不会安装模块所依赖的任何非Perl库.

This won't install any non-Perl libraries on which the modules depend.

这篇关于使用非root用户和不使用CPAN来安装Perl模块和依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 15:43