I've been landed with the job of documenting how to install a very complicated application onto a clean server. Part of the application requires a lot of perl scripts, each of which seem to require lots of different perl modules.
I don't know much about perl, and I only know one way to install the required modules. This means my documentation now looks this:
Type each of these commands and accept all the defaults:
sudo perl -MCPAN -e 'install JSON' sudo perl -MCPAN -e 'install Date::Simple' sudo perl -MCPAN -e 'install Log::Log4perl' sudo perl -MCPAN -e 'install Email::Simple' (.... continues for 2 more pages... )
Is there any way I can do all this one line like I can with aptitude i.e.
Type the following command and go get a coffee:
sudo aptitude install openssh-server libapache2-mod-perl2 build-essential ...
Thank you (on behalf of the long suffering people who will be reading my document)
EDIT: The best way to do this is to use the packaged versions. For the modules which were not packaged for Ubuntu 10.10 I ended up with a little perl script which I found here )
#!/usr/bin/perl -w
use CPANPLUS;
use strict;
CPANPLUS::Backend->new( conf => { prereqs => 1 } )->install(
modules => [ qw(
Date::Simple
File::Slurp
LWP::Simple
MIME::Base64
MIME::Parser
MIME::QuotedPrint
) ]
);
This means I can put a nice one liner in my document:
sudo perl installmodules.pl
Depending on your distribution, many perl modules may be already packaged.
Before using CPAN check if some/most/all of the needed packages are not already available for your distro.
I have found CPAN less than ideal for long running systems as updating modules over time seems to be less than ideal.
I would recommend using your system's built in package management system instead. By using a distribution specific repository you should have fewer issues with dependencies, and as modules get updated you will receive the new versions as well. Since you appear to be using Ubuntu, you may need to enable some of the extra repositories such as world, or metaverse, or uber-ultra-intraverse.
Failing this, there is a relatively new website called Linux Packages Search that attempts to compile packages for all manner of systems. I have had good luck with finding any extra packages that I needed on it, if it wasn't available anywhere else.
If you need to do a from-source install of these modules (as I often need to, since I install them as a non-root user in a location other than the system standard) I recommend CPANPLUS as a worthwhile upgrade to standard CPAN - it handles dependency resolution and can automatically install all a module's dependencies while you get a coffee.
Also, if this big complicated application you're installing is also distributed on the CPAN (I'm going to make an outside guess that it's RT, everybody's favourite perl dependency nightmare), there's often a
Bundle::AppName
package on the CPAN as well which rolls up everything needed for a given version of the app.Hope that helps; good luck!
I'd create a Task style module that bundles all your dependency listings into a CPAN style module. That way you can use standard cpan tools to manage it. For example, here's a bundle I often use (shameless plug)
http://search.cpan.org/perldoc?Task::BeLike::JJNAPIORK
You could probably just take something like that and modify as needed.
Additionally consider using local::lib rather than the global perl include path. That way you get better management of your deps, and you don't need root. Here's a link to a good, free book that covers this (amongst other things)
http://www.onyxneon.com/books/modern_perl/index.html
use system function and use && operator after each module installation like