Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Resolving issues while installing Net::SSH2 on Ubuntu 16.04.2

by pritesh_ugrankar (Monk)
on Mar 04, 2017 at 14:28 UTC ( [id://1183646]=perlmeditation: print w/replies, xml ) Need Help??

Hi,

I wanted to try out plenv and install modules without "disturbing" system perl. Followed the instructions and plenv installed without any issues. While installing the Net::SSH2 modules, I kept getting errors. The steps given below are for those who might face similar issues. Hope someone here finds it helpful.

Apologies if this is posted in wrong section. Just wanted to post this to help those who might be in a similar situation

Before you install Net::SSH2, install the following:

sudo apt install libssh2-1-dev sudo apt install openssh-server sudo apt install zlib1g-dev

Once these are installed successfully, then proceed with installing the Net::SSH2 module. Since I had earlier installed plenv, it seems to have installed cpanm in my home directory as shown below.

pritesh@thinkpad:~$ which cpanm /home/pritesh/.plenv/shims/cpanm pritesh@thinkpad:~$

Then I simply installed Net::SSH2 using the following command

cpanm Net::SSH2

Then just to see if all is well, I ran the following command

pritesh@thinkpad:~$ perl -e "Net::SSH2" pritesh@thinkpad:~$

Updated as per the error pointed out. Thanks.

pritesh@thinkpad:~$ perl -e "use Net::SSH2" pritesh@thinkpad:~$

Indeed all is well.

Note:- Big thank you to the Strawberry Perl folks. While on Windows, I was using Strawberry Perl and installing a module was trivial. Only upon trying to install the Net::SSH2 module on linux did I understand how much care the Strawberry Perl folks have taken to make things work on Windows.

Unfortunately I will not be able to go back to Windows on this laptop. After upgrading the RAM, Windows would not boot. Reinstalling the OS also did not help and I kept getting random blue screens, both with Windows 7 and 10. Memory tests ran all fine. So tried Ubuntu 16.04.2 and it seems to have no issues.

Replies are listed 'Best First'.
Re: Resolving issues while installing Net::SSH2 on Ubuntu 16.04.2
by kcott (Archbishop) on Mar 05, 2017 at 06:12 UTC

    G'day pritesh_ugrankar,

    "Apologies if this is posted in wrong section."

    Nothing to apologise for: this is a perfectly acceptable section for this type of post. If in doubt, you can always check "Where should I post X?".

    "Then just to see if all is well, I ran the following command ... perl -e "Net::SSH2""

    Actually, that's not doing what I suspect you want it to do. I can type all sorts of rubbish in that string and get the same result, e.g.

    $ perl -e "blahblahblah" $

    Both warnings and strictures would have given hints:

    $ perl -we "Net::SSH2" Useless use of a constant ("Net::SSH2") in void context at -e line 1. $ perl -wMstrict -e "Net::SSH2" Bareword "Net::SSH2" not allowed while "strict subs" in use at -e line + 1. Execution of -e aborted due to compilation errors.

    What you probably wanted was "use Net::SSH2"; perhaps with a version check. I don't have that module installed but here's an example with a builtin module:

    $ perl -wMstrict -le 'use Data::Dumper; print $Data::Dumper::VERSION' 2.167

    — Ken

      Hi,

      Thanks, that was a typo. Modified as per your update.

      Thinkpad T430 with Ubuntu 16.04.2 running perl 5.24.1 thanks to plenv!!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://1183646]
Approved by 1nickt
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-24 18:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found