> CentOS > CentOS教程 >

Centos安装perl5环境

源码安装

// 下载安装包
wget http://www.cpan.org/src/5.0/perl-5.16.1.tar.gz

// 解压源码包
tar -xzf perl-5.16.1.tar.gz

// 进入源码目录
cd perl-5.16.1

//自定义安装目录
./Configure -des -Dusethreads -Dprefix=/usr/local/perl

// 下面这三个命令要依次都执行,这是在编译源码
make
make test
make install


// 查看版本
perl -v


// 安装相关的库
安装perl的相关库

#cpan -i Algorithm::Diff Class::Singleton DBI DBD::mysql Log::Dispatch Log::Log4perl Mail::Send Net::Ping Proc::Daemon Time::HiRes Params::Validate Net::ARP

MMM架构安装perl依赖

执行如下脚本install.sh

 #!/bin/bash

yum install gcc -y           #安装gcc

yum install perl* -y         #安装perl依赖包

wget http://xrl.us/cpanm --no-check-certificate  

mv cpanm/usr/bin

chmod 755 /usr/bin/cpanm

cat >/root/list << EOF

install Algorithm::Diff

install Class::Singleton

install DBI

install DBD::mysql

install File::Basename

install File::stat

install File::Temp

install Log::Dispatch

install Log::Log4perl

install Mail::Send

install Net::ARP

install Net::Ping

install Proc::Daemon

install Thread::Queue

install Time::HiRes

EOF



for package in `cat /root/list`

do

   cpanm $package

done




(责任编辑:IT)