Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Need Help Installing Net::SSH2

by DanielSpaniel (Scribe)
on Aug 29, 2011 at 14:25 UTC ( #923033=perlquestion: print w/ replies, xml ) Need Help??
DanielSpaniel has asked for the wisdom of the Perl Monks concerning the following question:

Hi, Hoping somebody can help me please, because I'm not very familiar with installing via CPAN. My machine is running Fedora 15 (64-bit), and I'm trying to install Net:SSH2 via CPAN, but I am running into problems (as shown by the output below). I resolved one previous issue, with it being unable to locate the C compiler, but I do not know how to progress further, from where I am now. It seems to start failing at the "Can't link/include 'libssh2.h', 'ssh2'" line. Perl version is v5.12.4.(64-bit).

cpan[1]> install Net::SSH2 Going to read '/root/.cpan/Metadata' Database was generated on Mon, 29 Aug 2011 05:27:45 GMT Running install for module 'Net::SSH2' Running make for R/RK/RKITOVER/Net-SSH2-0.39.tar.gz Checksum for /root/.cpan/sources/authors/id/R/RK/RKITOVER/Net-SSH2-0.3 +9.tar.gz ok Scanning cache /root/.cpan/build for sizes ...................................................................... +......DONE CPAN.pm: Going to build R/RK/RKITOVER/Net-SSH2-0.39.tar.gz Subroutine checklibs redefined at inc/Module/Install/CheckLib.pm line +11. Subroutine assertlibs redefined at inc/Module/Install/CheckLib.pm line + 25. Subroutine _author_side redefined at inc/Module/Install/CheckLib.pm li +ne 39. The libssh2 library is required by this module. If you don't have it, + you can download it from http://www.libssh2.org; you may also need OpenSSL, wh +ich can be obtained from http://www.openssl.org. Debian: sudo aptitude install libssh2-1-dev OpenSUSE: sudo zypper in libssh2-1 libssh2-devel You can pass your libssh2 lib and include dirs on the command line. E. +g.: perl Makefile.PL lib=$HOME/libssh2/lib inc=$HOME/libssh2/include Can't link/include 'libssh2.h', 'ssh2' No 'Makefile' created RKITOVER/Net-SSH2-0.39.tar.gz /usr/bin/perl Makefile.PL -- NOT OK Running make test Make had some problems, won't test Running make install Make had some problems, won't install Failed during this command: RKITOVER/Net-SSH2-0.39.tar.gz : writemakefile NO -- No 'Makefile' c +reated

With regards to libssh2, then I have already checked to make sure it is installed, per below:

yum install libssh2 Loaded plugins: langpacks, presto, refresh-packagekit Setting up Install Process Package libssh2-1.2.7-1.fc15.x86_64 already installed and latest versi +on Nothing to do

Comment on Need Help Installing Net::SSH2
Select or Download Code
Re: Need Help Installing Net::SSH2
by Anonymous Monk on Aug 29, 2011 at 14:42 UTC
    You need libssh2-devel.
      Thx for the reply, but I just installed libssh2-devel (on your advice), and retried Net:SSH2 in CPAN, but still fails in the same place. openssl is also installed already. (Package openssl-1.0.0d-1.fc15.x86_64 already installed and latest version)
        The Makefile.PL script from the latest versions of Net::SSH2 accepts both an inc and lib parameters with the place of libssh2 library and include files. For instance:
        Makefile.PL inc=/usr/include lib=/usr/lib64
        Besides that, Net::OpenSSH::Compat(::SSH2) implements most of Net::SSH2 API on top of Net::OpenSSH and it's pretty easy to install on Unix/Linux system including Fedora.
Re: Need Help Installing Net::SSH2
by Khen1950fx (Canon) on Aug 29, 2011 at 15:36 UTC
    You'll need to download and manually install libssh2. After make install, run /sbin/ldconfig /usr/local/lib, then install Net::SSH2. Fedora rpms have the nasty habit of not doing ldconfig correctly. I use Fedora, but I installed libssh2 from a Debian tarball and ran ldconfig. Worked.

      Hi Khen1950fx, Thx for the suggestion, I am trying it now, but not too familiar (yet) with installing as you suggest. I've manually downloaded a recent version of libssh2; unzipped it, untarred it and stuck it into a local directory. Now I have a directory with the following in it:

      config.guess  configure  INSTALL     LICENSE      mkinstalldirs  src  win32    config.sub    include    install-sh  Makefile.in  README   ssh2_sample.c

      I have run ./configure, and it ran through a bunch of stuff, but ultimately didn't seem to like something, and gave up with the following message:

      checking for OpenSSL... configure: error: Cannot find OpenSSL's <evp.h> or <hmac.h>

      Can you help me go from here please? I really appreciate your help.

        Go into the directory that you untarred the src to and type:
        ./configure --help
        A list of all the different options will popup. I would recommend doing:
        ./configure --enable-shared --with-gnu-ld
        The "--with-gnu-ld" is necessary in order to properly do ldconfig. So the mantra is:
        ./configure --enable-shared --with-gnu-ld make make check make install /sbin/ldconfig /usr/local/lib
        Now run
        whereis libssh2
        If everything's in order, then it should return something like:
        /usr/local/lib/libssh2.so /usr/local/lib/libssh2.a /usr/local/lib/libssh2.la
        Update: I think that you have the same problem with OpenSSL. Here's the most recent tarball:

        http://www.openssl.org/source/openssl-1.0.0d.tar.gz

        It's a slightly more complicated procedure. First, you need to remove the current openssl include headers. Then do
        ./Configure linux-elf -march=pentium make make test make install
        Next, you must manually install Net::SSH2.
        export LD_LIBRARY_PATH=/usr/local/lib perl Makefile.PL lib=/usr/local/lib make make test make install
        Now, you're good to go...
Reaped: Re: Need Help Installing Net::SSH2
by NodeReaper (Curate) on Aug 30, 2011 at 13:31 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://923033]
Approved by Corion
Front-paged by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2014-10-01 08:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (390 votes), past polls