How do I install Perl modules on machines without an Internet connection?

14,272

Solution 1

The usual way to solve "I want to install stuff from CPAN but without network" problems is to use a minicpan as David Dorward wrote in his answer. But since you're going one step further, saying that you'd rather not do any real installation on the client (target) machines at all, and that you want to use precompiled modules if possible, I urge you to check out PAR and specifically PAR::Repository (server) and PAR::Repository::Client.

Since this approach needs some research before you're up to speed, I wouldn't suggest it for "I just need Foo.pm" like problems. Once you're talking about a handful of dependencies and at least a handful of clients, then it becomes a more appropriate solution.

For an outline of how it works, check out the slides of my talk at YAPC::EU 2008. It also hints at solutions to the bootstrapping problem of making the PAR::Repository::Client module available on the clients (hint: PAR can generate self-contained executables).

Solution 2

You can create a MiniCPAN that has just the latest versions of everything from CPAN. You can insert additional, non-public modules into it with CPAN::Mini::Inject. If you need to greater control over versions (i.e. not choosing the latest versions), you might want to create a DPAN.

With any of these solutions, you can configure your CPAN client to pull from your local source. That could be a directory you know ahead of time or something that you figure out dynamically, like a CD or a thumb-drive. It's just a matter of setting up the configuration correctly.

You might be able to get away with creating operating-system packages for most of your work, but that still means you have to compile them at least the first time.

Solution 3

1) How/Where to get specific versions of Perl modules, e.g. CGI.pm etc

http://search.cpan.org/

If you don't want the latest version, you can get an earlier version by following the link in the breadcrumbs.

http://img.skitch.com/20091209-bu7kt3bj65374k7iijfnhrue2y.png

2) How to install these Perl modules. Is it a case of just placing them in a directory somewhere, e.g. a library path and making sure that this directory path is in the @INC library path environmental variable, if it is not already?

That sometimes work, but you really should go through the perl Makefile.PL && make && make test && make install process.

Doing this would require that you manually chase all the dependencies though. You would probably be better off with something like minicpan.

Share:
14,272
therobyouknow
Author by

therobyouknow

I enjoy making software and applying technology to help myself and friends and family achieve things as well as earning a living doing it. github.com/therobyouknow linkedin.com/in/therobyouknow twitter.com/therobyouknow

Updated on June 15, 2022

Comments

  • therobyouknow
    therobyouknow almost 2 years

    I need to install my Perl-based software on networked machines which aren't connected to the internet. Therefore, I would like to download specific versions and/or latest versions of the Perl modules and I would also like to know if there is an install procedure required for these modules.

    Background:
    The machines aren't connected to the internet for security reasons and its deemed unnecessary also.

    I would place the downloaded modules on a machine that I call the 'install server' and it contains my Perl based software and would also contain the local copies of the Perl modules.

    I call a machine that I want to install my Perl-based software on, the 'target machine', also not connected to the internet. There can be several target machines, each can run this software that I want to install. I log onto the target machine and run an install script which would connect to the install machine via the local network to obtain the Perl-based software and dependent Perl modules and installs them.

    So I need to know:

    1. How/Where to get specific versions of Perl modules, e.g. CGI.pm etc
    2. How to install these Perl modules. Is it a case of just placing them in a directory somewhere, e.g. a library path and making sure that this directory path is in the @INC library path environmental variable, if it is not already?

    I would prefer not to have to do anything like make install etc. as part of installing the modules. I would like to modules to be pre-compiled or prepared as necessary so it is as simple as possible to install them. I want to avoid additional dependencies like make and its configuration, and having to parse its output to check whether it was successful.

    Please help me by asking the above specific questions as I am not able to change the concept of 'install machine' and 'target machine' which aren't connected to the internet - I have to provide a solution that works within this arrangement.