bushidoka has asked for the wisdom of the Perl Monks concerning the following question:

Help me obi-wan kenobi, you're my only hope! I've asked this question on the CentOS list, on the cpan-discuss list, and on other various lists and I have still to come up with a reasonable way to do this.

I'm an all Centos shop, with CentOS 5.2 and 5.4 in production. No, I cannot easily update the 5.2 machines to 5.4. Also, I've got some 32 bit and some 64 bit installations of each.

The basic problem is this : how to keep numerous machines with the same CPAN installation? i.e. same modules installed across all boxes. Seems like a simple thing to ask for, but something that CPAN just is not designed to do very well from what I can find.

I've tried autobundle, and then applying the bundle, but you end up going through 10s of minutes of the whole build process answering questions and so forth, as there does not seem to be a way to tell CPAN to just use all the defaults.

Someone on the CentOS list pointed me at this article http://www.developertutorials.com/tutorials/cgi-perl/automate-perl-module-deployment-050426/page1.html

which looked good at first, but ends up being a little too simplistic. I like the idea that you do it in several phases and break down the build process into its steps - do the "perl Makefile.PL" once, where you answer all the questions - then on each host go through and do the "make", "make install" and so forth. But this does not explain how I am supposed to deal with modules that want to install other modules and so forth, and I'm not savvy enough to figure it out myself.

I see from cpan-discuss archives someone talking about http://perl.arix.com/cpan2rpm/ which appears to have promise as well. But I tried it out with no luck.

My other option is of course to go through my list of CPAN modules (about 170) and see if there are appropriate RPMs for them all at rpmforge or one of those places, and switch over to use those. From what I can see so far, yum/RPM is just a better way to do this as it was designed with this in mind. It is really easy to install what you need in an automated fashion without having to babysit the process for 10s of minutes.

I've also been told "use CPAN Plus", but while I did manage to get that installed, it is not readily evident how it is supposed to help with my problem. Can someone recommend some reading to that end?

What I've basically decided at this point is that I should probably just maintain a 32 bit install in one central location, and a 64 bit as well, then rsync it out to all the other machines. So install once - answering all the questions - the rsync out. Anything wrong with this idea?

What are you all doing for this?

Replies are listed 'Best First'.
Re: managing cpan across machines
by JavaFan (Canon) on May 04, 2010 at 22:16 UTC
    What are you all doing for this?
    I'd use the same procedure I'd use for any other software. I'd certainly not run a fetch/configure/make/test/install cycle on production machines. To name a few reasons why not:
    • It's unlikely I want production machines even be able to connect to CPAN mirrors.
    • Production boxes should run the services they are supposed to run - and as little else as possible. No compiling. No test suites.
    • It doesn't take care of synchronizing.
    I'd use puppet, cfengine or some other tool to synchronize my server farm; and only run the fetch/configure/make/test/{install|make-package} cycle on a single box.
Re: managing cpan across machines
by zwon (Abbot) on May 04, 2010 at 21:04 UTC

    I'm using cpan2rpm and quite satisfied. What problems do you have with it?

    Another solution is to use rsync to synchronise site_lib directories

Re: managing cpan across machines
by proceng (Scribe) on May 05, 2010 at 00:35 UTC
    You don't say so, but if the machines exist on the same network, I would be inclined (after testing of course) to share out the perl library directories from a central server. This allows you to maintain one directory tree, instead of having to physically/logically touch each machine.

    Also, you don't mention whether or not you use the same perl version across all of the systems. If not, you will wind up testing each and every combination.

    If neither is an option, I would set up a multi-boot system with all (4?) systems available. Then, set up a master directory structure that includes the sub directories for each architecture and perl version.

    Super Search will give you pointers to how to set up a "private" perl library structure. Once that structure is set up, you will be able to simply install the appropriate modules using a combination of CPAN (or CPANPLUS) and the individual environments. Simply build (and test) for one environment (say, 5.4 x86_64) then create an autobundle module. Now, use that to create the other environments, then install the entire environment on a shared drive (if possible) or rsync the entire directory structure on each machine.