Test::Nginx 安装
作者:互联网
一、安装环境
CentOS 7.5
[root@VM-0-7-centos ~]# uname -a
Linux VM-0-7-centos 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@VM-0-7-centos ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
二、安装依赖
yum -y install perl
yum -y install perl-CPAN
yum -y install perl-Digest-MD5
三、安装Test::Nginx
sudo cpan Test::Nginx
四、安装后说明
1、Perl环境变量
[root@VM-0-7-centos ~]# cat /root/.bashrc
...此处略去
export PERL_LOCAL_LIB_ROOT="$PERL_LOCAL_LIB_ROOT:/root/perl5";
export PERL_MB_OPT="--install_base /root/perl5";
export PERL_MM_OPT="INSTALL_BASE=/root/perl5";
export PERL5LIB="/root/perl5/lib/perl5:$PERL5LIB";
export PATH="/root/perl5/bin:$PATH";
2、运行Test::Nginx
运行错误:
Can't locate Test/Nginx/Socket.pm
解决过程:
1、查找系统中的Socket.pm
[root@VM-0-7-centos ~]# find / -name Socket.pm
/usr/lib64/perl5/vendor_perl/Socket.pm
/usr/lib64/perl5/IO/Socket.pm
/root/.cpan/build/Test-Nginx-0.29-JDxcjn/lib/Test/Nginx/Socket.pm
/root/.cpan/build/Test-Nginx-0.29-JDxcjn/blib/lib/Test/Nginx/Socket.pm
2、添加搜素路径PERL5LIB
[root@VM-0-7-centos ~]# vim /root/.bashrc
...此处略去
export PERL_LOCAL_LIB_ROOT="$PERL_LOCAL_LIB_ROOT:/root/perl5";
export PERL_MB_OPT="--install_base /root/perl5";
export PERL_MM_OPT="INSTALL_BASE=/root/perl5";
export PERL5LIB="/root/perl5/lib/perl5:/root/.cpan/build/Test-Nginx-0.29-JDxcjn/lib:/root/.cpan/build/Test-Nginx-0.29-JDxcjn/blib/lib/:$PERL5LIB";
export PATH="/root/perl5/bin:$PATH";
重新打开终端,运行正常
标签:perl5,root,PERL,Nginx,export,Test,安装 来源: https://blog.csdn.net/u013139008/article/details/118632703