系统版本:ubuntu16.04
perl安装版本:5.26.1
下载源码包
下载地址:https://www.cpan.org/src/5.0/perl-5.26.1.tar.gz ##如需要其他版本,有版本号的话可做相应替换即可
编译安装
tar -xf perl-5.26.1.tar.gz
cd perl-5.26.1
./Configure -Dprefix=/usr/local/perl5.26 -des
make && make install ##编译耗时较长,建议采用多线程编译
备注:编译参数解释
-d:对所有答案使用默认值。
-e:忽略config.sh的产生。
-f:指定一个备用默认配置文件。
-h:打印此帮助信息并退出(显示错误状态)。
-r:如果可能,重用c符号值(跳过代价高昂的纳米提取)。
-s:静默模式,只回应问题和重要信息。
-Dprefix=/xx 选择安装路径
验证
root@xxx:/usr/local/perl5.26/bin/perl --version
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.
其他问题
编译安装后缺少模块
- 报错
- 解决方案:
root@xxx:cpan
Cpan[1]>install Switch.pm
Cpan[2]>install File/Copy/Recursive.pm
Cpan[3]>install XML/Simple.pm
Cpan[4]>install tie/ixhash.pm
其他报错
- 报错
Can't locate XML/Simple.pm in @INC (you may need to install the XML::Simple module) (@INC contains: /usr/local/perl5.26/lib/site_perl/5.26.1/x86_64-linux /usr/local/perl5.26/lib/site_perl/5.26.1 /usr/local/perl5.26/lib/5.26.1/x86_64-linux /usr/local/perl5.26/lib/5.26.1 .) at ./tools/NVRAMStatistic/nvram_lid_check.pl line 18.
BEGIN failed--compilation aborted at ./tools/NVRAMStatistic/nvram_lid_check.pl line 18.
- 解决方案
root@xxx:cpan
cpan> install Bundle::CPANxxl
cpan> install XML::Simple