Install Perl modules with lots of dependencies on a machine without CPAN network access

前端 未结 4 1727
栀梦
栀梦 2020-12-14 03:42

I am trying to install the DateTime machine on a Linux server. Unfortunately, this Linux server has some restricted network access policy that prevents me from using the CP

相关标签:
4条回答
  • 2020-12-14 04:15

    There are some solutions for this problem, see for example Carton which is like ruby's bundler or else Pinto which aims to be your own private CPAN (as I understand it).

    0 讨论(0)
  • 2020-12-14 04:20

    The most efficient way by far is to make a minicpan, install cpanm on the linux machine and alias localcpanmsomething like this:

    alias localcpanm='cpanm --mirror file:///Users/Shared/cpan/ --mirror-only'
    

    I have used this technique on long train journeys with patchy network access with great success.

    0 讨论(0)
  • 2020-12-14 04:24

    The first step is to automatically download all of the dependencies. You can use cpanm to do this on your network connected machine:

    cpanm -L /dev/null --save-dists dists --scandeps DateTime

    This generates both a list of dependencies, but more importantly downloads them into the dists directory. The -L /dev/null ensures that it doesn't pay attention to the modules already installed.

    Copy dists as is to your restricted box.

    Then, use cpanm on your restricted box to perform the local installation:

    cpanm --mirror file:///path/to/dists -L foo DateTime

    where /path/to/dists is the absolute path to the dists directory. This will install things into the foo directory.

    0 讨论(0)
  • 2020-12-14 04:26

    One solution I use at work is to have a development server with perlbrew, one Perl + modules and the app per app and all this in a git repo. On the production machines access to the git repository is all that's needed to deploy the app and switch between versions using tags.

    0 讨论(0)
提交回复
热议问题