CentOS8安装perl环境

转载用于记录:如侵权请联系我删除

一、需要下载tar包,因此我用的(二)perlbrew 方式安装 perl

1.1 perl 源码安装(忽略,该方式本人未成功,请参考后面的(二)perlbrew 方式安装 perl)

安装 perl 之前需要先安装 make, gcc

代码如下:

yum install gcc make

然后开始安装:

代码如下:

wget http://www.cpan.org/src/5.0/perl-5.20.1.tar.gz
tar -xzf perl-5.20.1.tar.gz
cd perl-5.20.1
./Configure -des -Dprefix=$HOME/localperl
make
make test
make install

二、perlbrew 方式安装 perl

2.1 perlbrew 安装

代码如下:

[root@ithomer ~]# yum install perlbrew
[root@ithomer ~]# perlbrew version
/usr/bin/perlbrew– App::perlbrew/0.28

2.1.1 如果上面安装失败,可使用 cpan 安装 perlbrew,如果上面成功(可忽略)

代码如下:

sudo yum install cpan
sudo cpan App::perlbrew
perlbrew init
perlbrew version

2.2 perlbrew 初始化

代码如下:

[root@ithomer ~]# perlbrew init
Perlbrew environment initiated, required directories are created under/p

~/perl5/perlbrew

Paste the following line(s) to the end of your ~/.bashrc and start a
new shell, perlbrew should be up and fully functional from there:

source ~/perl5/perlbrew/etc/bashrc

For further instructions, simply run perlbrew to see the help message.

Enjoy perlbrew at $HOME!!

重点

根据上面提示,复制 source ~/perl5/perlbrew/etc/bashrc 粘贴到 ~/.bashrc 文件最后一行,保存。

2.3 perlbrew 安装 perl

代码如下:

[root@ithomer ~]# perlbrew available
# perl
   perl-5.36.0   
   perl-5.34.1   
   perl-5.32.1   
   perl-5.30.3   
   perl-5.28.3   
   perl-5.26.3   
   perl-5.24.4   
   perl-5.22.4   
i  perl-5.20.3   
   perl-5.18.4   
   perl-5.16.3   
   perl-5.14.4   
   perl-5.12.5   
   perl-5.10.1   
    perl-5.8.9   
    perl-5.6.2   

# cperl

我这个上面有一个 i ,因为我之前已经安装好了版本perl-5.20.3,你那上面应该是没有的
然后依次按行执行下面代码:
我这里安装的是5.20.3,看个人需求安装

// 安装 perl-5.20.3
[root@ithomer ~]# perlbrew install perl-5.20.3
// 切换到当前版本perl
[root@ithomer ~]# perlbrew switch perl-5.20.3
// 查看当前有的 perl
[root@ithomer ~]# perlbrew list
* perl-5.20.3
// 查看 perl 版本
[root@ithomer ~]# perl -v/p

This is perl 5, version 20, subversion 3 (v5.20.3) built for x86_64-linux
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2015, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

到此安装完毕

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值