Q: I tried to run a Perl program but it says that Perl 5.10 is needed. How do I install it on CentOS?
A: CentOS 5.x ships by default with Perl version 5.8.8 as you can confirm running the following command :
perl --version This is perl, v5.8.8 built for x86_64-linux-thread-multi
While this is not a big issue and you should normally be fine with this version of Perl some programs could require an higher version of the interpreter. CentOS 6 will ship this version of Perl by default but on CentOS 5.x there is no rpm package to install and you have to compile Perl by hand, let’s see how.
I cannot give you a complete list of needed packages to compile the new Perl version, my system had everything already installed so should be the same for you, but I know for a fact that you will need make and gcc so install them with the following :
yum install make gcc
One done this download the Perl source code from here and uncompress the file to a location convenient for you. Once you have the file uncompressed just issue the following command from that directory :
sh Configure -de -Dusethreads
The -de switches are used to answer with the default answer to any compilation question and the -Dusethreads is used to compile interpreter to support threads. Once the installation has been correctly configured simply issue the “standard” make commands to have your new Perl installed and configured on your system with the following commands :
make make test make install
Pay attention when you run make install as the compiler will ask you which path Perl should be installed in in my case (default) this was in /usr/local/bin/perl
Congratulations now you can now enjoy the new version of Perl 5.1x!
I hope you found the article useful, if so please spend some time to retweet the article or to leave a comment.