Post by (Andreas J. Koenig)Post by nimectosI looked at "perldoc CPAN" and other info, but I can't seem to
cleanly install CPAN packages offline.
I want to run CPAN normally to install a lot of Perl packages on
one machine (CentOS 5.6 x64 distro just installed, has Perl
5.8.8), capture everything needed to an archive, then take that
archive to another identical fresh machine and install all the
Perl packages WITHOUT any network access.
I fooled with archiving/restoring /root/.cpan/sources, and also
with a bundle, with both methods cpan gave a lot of complaints
about lack of network access, and failed one way ("Can't call
method "color_cmd_tmps" on an undefined value at
/usr/lib/perl5/5.8.8/CPAN.pm line 3784.") or another (said
required package install-0.01 not present - how can this be when
original online install finished successfully?)
What's the best way to do this - whether with just CPAN, and/or
other methods?
=head2 Floppy, Zip, Offline Mode
CPAN.pm works nicely without network access, too. If you maintain machines
that are not networked at all, you should consider working with C<file:>
URLs. You'll have to collect your modules somewhere first. So
you might use CPAN.pm to put together all you need on a networked
machine. Then copy the $CPAN::Config->{keep_source_where} (but not
$CPAN::Config->{build_dir}) directory on a floppy. This floppy is kind
of a personal CPAN. CPAN.pm on the non-networked machines works nicely
with this floppy. See also below the paragraph about CD-ROM support.
Are you saying you did exactly that and it did not work? I would
consider that a bug. But I need you exact description how you followed
this description. It may be that you misuderstood the process so that
the description needs amending or that the process is broken in the
meantime and needs fixing.
Please let me know how it goes.
I finally succeeded, with some difficulties.
First, the CPAN version (v1.7602) provided with that distro is apparently
broken. I could not install the modules I wanted without encountering at
some point:
Can't call method "color_cmd_tmps" on an undefined value at
/usr/lib/perl5/5.8.8/CPAN.pm line 3784.
BTW, the constant prompting for dependencies bugged me, so I changed
CPAN/Config.pm to:
'prerequisites_policy' => q[follow],
So I tried "cpan Bundle::CPAN" to update CPAN. But although it worked on
the source machine, it wouldn't install offline on the destination.
So instead I then tried (on a fresh machine) "cpan CPAN". That worked.
Then I installed needed modules via "cpan module module ...". That went
fine, but it still prompts:
- MIME::Lite "Add prereqs?" prompt for extra external modules.
- Crypt::SSLeay prompts for install path and live tests.
How can I pre-set the answers to those?
Then it failed, last messages:
...
Result: FAIL
Failed 2/3 test programs. 0/1 subtests failed.
BLHOTSKY/MasonX-Request-WithApacheSession-0.31.tar.gz
2 dependencies missing (HTML::Mason,Apache::Session::Wrapper);
additionally test harness failed
./Build test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports BLHOTSKY/MasonX-Request-WithApacheSession-0.31.tar.gz
Running Build install
make test had returned bad status, won't install without force
I happened to just try running the same cpan command again, no changes -
and this time it completed OK?! (And got one more set of prompts from
Apache-Session-Wrapper - how preset those?)
So finally everything was installed on the source machine.
So then I grabbed all of the cpan data via, in/as root:
tar -czvf dot-cpan.tar.gz .cpan
Then I went to the clean destination machine (with no network access), and
untar'd the archive. Also, changing to this Config.pm setting seemed to
reduce complaints about being offline:
'connect_to_internet_ok' => q[0],
So I did those same steps again (cpan CPAN, then cpan modules... twice,
getting same prompts, same error), and it did work offline.
However, it takes a long time.
So I was thinking of just archiving the installed modules from the source
machine and unarchiving on the destination, e.g. just tar up:
/usr/lib/perl5/*
/usr/lib64/perl5/*
and restore on the target (ignoring module docs). Would that work? (I'd
still unarchive the .cpan sources so they are present, just wouldn't build
them via cpan commands).
Or is there an alternate approach?
CPAN question: how can I list all installed modules? The closest I could
find is the "r" command, but it's not clear if that is listing every
installed modules, or just those that are candidates for upgrades.