Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

migrate cpan from AIX to Red Hat

by sazo (Novice)
on Jul 30, 2013 at 13:40 UTC ( [id://1047028]=perlquestion: print w/replies, xml ) Need Help??

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

Hi! I need to migrate CPAN environment (3000+ modules) from AIX to Redhat preferably using rpm packages from RH, EPEL, Fedora repositories. I am thinking of a solution to collect all the .pm filenames in a textfile list which would be processed line-by-line using "yum whatprovides *...pm" on Redhat to extract the rpm-package names the given .pm belongs to and then to build a list of the rpm packages needed to be installed. Does anyone have a better/more elegant idea how to realise that. I am trying to avoid to recompile the packages, hence the use of autobundle.

Replies are listed 'Best First'.
Re: migrate cpan from AIX to Red Hat
by jfroebe (Parson) on Jul 30, 2013 at 14:07 UTC

    Avoid using the system Perl if you can. Have your users/applications use a local installation of Perl. This prevents Perl module conflicts with what RHEL is expecting. It also has the benefit of when you upgrade to the new version of RHEL (or migrate to another machine), you can just tar ball the Perl directory and extract.

    Jason L. Froebe

    Blog, Tech Blog

      Note that “tarballs” can be expected to work across machines only if the surrounding environment ... installed libraries and library-versions ... are known to be identical across the machines.   Many CPAN modules install themselves by compiling C programs, checking installed library versions, and other magickal things.   Then, they run a slew of self-tests to make certain everything works.   Everything should be copacetic if, say, the machines are known to be “corporate clones” of one another.

      What most-certainly won’t work is a migration from AIX to (Red Hat or otherwise) Linux.   Apples and oranges.   The binary modules upon which many Perl libraries actually depend will not load or run correctly.   You must repeat the install on one Red Hat machine ... letting CPAN discover and compile and link and otherwise do whatever it takes to accommodate Linux.   Then, perhaps, you can tarball-clone that.   When the dust finally settles, the Perl programs should then run more-or-less identically.

        I thought that was obvious but you are correct that I should have explicitly stated that. :)

        Jason L. Froebe

        Blog, Tech Blog

        Thanks! Can I use the perllocal.mod on machine1 to clone the installed modules on machine2? If yes, how, are there any scripts that parse the content and make the installation?
Re: migrate cpan from AIX to Red Hat
by rurban (Scribe) on Jul 30, 2013 at 17:37 UTC
    find /usr/lib/perl5 -name \*.pm | xargs yum whatprovides will not work because the prefix will be different. But it is a good idea. dists can be named differently to modules.

    I thought of using CPAN or a simple script like instmodsh (from ExtUtils::Installed) to get the list of your modules, and then mangle the names to find the rpm's.

    perldoc ExtUtils::Installed

      I found the option to consider the modules in a given directory my $installed = ExtUtils::Installed->new(extra_libs=>["/my/lib/path"]); But I still don't understand why is there a huge difference in the number of modules found by this method and by using find *.pm? There are more than 10x more .pm files as modules found by this method. Can multiple .pm files belong to a module?
        I found it out: it seem a module can contain several .pm files.
      I have been working on a solutions that is based on the find *.pm and yum whatprovides, but it needs a lot of parsing of the yum output in order to create a list of rpms and repositories that need to be installed on the new RH machines. Thanks for the tip with the Extutils:Installed. Unfortunatelly, listing the installed modules using instmodsh only shows a tiny fraction of all the installed modules, probably because they are installed outside the default directories.
Re: migrate cpan from AIX to Red Hat
by Anonymous Monk on Jul 30, 2013 at 14:15 UTC
      Thanks, as I understand this tool is for packaging a given Perl application. Is it also possible with this tool to package the whole Perl/CPAN environment on AIX and migrate it to RedHat? I would prefer a cleaner process based on original rpm packages, which makes it simpler to replicate the same environment on a high number of servers.
Re: migrate cpan from AIX to Red Hat
by FloydATC (Deacon) on Jul 31, 2013 at 15:56 UTC
    I always start out trying to stick with RPM packages when using a fresh RH/CentOS box and every single time I end up having to pull modules from CPAN because the shrinkwrapped ones simply don't work or miss out on dependencies.

    Last time it happed was just a few days ago when I tried to install HTML::Mason and Apache::Request was missing. The official repo had no RPM for my platform and so I had to install about 25-30 modules from CPAN anyway. The RPM'ed HTML::Mason ofcourse refused to work with those, so I had to reinstall that from CPAN as well.

    Long story short: Just bite the compile bullet and install from CPAN right away, because that's what you'll end up doing anyway.

    Just my 0.02€

    -- FloydATC

    Time flies when you don't know what you're doing

      Thanks FloydATC, If I would like to replicate the CPAN from one machine to the other, what should I do? Should I use the perllocal.doc file from machine1 with some parser to install the same modules on machine2? I guess the autobundle wont work if the two machines are different architectures (AIX vs. RedHat on x86).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1047028]
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-19 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found