Perl下载页面 https://www.activestate.com/activeperl/downloads 按系统下载
我的Linux系统自带的perl是5.10的;
0 1 2 3 |
# perl -v ... This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi ... |
现在我要装最新版本的5.26
0 1 2 3 4 5 |
# wget http://downloads.activestate.com/ActivePerl/releases/5.26.0.2600/ActivePerl-5.26.0.2600-x86_64-linux-glibc-2.15-403863.tar.gz # tar -zxvf ActivePerl-5.26.0.2600-x86_64-linux-glibc-2.15-403863.tar.gz # cd ./ActivePerl-5.26.0.2600-x86_64-linux-glibc-2.15-403863 # ls ACTIVEPERL.txt LICENSE.txt RELEASE.txt perl CHANGES.txt README.txt install.sh support |
执行安装文件,如果有报错提示:perl/bin/perl: /lib64/libc.so.6: version `GLIBC_2.14′ not found (required by perl/bin/perl),请看CentOS中安装Perl时出错解决方法
0 1 2 3 4 5 6 7 8 9 |
# ./install.sh Checking package...done Welcome to ActivePerl ActivePerl is ActiveState's quality-assured binary build of Perl. In order to install ActivePerl you need to agree to the ACTIVESTATE® COMMUNITY EDITION LICENSE AGREEMENT. Did you read the LICENSE.txt file? [no] |
上面提示后,输入 y 回车
0 |
Do you agree to the ACTIVESTATE® COMMUNITY EDITION LICENSE AGREEMENT? [no] |
上面提示后,输入 y 回车
0 1 2 3 4 |
This installer can install ActivePerl in any location of your choice. You do not need root privileges. However, please make sure that you have write access to this location. Enter top level directory for install? [/opt/ActivePerl-5.26] |
上面提示后,输入绝对路径的安装目录 /opt/ActivePerl-5.26 回车
0 1 2 3 4 5 |
The ActivePerl documentation is available in HTML format. If installed it will be available from file:///opt/ActivePerl-5.26/html/index.html. If not installed you will still be able to read all the basic perl and module documentation using the man or perldoc utilities. Install HTML documentation [yes] |
上面提示后,输入 y 回车
0 1 2 3 4 5 |
Ok. The typical ActivePerl software installation requires 200 megabytes. Please make sure enough free space is available before continuing. Proceed? [yes] |
上面提示后,输入 y 回车
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
Ok. Installing ActivePerl... Copying files to /opt/ActivePerl-5.26...done Relocating...done (280 files relocated) Generating HTML documentation...done Syncing perl PPM database with .packlists...done ActivePerl has been successfully installed at /opt/ActivePerl-5.26. Please modify your startup environment by adding: /opt/ActivePerl-5.26/site/bin:/opt/ActivePerl-5.26/bin to PATH /opt/ActivePerl-5.26/site/man:/opt/ActivePerl-5.26/man to MANPATH For general questions or comments about ActivePerl, please contact us at <support@activestate.com>. Thank you for using ActivePerl! Do you want to download a free trial of Komodo IDE? [Y/n] |
上面提示后,这是要安装一个集成开发工具,想装就输入y,不装就输入 n 回车,安装结束。
创建软连接,就相当于是windows中的快捷方式图标一样
0 1 2 |
# ln -s /opt/ActivePerl-5.26/perl /usr/bin/perl5.26.0 # cd /usr/bin # ln -s perl5.26.0 perl |
查看版本,显示出版本号,但是有警告
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# perl -v perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LANG = "zh_CN.UTF-8" are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). This is perl 5, version 26, subversion 0 (v5.26.0) built for x86_64-linux-thread -multi (with 1 registered patch, see perl -V for more detail) Copyright 1987-2017, Larry Wall Binary build 2600 [403863] provided by ActiveState http://www.ActiveState.com Built Aug 24 2017 21:59:59 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. |
查看locale
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# locale locale: Cannot set LC_CTYPE to default locale: No such file or directory locale: Cannot set LC_MESSAGES to default locale: No such file or directory locale: Cannot set LC_ALL to default locale: No such file or directory LANG=zh_CN.UTF-8 LC_CTYPE="zh_CN.UTF-8" LC_NUMERIC="zh_CN.UTF-8" LC_TIME="zh_CN.UTF-8" LC_COLLATE="zh_CN.UTF-8" LC_MONETARY="zh_CN.UTF-8" LC_MESSAGES="zh_CN.UTF-8" LC_PAPER="zh_CN.UTF-8" LC_NAME="zh_CN.UTF-8" LC_ADDRESS="zh_CN.UTF-8" LC_TELEPHONE="zh_CN.UTF-8" LC_MEASUREMENT="zh_CN.UTF-8" LC_IDENTIFICATION="zh_CN.UTF-8" LC_ALL= |
这三项需要设置LANGUAGE、LC_ALL、LANG,方法如下:
0 1 |
# cd /root # vi .bachrc |
在最末尾另起一行输入下面三行代码
0 1 2 |
export LANG=en_US:zh_CN.UTF-8 export LANGUAGE=en_US.UTF-8 export LC_ALL=C |
保存并退出编辑
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# source .bashrc # perl -e exit # perl -v # locale LANG=en_US:zh_CN.UTF-8 LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C" LC_PAPER="C" LC_NAME="C" LC_ADDRESS="C" LC_TELEPHONE="C" LC_MEASUREMENT="C" LC_IDENTIFICATION="C" LC_ALL=C |
没有警告,可以快乐地使用perl了。