Question

What do I need to set up and maintain a local CPAN mirror? What scripts and best practices should I be aware of?

Was it helpful?

OTHER TIPS

CPAN::Mini is the way to go. Once you've mirrored CPAN locally, you'll want to set your mirror URL in CPAN.pm or CPANPLUS to the local directory using a "file:" URL like this:

file:///path/to/my/cpan/mirror

If you'd like your mirror to have copies of development versions of CPAN distribution, you can use CPAN::Mini::Devel.

Update:

The "What do I need to mirror CPAN?" FAQ given in another answer is for mirroring all of CPAN, usually to provide another public mirror. That includes old, outdated versions of distributions. CPAN::Mini just mirrors the latest versions. This is much smaller and for most users is generally what people would use for local or disconnected (laptop) access to CPAN.

Besides the other answers, check out Leon's CPAN::Mini::Webserver, which gives you a CPAN Search interface to your local CPAN copy.

If you want to do more fancy things, see my "MyCPAN" talk. You can inject your own private modules into your private CPAN with CPAN::Mini::Inject, for instance.

CPAN::Mini is fine. By default it keeps only the latest version of a distribution, not every version as CPAN does.

You can also install CPAN::Mini::Webserver, which provides you with a web interface to your local cpan mirror - very handy if you are offline and still want to work with perl.

Randal Schwartz wrote an article about mirroring The CPAN that I've found quite useful: http://www.stonehenge.com/merlyn/LinuxMag/col43.html

Try CPAN::Mini.

The most likely scenario for running a CPAN mirror is so that your network of 50 machines can all be updated from it locally, instead of hitting the network 50 times.

I'd argue that using CPAN in the traditional manner is a poor way to keep a network of servers up to date.

I run a network of RedHat machines. I package all CPAN modules intended for use in production into RPMs (mostly using the cpanflute2 tool from RPM::Specfile) and deploy them that way, thereby ensuring proper dependency tracking which you don't really get from CPAN itself in any sane way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top