我应该如何安装多个版本的 Perl?

发布于 2024-08-02 16:13:37 字数 399 浏览 5 评论 0原文

我想从源代码安装 Perl 版本 5.005v5.6v5.8v5.10 >

现在我已经安装了“v5.10.0”。

/opt/perl/bin
/opt/perl/html
/opt/perl/lib
/opt/perl/man
/opt/perl/lib/5.10.0
/opt/perl/lib/site_perl
/opt/perl/lib/site_perl/5.10.0

如果我将它们全部安装在 /opt/perl 中,会有什么问题吗?

或者我应该将它们分成自己的、特定于版本的目录?就像/opt/perl-5.10.0/

I want to install, from source, Perl versions 5.005, v5.6, v5.8, v5.10

Right now I have 'v5.10.0' installed.

/opt/perl/bin
/opt/perl/html
/opt/perl/lib
/opt/perl/man
/opt/perl/lib/5.10.0
/opt/perl/lib/site_perl
/opt/perl/lib/site_perl/5.10.0

Will I have any problems if I install them all in /opt/perl?

Or should I split them up into their own, version specific, directories? Like /opt/perl-5.10.0/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

锦欢 2024-08-09 16:13:37

我将所有 perls 完全安装在它们自己的目录中,这样它们就不会与任何其他 perl 共享任何内容。为此,您只需告诉 Configure 脚本在哪里安装所有内容即可。我喜欢 /usr/local/perls

 % ./Configure -des -Dprefix=/usr/local/perls/perl-5.x.y

当我对多个版本执行此操作时,我会得到一个具有单独安装的目录。

% ls -1 /usr/local/perls
perl-5.10.0
perl-5.10.1
perl-5.6.2
perl-5.8.8

它们都有自己的 bin 和 lib 目录:

% ls -1 /usr/local/perls/perl-5.10.0
bin
lib
man

如果您使用不同的 perls 调用它们,大多数常见工具都会弄清楚要做什么:

/usr/local/perls/perl-5.10.0/bin/perl /usr/local/bin/cpan

但是,您可以将最想使用的 perl 放在路径的第一位。我只是创建了一个到 /usr/local/bin/perl 的符号链接,但您也可以将目录添加到 PATH 中。

perlbrew 为您做了很多这样的事情,并移动符号链接以使其之一它们是默认的 perl。但我不使用它,因为它不会让我的生活变得更轻松。不过这取决于你自己决定。

I install all of my perls completely in their own directory so they don't share anything with any other perl. To do that, you just tell the Configure script where to install everything. I like /usr/local/perls:

 % ./Configure -des -Dprefix=/usr/local/perls/perl-5.x.y

When I do that for multiple versions, I get a directory that has separate installations.

% ls -1 /usr/local/perls
perl-5.10.0
perl-5.10.1
perl-5.6.2
perl-5.8.8

They all have their own bin and lib directories:

% ls -1 /usr/local/perls/perl-5.10.0
bin
lib
man

Most of the common tools will figure out what to do if you call them with different perls:

/usr/local/perls/perl-5.10.0/bin/perl /usr/local/bin/cpan

However, you can take the perl you want to use the most and put it first in your path. I just make a symlink to /usr/local/bin/perl, but you can add directories to PATH as well.

The perlbrew does a lot of this for you and moves symlinks around to make one of them the default perl. I don't use it though because it doesn't make life easier for me. That's up to you decide on your own though.

绝不放开 2024-08-09 16:13:37

将它们拆分到各自版本的特定目录中,然后将 perl 符号链接到您当时希望使用的版本。这就是安装多个 JRE/JDK 的工作原理,因此这对于 Perl 安装似乎也有意义。

Split them into their own version specific directories, and then symlink perl to the version you wish to use at the time. This is how having multiple JREs/JDKs installed works, so it would seem to make sense for Perl installations as well.

蘑菇王子 2024-08-09 16:13:37

您确实应该将不同版本安装到不同的目录中。

,我使用 stowxstow 作为穷人的软件包管理器:

  • 当我想尝试一个软件包的多个版本,但我最喜欢的 Linux 发行版中不存在该软件包时 目录 /usr/local/stow
  • 将各个软件包安装到 /usr/local/stow/$PACKAGE-$VERSION
  • 将“软件包”映射到 /usr/ local: stow -d /usr/local/stow $PACKAGE-$VERSION
  • 停用“包”: stow -d /usr/local/stow -D $PACKAGE- $VERSION

stow 通过创建和操作符号链接来完成其工作,并且能够检测冲突。

You really should install the different versions into distinct directories.

When I want to try multiple versions of a package that doesn't exist as packages for my favorite Linux distribution, I use stow or xstow as a poor man's package manager:

  • Create a directory /usr/local/stow
  • Install individual packages into /usr/local/stow/$PACKAGE-$VERSION
  • map a "package" into /usr/local: stow -d /usr/local/stow $PACKAGE-$VERSION
  • deactivate a "package": stow -d /usr/local/stow -D $PACKAGE-$VERSION

stow does its work by creating and manipulating symlinks and it is able to detect conflicts.

落花随流水 2024-08-09 16:13:37

如果您使用 CentOS/RHEL 服务器,则可以使用相对较新的 Software Collection 系统来安装“系统 Perl”(EL6 上的古老 5.10 和 EL5 上的古老 5.8)之外的其他版本的 Perl。

有一组核心 Perl 5.16 软件包的公共存储库:

http://mirror.centos .org/centos/6/SCL/x86_64/

社区正在致力于将 CPAN 的更大子集作为可安装包发布,并发布其他版本 Perl 的集合。

If you're using CentOS/RHEL servers, you can use the relatively new Software Collection system to install other versions of Perl in addition to the "system Perl" (which is an ancient 5.10 on EL6 and 5.8 on EL5).

There are public repositories for a core set of Perl 5.16 packages:

http://mirror.centos.org/centos/6/SCL/x86_64/

The community is working on publishing a larger subset of CPAN as installable packages and publishing collections for other versions of Perl as well.

彩虹直至黑白 2024-08-09 16:13:37

我们在工作中使用多个版本的 Perl 进行开发,并且单独的目录是正确的方法。我们设置了一个小的 shell 命令来修复符号链接和环境变量,以便您可以轻松地使用您想要的 perl。

如果您担心忘记正在使用哪个 perl,您可以使用这样的脚本将版本号添加到 shell 提示符中。

We develop with multiple versions of Perl here at work, and separate directories is the way to go. We've set up a small shell command that fixes up symlinks and environment variables so you can use the perl you want easily.

If you're worried about forgetting which perl is being used, you could have such a script add a version number to your shell prompt.

坏尐絯 2024-08-09 16:13:37

虽然安装到不同的目录通常是更好的方法,但您可以使用配置开关 -Dversiononly 来使用单个目录并在所有路径名中包含版本三元组(man 文件除外,您可以在可能想完全避免安装),
例如为您提供 perl5.10.0cpan5.10.0perldoc5.10.0 等。

While installing into different directories is usually a better way to go, you can use the Configure switch -Dversiononly to use a single directory and include the version triplet in all pathnames (except man files, which you'd probably want to avoid installing altogether),
giving you for example a perl5.10.0, cpan5.10.0, perldoc5.10.0, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文