I'm trying to install a perl module: Net::SSH2 with cpan but doesn't actually works.
cpan -f install Net::SSH2
Output:
CPAN: Storable loaded ok (v2.20) Going to read
'/root/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Going to read '/root/.cpan/sources/modules/02packages.details.txt.gz'
Database was generated on Mon, 22 May 2017 22:29:03 GMT HTTP::Date
not available ............. New CPAN.pm version (v2.16) available.
[Currently running version is v1.9402] You might want to try
install CPAN
reload cpan to both upgrade CPAN.pm and run the new version without leaving the current session.
...............................................................DONE
Going to read '/root/.cpan/sources/modules/03modlist.data.gz' Can't
locate object method "data" via package "CPAN::Modulelist" (perhaps
you forgot to load "CPAN::Modulelist"?) at (eval 16) line 1. at
/usr/share/perl5/CPAN/Index.pm line 518
CPAN::Index::rd_modlist('CPAN::Index', '/root/.cpan/sources/modules/03modlist.data.gz') called at
/usr/share/perl5/CPAN/Index.pm line 85
CPAN::Index::reload('CPAN::Index') called at /usr/share/perl5/CPAN.pm line 955
CPAN::exists('CPAN=HASH(0x21fd2f0)', 'CPAN::Module', 'install') called at /usr/share/perl5/CPAN/Shell.pm line 1243
CPAN::Shell::expandany('CPAN::Shell', 'install') called at /usr/share/perl5/CPAN/Shell.pm line 1639
CPAN::Shell::rematein('CPAN::Shell', 'force', 'install', 'install') called at /usr/share/perl5/CPAN/Shell.pm line 1935
CPAN::Shell::ANON('CPAN::Shell', 'install', 'install') called at /usr/bin/cpan line 318
main::_default('ARRAY(0x1938f18)') called at /usr/bin/cpan line 278
It seems that your installation of CPAN is incomplete or otherwise corrupted. OS and Perl version could be helpful. On many current Linux distributions, Perl modules and their dependencies can be installed using the normal system software utilities like yum (RHEL/CentOS), apt (Debian/Ubuntu) and yast (SuSE). Drawback is that versions may not be the most current.
This PerlMonks thread has someone else with a similar problem. It looks like this answer worked in that case:
It looks to me like you have some corrupt data in your .cpan directory. I'd blow it away and try again:
$ rm -rf /home/user/.cpan
Try it at your own risk. In your case, you would need to delete /root/.cpan.
In addition, the correct use of cpan is to list the module names after the command. So, instead of cpan install Net::SSH2, you should use cpan Net::SSH2. If you use the -f option, you must specify -i: cpan -f -i Net::SSH2, but try without forcing things first. You do not want to willy-nilly install broken modules in the system's perl.
In fact, in general, you do not want to mess with the system's perl at all. Build your own perl and mess with it as much as you want.
PS: install is a dummy module created precisely because many people make this mistake.
The safest and most convenient way to install Perl modules can depend on distribution. For example, the recommended method on Fedora is:
$ sudo dnf install 'perl(Net::SSH2)'
As shown in that example, installing Perl modules on your system usually requires sudo or the root user. So you might want to try your command with sudo if you're a sudoer.
If you don't have that kind of power, you may need to install it locally. That usually means downloading it to a Perl library directory you create in your home directory, and including the path in #INC somehow, such as updating your $PERL5LIB to include the /home/user/perl/modules/Net-SSH2/lib/ or whatever your path to the module lib directory is.
I tried to upgrade Perl and put my computer into a complete mess
I am currently running RHEL6.5, 64bits, and this is the thing:
I had perl-5.10.1 installed, and working nice. this came installed,
and I could see it from yum
I wanted to install Padre, an Perl IDE, but that required at least v5.11 [I was so close! :( ]
There were no newer version for Perl in the repos that I have access to (and I have a limitation that I can't add new repos)
I got approval from my boss to download perl-5.20 .0 from www.perl.org and tried to install it
... and the mess begins!
First I installed the new perl with my own id, and that pushed perl to somewhere under my home dir
I tested with 'perl -v' and could see that my env was pointing to the newer install, however, yum never recognized it (not really a problem)
When I tried to install Padre, seems somehow it had the hardcoded the original perl (from /usr/bin) and still claiming for something as newer as 5.11.
Trying to fix it, I did installed the new perl again, now using root, to make it push perl under /usr tree ... it installed, but pushed perl to /usr/local/bin, instead of /usr/bin
So again, I had one more perl install but Padre still looking for the one on /usr/bin
I give up about Padre, and deleted the files related to it, as well as the perl installed on my home dir, however a couple of perl scripts that I had already coded now are throwing errors like:
perl -cw "xmltest.pl" (in directory: /home/myid/scripts/xmltest.pl)
perl: symbol lookup error: /usr/lib64/perl5/auto/Data/Dumper/Dumper.so: undefined symbol: Perl_Istack_sp_ptr
Compilation failed.
... and Data::Dumper in not the only one ... every time I disable one of the modules, another one hangs in the same, or similar way
From what I read about this, seems that this issue is related to modules that were originally installed for one perl version, and are being called by another, however, I already forced the modules that I use to be reinstalled directly from CPAN, and they still failing
Question: How can I, safely, get free from this current perl installs, and perform a new clean install be able to use it w/o these versions conflicts?
My major concern are about the numerous apps that I have that depends on Perl, and I my not broke then on a uninstall
Any help will be much appreciate.
You should:
cleanup
clean (comment out) your ~/.profile from any unwanted paths, and so on
clean any new perl installation from your $HOME (move to safe place for sure)
in short, try return your environment into previous working state
relog, (logout, login)
repair your system perl. Thats mean,
read #Sam Varshavchik's answer
reinstall it from your distribution, using your package manager (5.10).
this step should overwrite the mess you caused.
test it !
don't continue until youre ensured, everything working right as before.
Lesson learned: never overwrite your system perl
learning
read thru perlbrew.pl
repeat previous step once again, especially with the
the homepage
http://perlbrew.pl/Perlbrew-and-Friends.html
https://metacpan.org/pod/App::perlbrew
https://metacpan.org/pod/perlbrew
installing perlbrew
run the installation command \wget -O - http://install.perlbrew.pl | bash
should finished without errors
follow the instructions how to modify your startup file e.g. ~/.profile or such... (you need to add one line to the end)
check your ~/perl5/perlbrew/bin should contain prelbrew and patchperl
relog
setup new perl, run
perlbrew init #init environment
perlbrew available #show what perl you can install
perlbrew install 5.20.0 #will take few minutes - depends on your system speed
perlbrew install-cpanm
perlbrew list #check
perlbrew switch perl-5.20.0 #activate newly installed perl 5.20
Check your installation
in the ~/perl5/perlbrew/bin you should have 3 scripts: prelbrew , patchperl , cpanm
perl -v should return 5.20
type cpanm - should return ~/perl5/perlbrew/bin/cpanm
You're done.
CPAN modules
You can install new modules with cpanm, like:
applications
cpanm cpan-outdated
cpanm App::Ack
cpanm Unicode::Tussle
cpanm Perl::Tidy
cpanm Perl::Critic
collections
cpanm Task::Moose
cpanm Task::Plack
cpanm Task::Unicode
modules
cpanm Path::Tiny
cpanm Try::Tiny
cpanm JSON
cpanm YAML
etc...
Check the ~/perl5/perlbrew/perls/perl-5.20.0/bin/ for new commands
You will need update your own perl script's shebang line to
#!/usr/bin/env perl
I hope don't forget anything, maybe other more experienced perl-gurus will add/edit/correct more.
Anyway, in the reality the steps 5,6,7 are much easier as sounds (by reading this) and could be done in few minutes.
On rpm-based Linux distributions, you should never install system software manually, like this, by trying to compile and build it yourself. RHEL's package management tool, rpm, performs an important function of keeping track of dependencies between packages, and prevent package conflicts.
The errors you showed are precisely the symptoms of a corrupted system Perl installation, and rpm exists precisely to avoid this sort of thing happening. Manually building and installing random tarballs completely bypasses the safety net that rpm provides.
There's no cookie-cutter recipe for recovering from a corrupted system install of a critical system rpm like perl, but in general:
1) run "rpm -q" perl, this will show you the exact version of the perl rpm package that rpm thinks should be installed.
2) go to the RHEL installation media/directory, verify that it contains the same perl-.x86_64.rpm package. If you previously installed RHEL updates, it's possible that you already updated perl, so look for the version that rpm tells you have installed in the RHEL update directory, and verify that you have the correct rpm package.
3) Execute:
rpm -ivh --force perl-<version>.x86_64.rpm
This will reinstall the original perl RPM package that was previously installed. Your problem is not only that you have extra versions of perl installed, but that it's likely that some of your custom perl builds have clobbered the system perl package, and uninstalling them won't help, you have to reinstall the system perl.
4) In RHEL, many perl modules are installed as separate packages. The above process should be used to reinstall every perl rpm package that you have installed. Execute:
rpm -q -a | grep '^perl'
This will give you a list of all Perl packages you have installed. You will need to repeat this procedure for every Perl rpm package.
It's not a 100% guarantee that this will fix everything, there could be other things wrong too, but this is a good first step towards recovery.
What I have done:
From #Sam-Varshavchik answer:
Found the previous perl rpm in my yum cache, and installed ...
rpm -ivh --force perl-<version>.x86_64.rpm
Checked for others "perl*" previously installed packages ... there were +260 so saved it in a file rpm -qa "perl*" > /tmp/perl.pkgs
With +260 packages to install, I realized that do it manually would take too much time, so it was time to put some ksh skills in practice ...
I checked at my yum cache and found ~130 of the +260 packages, so
took out from the list the base perl package (that I already have installed);
for those in the cache, I decided to install then with rpm, in the same way as the base package;
for those that I did not have handy, I used yum, which would download and do the same
of rpm, so ...
CACHE="/var/cache/yum/x86_64"
for perlpkg in $(cat /tmp/perl.pkgs)
do
FILE=$(find $CACHE -name "${perlpkg}.rpm")
if [[ ${FILE} != "" ]] ; then
rpm -ivh --force ${FILE}
else
yum -y reinstall ${perlpkg}
fi
done
From #jm666:
Installed perlbrew (was able to got it from my auth repos, so got it using yum) and using perlbrew, installed 5.20.0 localy
TODO: Didn't got any additional modules and neither Padre yet ... need to learn more about the way perlbrew works and isolate the installed version away from the system perl
Once again, thanks #Sam-Varshavchik and #jm666 for your support ang guidance
I'm trying to install a Perl module (JSON) from CPAN but getting below error.
root#catspc:/etc/apt# cpan
cpan shell -- CPAN exploration and modules installation (v1.960001)
Enter 'h' for help.
cpan[1]> install JSON
Going to read '/root/.cpan/Metadata'
Database was generated on Sat, 07 Dec 2013 22:53:04 GMT
Fetching with LWP:
http://mirror.sov.uk.goscomb.net/CPAN/authors/01mailrc.txt.gz
Proxy authentication needed!
(Note: to permanently configure username and password run
o conf proxy_user your_username
o conf proxy_pass your_password
)
Username: vc06
Password:
Catching error: "Undefined subroutine &CPAN::HTTP::Credentials::_clear_non_proxy_credentials called at /usr/share/perl/5.14/CPAN/HTTP/Credentials.pm line 10, <STDIN> line 2.\cJ" at /usr/share/perl/5.14/CPAN.pm line 391
CPAN::shell() called at /usr/share/perl/5.14/App/Cpan.pm line 295
App::Cpan::_process_options('App::Cpan') called at /usr/share/perl/5.14/App/Cpan.pm line 364
App::Cpan::run('App::Cpan') called at /usr/bin/cpan line 11
Fetching with LWP:
http://mirror.sov.uk.goscomb.net/CPAN/authors/01mailrc.txt.gz
Lockfile removed.
Undefined subroutine &CPAN::HTTP::Credentials::_clear_non_proxy_credentials called at /usr/share/perl/5.14/CPAN/HTTP/Credentials.pm line 10, <STDIN> line 2.
root#catspc:/etc/apt#
Could someone help me in fixing this issue? What went wrong here?
Awaiting your valuable reply.
Chances are your cpan configuration is skewed.
Is there a reason why you dont use cpanm? (https://metacpan.org/release/App-cpanminus)
I switched from cpan to cpanm some years ago and havent regretted it yet.
DESCRIPTION
cpanminus is a script to get, unpack, build and install modules from
CPAN and does nothing else.
It's dependency free (can bootstrap itself), requires zero
configuration, and stands alone. When running, it requires only 10MB
of RAM.
I am trying to install the Net::LDAP module on an OEL box using CPAN, but I get the following error:
[root ~]# cpan -i Net::LDAP
CPAN: Storable loaded ok
Going to read /root/.cpan/sources/authors/01mailrc.txt.gz
Could not pipe[ --decompress --stdout /root/.cpan/sources/authors/01mailrc.txt.gz |]: No such file or directory at /usr/lib/perl5/5.8.8/CPAN.pm line 5726.
Can someone please guide me on how to troubleshoot this?
CPAN needs to be configured before you can use it to install stuff.
There should be a whole bunch of stuff under
/root/.cpan
Generally cpan gets this stuff automatically, but for some reason it's
not there on your machine. In particular it needs this file.
/root/.cpan/sources/authors/01mailrc.txt.gz
If that file is there, then cpan man be missing the gzip binary needed to uncompress that file.
Hi i am trying to install bugzilla on my mediatemple server, i am totally a novice when i comes to cmmd line so have found a tutorial on-line which was going well till i tried to upgrade the above.
the below is the message i get in the command line and after looking on-line for about an hour i cant seem to find a resolution to the issue. basically i am stuck on where to go now to upgrade what its asking
Installing Archive::Tar version 1.76...
Running install for module 'Archive::Tar'
Running make for B/BI/BINGOS/Archive-Tar-1.76.tar.gz
CPAN: Digest::SHA loaded ok (v5.62)
CPAN: Compress::Zlib loaded ok (v1.42)
Checksum for /root/.cpan/source/authors/id/B/BI/BINGOS/Archive-Tar-1.76.tar.gz ok
CPAN: Archive::Tar loaded ok (v1.3901)
You have Archive::Tar 1.3901, but 1.50 or later is recommended. Please upgrade.
Uncompressed /root/.cpan/source/authors/id/B/BI/BINGOS/Archive-Tar-1.76.tar.gz successfully
Using Tar:/bin/tar xvf "Archive-Tar-1.76.tar":
Couldn't untar Archive-Tar-1.76.tar
CPAN: File::Temp loaded ok (v0.22)
CPAN: CPAN::Meta loaded ok (v2.110930001)
CPAN: Time::HiRes loaded ok (v1.9717)
Package seems to come without Makefile.PL.
(The test -f "/root/.cpan/build/BINGOS-J_TqCf/Makefile.PL" returned false.)
Writing one on our own (setting NAME to ArchiveTar)
Had problems unarchiving. Please build manually
Skipping test because of notest pragma
Running make install
Make had some problems, won't install
Manually install a new Archive::Tar version first. It looks like it's trying to use /bin/tar to untar the Archive::Tar package it downloaded, but failing to do so, perhaps because that's not the correct location of your tar binary.
Use which tar to find out where tar is on your system - it may be /usr/bin/tar, in which case, it's looking in the wrong place.
If you're using CPAN.pm for this, you can correct the path to tar with the following from the CPAN.pm shell (which you can get to with cpan or perl -MCPAN -e shell:
o conf tar '/usr/bin/tar'
o conf commit
(Using whatever path which tar gave you.)