centos7下perl的升级安装

1.访问http://www.cpan.org/authors/id/S/SH/SHAY/ 下载perl版本

2.将下载下来的安装包放到你的目录里边

# 解包 tar -zxvf perl-5.26.1.tar.gz # 进入文件目录 cd perl-5.26.1

  进入解压目录执行

./Configure --help

查看过后,使用这个指令来设置源码

./Configure -des -Dprefix=/usr/local/perl -Dusethreads -Uversiononly
编译
 # make  //这个过程会比较久,因为源码文件有那么大,我的这个有14M。
 # make install

等待这个命令完成后,基本安装就完成了

测试  执行  Perl -v

[root@hadoop-m perl-5.26.1]# perl -v

This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux-thread-multi

Copyright 1987-2017, Larry Wall

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.
恭喜成功!

3.重定向

# 上一步完成基本代表着你已经把相关的perl安装成功
# 但是系统默认的还是原来的perl,所以我们要建立软连接

# 当前perl
perl -v

This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
(with 29 registered patches, see perl -V for more detail)

Copyright 1987-2012, Larry Wall

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.

# 修改链接
# 不建议删除,还是备份比较好
mv /usr/bin/perl /usr/bin/perl.bak
# 建立软连接
ln -s /usr/local/perl/bin/perl /usr/bin/perl

# 查看当前perl
perl -v

This is perl 5, version 26, subversion 1 (v5.26.1) built for x86_64-linux

Copyright 1987-2017, Larry Wall

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.

perl模块安装

以Net::SNMP模块为例

# 下载安装包
wget http://search.cpan.org/CPAN/authors/id/D/DT/DTOWN/Net-SNMP-v6.0.1.tar.gz

# 解压
tar -zxvf Net-SNMP-v6.0.1.tar.gz

# 编译安装
cd Net-SNMP-v6.0.1

perl Makefile.PL

make && make test

make install


# 特别注意
# 有一些模块使用Build.PL,可以通过readme进行查看
# 手动安装一定要先把依赖检测一下,先安装依赖
cpan安装

使用Perl自带的模块——CPAN.pm模块

perl -MCPAN -e shell

# 第一次进入选站点
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.18)
Enter 'h' for help.

cpan[1]> install Net::SNMP

or

perl -MCPAN -e 'install Net::SNMP'
  • 1

常见错误

wget未安装
# 例:
wget command not found
  • 1
  • 2

解决方法: 
yum -y install wget

gcc未安装

运行会提示带有cc的语句,因为我的环境一般都安装了gcc,也就不举例了

解决方法: 
yum -y install gcc

cpan未安装
Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.
  • 1
  • 2

解决方法: 
yum -y install perl-CPAN 

- 手动安装,版本要合适,步骤如上Net::SNMP

依赖未安装

# 例如
Checking prerequisites...
  recommends:
    *  Crypt::DES is not installed
    *  Crypt::Rijndael is not installed
    *  Digest::HMAC is not installed
    *  Digest::SHA1 is not installed
    *  Socket6 is not installed

解决方法: 
- 安装依赖模块 
- 使用强制安装 
- 用cpan进行安装


  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在CentOS 7上升级安装OpenSSH 9.1可以按照以下步骤进行: 1. 首先,确保系统已经安装了EPEL存储库。如果未安装,请运行以下命令安装: ``` sudo yum install epel-release ``` 2. 然后,更新系统软件包到最新版本: ``` sudo yum update ``` 3. 安装OpenSSH 9.1的依赖软件包: ``` sudo yum install gcc make wget perl-devel pam-devel zlib-devel krb5-devel openssl-devel ``` 4. 下载OpenSSH 9.1的源代码包,可以在OpenSSH官方网站上获取最新的源代码包: ``` wget http://www.openssh.com/portable/openssh-9.1p1.tar.gz ``` 5. 解压源代码包: ``` tar -zxvf openssh-9.1p1.tar.gz cd openssh-9.1p1 ``` 6. 配置编译选项: ``` ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-privsep-path=/var/empty/sshd ``` 7. 编译并安装: ``` make sudo make install ``` 8. 备份并替换系统原有的OpenSSH二进制文件: ``` sudo cp /usr/sbin/sshd /usr/sbin/sshd_backup sudo cp /usr/bin/ssh /usr/bin/ssh_backup sudo cp /usr/bin/ssh-keygen /usr/bin/ssh-keygen_backup sudo cp /usr/libexec/openssh/sftp-server /usr/libexec/openssh/sftp-server_backup sudo cp /usr/libexec/openssh/sftp-server /usr/libexec/openssh/sftp-server_backup sudo cp /usr/libexec/openssh/sftp-server /usr/libexec/openssh/sftp-server_backup sudo cp /usr/libexec/openssh/ssh-keysign /usr/libexec/openssh/ssh-keysign_backup sudo cp /usr/libexec/openssh/ssh-keyscan /usr/libexec/openssh/ssh-keyscan_backup sudo cp /usr/libexec/openssh/ssh-keyscan /usr/libexec/openssh/ssh-keyscan_backup ``` 9. 启动OpenSSH服务: ``` sudo systemctl start sshd ``` 到此,您已成功将OpenSSH升级到9.1版本。您可以使用以下命令验证OpenSSH版本: ``` ssh -V ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值