Installing Net::SSH2 on Cent OS

We have struggled with this too, so will share the minimum steps needed to setup Net::SSH2 lib on Cent OS:

  1. Install pre-requisite libs:
    • sudo yum install libgcrypt-devel
    • sudo yum install zlib-devel
  2. Download libssh2 source code from here.
  3. Untar and cd to the extracted directory.
  4. Execute: ./configure — This will verify availability of packages installed in step 1 and write Makefile.
  5. Execute: make — This will compile the libssh2 source code.
  6. Execute: sudo make install — This will install libssh2 shared libs at /usr/local/lib
  7. Execute: export LD_LIBRARY_PATH=/usr/local/lib
  8. Download Net::SSH2 library source code from CPAN.
  9. Untar and cd to the extracted directory.
  10. Execute: perl Makefile.PL gcrypt
  11. Execute: make
  12. Execute: sudo make install

This should be all for installing Net::SSH2 lib on Cent OS. Incase you face any issues, please leave a comment, and we will try to help.

Note: The above has been tested successfully against Cent OS 5.6 image.

Posted in Linux, Perl

Leave a Reply

Your email address will not be published. Required fields are marked *