search
top

How to Create RPM’s from CPAN modules using Cpan2rpm

You know how it is sometimes working on corporate servers that are in DMZ’s and have firewalls blocking them from accessing Internet and getting to modules, programs and such. You can’t directly and you find ways around to get the files to the systems, that’s a good thing and just part of being an admin.

Thus is the case in this instance with installing a CPAN program on an RHEL server. I recently ran into a situation where I needed an RPM of a specific CPAN module that none of the usual repositories had and with a bit of searching found a handy little application called cpan2rpm.

The trick for using cpan2rpm is that is needs to be installed on the same version you need to create the package for, for example RHEL 6 x64 for a cpan package, etc… Easy enough if you have a full stack for the environments for a server assuming one of th lower environments has Internet access to get the needed packages to create.

Download from http://perl.arix.com/cpan2rpm/

Install the CPAN with the module you need on the build system. You may need rpm-build installed as well. Once installed you can create.

Installed:
rpm-build.x86_64 0:4.9.1.3-1.fc16

Dependency Installed:
patch.x86_64 0:2.6.1-9.fc16

Complete!

 $ sudo rpm -ivh cpan2rpm-2.028-1.noarch.rpm
 warning: cpan2rpm-2.028-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID de770456: NOKEY
 Preparing...                ########################################### [100%]
 1:cpan2rpm               ########################################### [100%]

Now install the CPAN module locally on your system using CPAN and make sure any dependent rpms are installed. Once done you can create the rpm.

cpan> install GD::Thumbnail

Now we can create the RPM we need

$ cpan2rpm --no-sign GD::Thumbnail

If cpan2rpm cannot determine the version you can assist it by using –version

 $ cpan2rpm --no-sign --version 1.41 GD::Thumbnail

Now we have an RPM that can be installed on the system.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

top