How To Upgrade Perl 5.8 to 5.10 of cPanel

andisugandi

Member
Jun 1, 2012
6
0
51
cPanel Access Level
Root Administrator
Hi all,

I want to install Perl module (Modern::Perl), but it requires Perl at least in version 5.10.

This is when I ran the install command on cpan:
Code:
cpan[2]> install Modern:Perl
Running install for module 'Modern::Perl'
Running make for C/CH/CHROMATIC/Modern-Perl-1.20120521.tar.gz
Checksum for /root/.cpan/sources/authors/id/C/CH/CHROMATIC/Modern-Perl-1.20120521.tar.gz ok
Scanning cache /root/.cpan/build for sizes
............................................................................DONE

CPAN.pm: Building C/CH/CHROMATIC/Modern-Perl-1.20120521.tar.gz

Checking prerequisites...
requires:
! feature is not installed
! mro is not installed
! perl (5.8.8) is installed, but we need version >= 5.010

ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions
of the modules indicated above before proceeding with this installation

Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Modern-Perl' version '1.20120521'
CHROMATIC/Modern-Perl-1.20120521.tar.gz requires perl '5.010'; you have only 5.008008; giving up
CHROMATIC/Modern-Perl-1.20120521.tar.gz
[prereq] -- NOT OK

Running Build test
Can't test without successful make
Running Build install
Make had returned bad status, install seems impossible
Failed during this command:
CHROMATIC/Modern-Perl-1.20120521.tar.gz : make NO requires perl '5.010'

I have read this document:
Installing Internal Perl Modules

But, no idea about $Title , how to upgrade installed Perl 5.8 (by cPanel) to 5.10 or newer?

Thanks in advance.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello,

Are you on CentOS 6 or RHEL 6? If you are, you could always simply try reverting to the rpm-installed perl versions. First check they are there:

Code:
rpm -qa | grep -i perl
You should see perl-5.10.1 listed as one of them.

Next, run the following to check if we moved the /usr/bin/perl binary:

Code:
whereis perl
On my system, I see the following:

Code:
[email protected] [~]# whereis perl
perl: /usr/bin/perl /usr/bin/perl.1336150642 /usr/local/bin/perl /usr/share/man/man1/perl.1.gz
Now, when I run perl -v on my server, I see Perl 5.8.8 because we moved /usr/bin/perl to /usr/bin/perl.1336150642 and symlinked /usr/bin/perl to /usr/local/bin/perl

When I run perl -v on /usr/bin/perl.1336150642, I see this:

Code:
[email protected] [~]# /usr/bin/perl.1336150642 -v | grep "This is perl"
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi
As such, rather than upgrading to Perl 5.10.1, I already have it. Now, I cannot state if you should really be moving that installation to /usr/local/bin/perl so we pull it. cPanel should technically now work with versions higher than Perl 5.8.8, but I would definitely suggest if you try updating to that higher version to first make a backup of /usr/local/bin/perl binary so that you have that available if anything goes wrong.

If you do revert to the other binary, you'll probably want to run "/usr/local/cpanel/scripts/checkperlmodules --full --force" to update any perl modules.

Thanks!
 

andisugandi

Member
Jun 1, 2012
6
0
51
cPanel Access Level
Root Administrator
Yes, it is Centos 6.2 (x86_64)

My RPM binary Perl already has v. 5.10:

# /usr/bin/perl -v

This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

Copyright 1987-2009, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at The Perl Programming Language - www.perl.org, the Perl Home Page.
The Perl(s) in my sistem:
# whereis perl
perl: /usr/bin/perl /usr/bin/perl.1323845669 /usr/local/bin/perl /usr/share/man/man1/perl.1.gz
So, what should I do to get /usr/bin/perl.1323845669 and /usr/local/bin/perl have the v. 5.10?

Is it by running:

cp /usr/bin/perl /usr/bin/perl.1323845669
and

ln -s /usr/bin/perl /usr/local/bin/perl
?

Thanks in advance.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello,

I don't see a backup being made of /usr/local/bin/perl prior to doing anything there as was suggested to avoid causing major issues if the upgrade fails?

Code:
cp /usr/local/bin/perl /usr/local/bin/perl.bak
Any other steps will need to be decided by you as I will be unable to suggest them. I've provided details on how to find an installed copy. If this fails to work, you could cause perl to not function and cPanel to not function. These are decisions that should not be taken lightly.

Thanks!
 

andisugandi

Member
Jun 1, 2012
6
0
51
cPanel Access Level
Root Administrator
Yes, I already make a backup of /usr/local/bin/perl file before running those two commands.

I also afraid something will go wrong in cPanel. What other step(s) i should do to avoid problems in the future?

Thanks.
 

andisugandi

Member
Jun 1, 2012
6
0
51
cPanel Access Level
Root Administrator
As expected, now I can not run cpan (/usr/local/bin/cpan):
Code:
# cpan
Can't locate App/Cpan.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/bin/cpan line 8.
BEGIN failed--compilation aborted at /usr/local/bin/cpan line 8.
Though I am still able to run /usr/bin/cpan (own by perl-CPAN-1.9402-119.el6_1.1.x86_64 Centos RPM package).

Is it good to replace /usr/local/bin/cpan by /usr/bin/cpan ?

Is it not going to face another problem and my application is able to make use of this Perl modules installed by newer cpan?

Thanks.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Did you run "/scripts/checkperlmodules --full --force" as was suggested in my first post after symlinking /usr/bin/perl to /usr/local/bin/perl and replacing /usr/local/bin/perl with the Perl 5.10.1 binary?

If you did and this is still happening, I suggest reverting it and using the path to the other binary in your script and trying to install modules via source into the location of the alternate perl if possible.
 

andisugandi

Member
Jun 1, 2012
6
0
51
cPanel Access Level
Root Administrator
Hi,

In case I was doing wrong;

[...] after symlinking /usr/bin/perl to /usr/local/bin/perl and replacing /usr/local/bin/perl with the Perl 5.10.1 binary?
Do you mean "Perl 5.10.1 binary" is /usr/bin/perl file that is part of perl-5.10.1-119.el6_1.1.x86_64 (RPM) package (originally owned by Centos itself)?
Code:
# rpm -qf /usr/bin/perl
perl-5.10.1-119.el6_1.1.x86_64
Thanks for helpful advice.
 
Last edited:

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
You can run "/usr/bin/perl -v" to see the Perl version of that binary. If that shows Perl 5.10.1, then that's the binary you wanted. If it isn't, then the backed up copy (/usr/bin/perl.1323845669) is the version as I noted previously.
 

minosjl

Well-Known Member
Jun 4, 2011
168
0
66
India
cPanel Access Level
Root Administrator
Hi,

I can see that your Perl version is already 5.10 but you are failed to install the Modern:Perl through cpan. So in that case I would suggest you to download the "Modern-Perl-1.20120521.tar.gz" from "search.cpan.org" and uncompress the file and compile it manually by following the below steps and check what happens.

perl Makefile.PL
make
make test
make install

Thy to give the full path of Perl binary while making