4

I don't want to install multiple instances of perl.

How can I upgrade my Perl to latest version or delete existing Perl installation and install a new version of Perl in Ubuntu 14.04. After new installation, will it conflict with older installation files.

Bharat
  • 69
  • 1
  • 1
  • 5
  • 1
    It is a bad idea to update your 'system' perl, separately, as you may have things depending on it. Far better to do a source build and install in /usr/local/bin – Sobrique Jan 13 '16 at 09:50
  • 1
    @Sobrique can you please suggest how to do that – Bharat Jan 13 '16 at 10:03

1 Answers1

21

I'd do it like this:

wget http://www.cpan.org/src/5.0/perl-5.22.1.tar.gz
tar xvfz perl-5.22.1.tar.gz
cd perl-5.22.1 && ./Configure -Duseithreads -des && make && make test && make install
/usr/local/bin/cpan -u

This puts a source build of perl in /usr/local/bin

Then check your path has /usr/local/bin in it, and if you want typing perl to run your new perl, ensure it's in front of /usr/bin (this is a fairly common scenario, but I can't say for sure if that applies.

Whilst you say you don't want to install multiple perl versions - this is a bad idea.

perl is distributed as part of your operating system. Packages depend upon it, and the particular version. You cannot tell what you might break by altering versions - not least because the way perl handles certain things does change between versions (like hashes).

Messing around with /usr/bin/perl is a road to some future pain (not least - it makes an 'update' of your OS annoyingly difficult, because you can no longer use the package manager without a bit of hackery)

If you REALLY REALLY want to do that you can set -Dprefix= in your Configure options. But as a sysadmin of 15 years experience, I can tell you - no good will come of it, you will break your OS in a variety of minor, but cumulatively really annoying ways. (And maybe some bigger ways)

Sobrique
  • 52,974
  • 7
  • 60
  • 101
  • in addition to Sobrique's answer, anyone can simply go to http://www.cpan.org/src/5.0/ and just do ctrl+f and search which version you're looking for then download/wget it yourself – jaxarroyo Nov 01 '18 at 17:53
  • consider: https://stackoverflow.com/questions/1289564/how-should-i-install-more-than-one-version-of-perl – ljgww Dec 16 '18 at 10:59