How To's

Update Perl to Latest from Source (CentOS)

29,183 views · 11 found this helpful

Was this helpful?

Problem

A program you are attempting to run requires version of Perl later than the one available through yum install.

tl; dr

Current latest version of Perl is 5.20

wget http://www.cpan.org/src/5.0/perl-5.20.2.tar.gz
tar -xzf perl-5.20.2.tar.gz
cd perl-5.20.2
./Configure -des -Dprefix=$HOME/localperl
make
make test
make install
export PATH=$HOME/localperl/bin:$PATH

Solution

You can see current latest version on the CPAN website.

To begin the installation, you first need to download and unzip it:

wget http://www.cpan.org/src/5.0/perl-5.20.2.tar.gz
tar -xzf perl-5.20.2.tar.gz
cd perl-5.20.2

Run the configure command:

./Configure -des -Dprefix=$HOME/localperl

Finally, make, test and install your dependencies:

make
make test
make install

make and make test can take a while. You can probably go for lunch when you hit make test.

Export path to Perl

Before other programs can use Perl through perl program.pl command, you need to add the path to the interpreter. Assuming you installed it in ~/localperl, you can do so by running this shell command:

export PATH=$HOME/localperl/bin:$PATH

Congratulations, you are now ready to use the latest version of Perl!

  • Updated

← All articles

Still stuck?

Our engineers answer tickets directly, 24/7.