Search code examples
perlredhatlibssh2

Install perl module Net:SSH2 on redhat/centos 7


As the title says I am trying to install the perl module perl-Net-SSH2. I have tried via yum but get an error that no package is available.

yum install perl-Net-SSH2

I have tried by downloading an rpm file but the only one I can find is for el6 and it complains about the version of perl

yum localinstall perl-Net-SSH2-0.45-4.el6.x86_64.rpm Requires: perl(:MODULE_COMPAT_5.10.1)

I have tried downloading the source code but get told "Unable to find a working version of library ssh2 in the following directories" even though it is installed. (via yum install libssh2 libssh2-devel)

I have tried via cpan but get the same error "Unable to find a working version of library ssh2 in the following directories"

Any ideas? Google is very sketchy on this and only


Solution

  • OK, I solved this while writing the question. Seeing as information on this is limited I thought it would be worth posting the question anyway. The error message was giving the wrong information in that it was actually gcc that was missing, not libssh2. These are the steps I followed. I've tried to make it as verbatim as possible. I have not verified all these modules are required but this is what I installed before compiling it.

    yum install libssh2 libssh2-devel
    yum install openssl openssl-devel
    yum install perl-Net-SSLeay
    yum install gcc
    
    Search for Net::SSH2 in google    
    Click the link "Net::SSH2 - search.cpan.org"
    Download source code (tar.gz file)
    Copy it to your redhat 7 machine
    
    tar -xvf Net-SSH2-0.62.tar.gz 
    cd Net-SSH2-x.xx
    perl Makefile.PL
    make
    make install
    

    Should all be working now, test it with

    perl -e 'use Net::SSH2;'