CentOS 安装 perl

从源码安装

1
2
3
4
5
6
7
8
9
yum groupinstall "Development Tools"

wget http://www.cpan.org/src/5.0/perl-5.26.1.tar.gz
tar -xzf perl-5.26.1.tar.gz
cd perl-5.26.1

./Configure -des -Dprefix=/opt/perl5/perls/perl5.26
make
make install
  • 清除旧版本perl
1
2
rm /usr/bin/perl
ln -s /opt/perl5/perls/perl5.26/bin/perl /usr/bin/perl

使用 pelrbrew 安装

1
2
3
4
wget -O - http://install.perlbrew.pl | bash
source ~/perl5/perlbrew/etc/bashrc
perlbrew install perl-5.18.1
perlbrew switch perl-5.18.1
  • Install cpanm tool

    1
    perlbrew install-cpanm
    
  • Install perl modules

    1
    2
    3
    4
    5
    6
    7
    perldoc time::piece
    perlbrew install-cpanm
    cpanm -v DBI
    cpanm -v DBD::ODBC
    cpanm -v YAML
    cpanm -v Time::Piece
    cpanm -v Crypt::TripleDES