Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Move Perl modules to new CentOS VPS

by monx (Novice)
on Nov 08, 2013 at 19:16 UTC ( [id://1061743]=perlquestion: print w/replies, xml ) Need Help??

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

Hi all
I am tasked with moving the Perl installation to a new CentOS VPS.
I have root access in both servers.

My main worry is that the new machine which will come installed with Perl (version of our choice) will not have the CPAN modules installed in the old server.

I know that executing cpan -a will create files in the ~/.cpan directory which list all the installed modules of the current machine.

However, how do I install all these modules on the new server and also... Certain Perl modules prerequire the existence of certain OS or other installed software libraries. For example, the GD Perl module requires quite a few underlying graphics libraries (e.g. libjpg, libpng etc)

What is the quickest way to pack my old Perl installation and move it to the new server?

Thanks for any responses

Replies are listed 'Best First'.
Re: Move Perl modules to new CentOS VPS
by MidLifeXis (Monsignor) on Nov 08, 2013 at 19:28 UTC

    Do not mess with the OS-installed perl.

    Longer answer: Unless trying to make your application installable by all, install a local perl distribution into its own location that your application has been tested with, including all required modules and configurations. This allows you to decouple your application from the OS-required version of perl, minimizes the chance of breaking the OS by touching the OS-required version of perl, and minimize the chance of OS upgrades breaking your application (for the same reason).

    (Update) Use the build toolchain. Configure the prerequisites in your Makefile.PL or Build.PL, and use cpanm to build a self-contained library directory of the requirements. You should include everything that your application directly uses in the prerequisites (not just the top level module, and not modules that you don't directly use). You then have a set of steps by which you can target any additional platforms (or CPAN updates, etc). See also:

    --MidLifeXis

Re: Move Perl modules to new CentOS VPS
by marto (Cardinal) on Nov 08, 2013 at 20:02 UTC

    "What is the quickest way to pack my old Perl installation and move it to the new server? "

    Don't. Install whatever version of perl you want elsewhere on the system and leave the vendor perl alone. Otherwise you could end up with an unstable or broken system.

    It's trivial to use either perlbrew or the method descried in the README (links here). Once you have perl installed you could use cpans autobundle function to build a list of the installed modules from your existing server, and simply install the bundle it creates on your new server. Before doing so you can edit the file and remove any modules you don't want. See Re: List of Installed Perl Module in Unix Box.

      Thanks to both marto and MLX, helpful stuff...

      So
      a) distribution's Perl installation should not really be messed around with. If needed just install an alternative version of Perl for use by my Perl apps.
      b) Use CPAN's autobundle to "create" the installed module list. Then use perlbrew on the new server to re-install based on what's on the old server. Perhaps using perl -MCPAN -e 'install Bundle::Snapshot'

      But... What about external libraries used by the various Perl modules such as GD with the libjpeg, libpng etc? Do these libraries have to be installed fresh on the new server? Is there a good way to at least get a list of such external dependencies?

      Cheers...
        Greetings,

        Should be a no brainer. You have root. So just fire up what ever flavor of application management your flavor of Linux uses -- yum, druid, slac, apt, ... and take inventory. Is GD installed? Was the package the "development" version (you'll probably want that one) while I run *BSD's. As I recall, getting all the optional libraries often wanted on a Linux box required the development packages. Anyway. If you perform this step ahead of your localized Perl install/upgrade. You shouldn't run into any difficulties that aren't easily handled.

        HTH

        --Chris

        #!/usr/bin/perl -Tw
        use Perl::Always or die;
        my $perl_version = (5.12.5);
        print $perl_version;

        A subset of (library) dependencies can be found via ldd(1) ...

        # current-host # find /perl/root/directory -name '*.so*' -type f \ | xargs ldd
        W.R.T. external dependencies: Since your dependencies are probably on the devel packages, and this is an rpm based system, then rpm -qa | grep '\-devel' should give you a good starting point.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-28 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found