Total Pageviews

Wednesday, 11 April 2012

perl模块的安装操作

环境:CentOS 6.0下最小化安装
说明:最小化安装后,perl只具备基本的一些功能,几乎模块都是没有的.下面的操作请按顺序.不然会提示缺失.
1.       首先安装 ExtUtils-MakeMaker:
wget http://search.cpan.org/CPAN/authors/id/M/MS/MSTROUT/ExtUtils-MakeMaker-6.59.tar.gz
tar zxvf ExtUtils-MakeMaker-6.59.tar.gz
perl Makefile.PL
make
(如果提示: No rule to make target `/usr/lib/perl5/CORE/config.h,need byMakefile'的错误,是因为perl安装不完整导致,解决办法: yum install perl-devel)
make install

2.      然后安装CPAN:
[root@LT ]#wget http://mirrors.xmu.edu.cn/CPAN/authors/id/A/AN/ANDK/CPAN-1.9800.tar.gz
[root@LT ]# tar -zxvf CPAN-1.9205.tar.gz
[root@LT ]# cd CPAN-1.9205
[root@LT CPAN-1.9205]# perl Makefile.PL
[root@LT CPAN-1.9205]# make
[root@LT CPAN-1.9205]# make install

3.  最后终于可以安装缺失模块了:
[root@LT CPAN-1.9800]#perl -MCPAN -e shell
(这边如果提示:Can't locate Time/HiRes.pm in @INC…错误,安装yum installperl-Time-HiRes)
cpan>install DBI
cpan>install DBD::mysql
cpan>install Apache::DBI
cpan>….
(模块是否存在,可以用# perldoc [模块名检测)