ADC - Innovative Data Solutions
Installing Perl Packages on CentOS - The magic of YUM
Sometime ago I wrote a perl CGI program to send mail using STMP. In order to create this script I was write required to install some perl packages which proved relatively straight forward to install using CPAN.
However recently I decided to migrate this code to a bare bones CentOS machine.
I ran cpan and then realised I was missing a C compiler. So quit and performed the following operations
yum -y update
yum install gcc
yum install make
yum install unzip
Now I ran cpan again and tried to install the first dependant module in this case Net::SSLeay
Unfortunately I was presented with the following message :
*** Found OpenSSL-0.9.8e installed in /usr
*** Be sure to use the same compiler and options to compile your OpenSSL, perl,
and Net::SSLeay. Mixing and matching compilers is not supported.
Oh no!! I certainly did not want to have to recompile perl, and OpenSSL with the same compiler.
However on this occasion I was saved by the yum package manager. A quick check with the command yum whatprovides 'perl(Net::SSLeay)'
produced the following message:
perl-Net-SSLeay-1.30-4.fc6.x86_64 : Perl extension for using OpenSSL
Matched from:
Other : perl(Net::SSLeay)
What a great result, there is a package already available, no need for CPAN or compiling. So the next step was to issue the command
yum install perl(Net::SSLeay)
So far so good, yum indicated the module was now installed, so the following command was issued to confirm if this was indeed the case and if perl could use the module.
perl -MNet::SSLeay -e 1
No errors were shown with the above command, so all was looking good. Yum resulted in a clean install, which has the added benefit that it can be upgraded along with the rest of the system as and new versions become available.
I have never installed perl modules using a package manager before and have always either used CPAN or compiled them from C. I now feel like I have been living in the dark ages and from this day forward will aways try to use the built in package manager where possible.
This approach also worked like a dream for the following modules
yum install 'perl(IO::Socket::SSL)'
Sunday, 4 October 2009
Cent OS and Perl