1.访问http://www.cpan.org/authors/id/S/SH/SHAY/ 下载perl版本
2.将下载下来的安装包放到你的目录里边
# 解包 tar -zxvf perl-5.26.1.tar.gz # 进入文件目录 cd perl-5.26.1
进入解压目录执行
./Configure --help
查看过后,使用这个指令来设置源码
./Configure -des -Dprefix=/usr/local/perl -Dusethreads -Uversiononly
编译
make //这个过程会比较久,因为源码文件有那么大,我的这个有14M。
make install
等待这个命令完成后,基本安装就完成了
测试 执行 Perl -v
[root@hadoop-m perl-5.26.1]# perl -v
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-thread-multi
Copyright 1987-2017, 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.
恭喜成功!
3.重定向
# 上一步完成基本代表着你已经把相关的perl安装成功
# 但是系统默认的还是原来的perl,所以我们要建立软连接
# 当前perl
perl -v
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
(with 29 registered patches, see perl -V for more detail)
Copyright 1987-2012, 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.
# 修改链接
# 不建议删除,还是备份比较好
mv /usr/bin/perl /usr/bin/perl.bak
# 建立软连接
ln -s /usr/local/perl/bin/perl /usr/bin/perl
# 查看当前perl
perl -v
This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux
Copyright 1987-2017, 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.