-
Notifications
You must be signed in to change notification settings - Fork 46
Installing Using cpanm
This tutorial is under construction, for the time being it targets Ubuntu Linux circa 11.04, hopefully it can be expanded while remaining simple.
In recent years the Perl community has created a severl new tools for managing your Perl installation. Some useful ones are perlbrew and local::lib. Arguably App::cpanminus (or cpanm to its friends) has made the biggest splash. Its description gives a clue as to why:
cpanminus is a script to get, unpack, build and install modules from CPAN and does nothing else. It's dependency free (can bootstrap itself), requires zero configuration, and stands alone.
Installing is as simple as
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
There are some cases where you will not need the '--sudo' switch, but for now lets assume that you know who you are.
On Ubuntu Linux (circa 11.04) we can use apt to install the necessary dependencies. See Installing PDL Manually for a full discussion on each individual dependency.
sudo apt-get install libxi-dev libxmu-dev freeglut3-dev libgsl0-dev \
libnetpbm10-dev libplplot-dev pgplot5 build-essential gfortran
This tutorial recommends installing all Perl modules from CPAN rather than apt to be compatible with perlbrew and local::lib. This tutorial shows installation using 'sudo', however perlbrew, local::lib and non-linux users will want to omit it. Further, in principle the following lines may be combined (with PDL last), however since some modules are a little troublesome, until you are certain of things, we will split it up.
First lets install the easy ones.
sudo cpanm Term::ReadLine::Perl Inline Astro::FITS::Header ExtUtils::F77
Next a couple troublesome ones. To pay a little closer attention, we use the '-v' option for verbose output. This can be omitted on future attempts if desired.
sudo cpanm -v PGPLOT OpenGL
Finally we install PDL itself. Again '-v' may be omitted once you are comfortable.
sudo cpanm -v PDL
For those of you who want to be closer to the front line of development can install a developers release. They often have new features, but may not be as fully polished.
First visit the PDL page on MetaCPAN, on the left pick the latest (probably the topmost) release in the drop-down menu. Once that page loads copy the 'download' link on the left side and pass it to cpanm. For example, a command might look like:
sudo cpanm http://cpan.metacpan.org/authors/id/C/CH/CHM/PDL-2.4.9_016.tar.gz
To test how well the tricky dependencies installed, run the following.
Linux/Mac users:
perl -e '
use PDL;
use PDL::Graphics::PGPLOT;
use PDL::Graphics::TriD;
print qq[success\n]'
Windows users will have to change the single quote (') to a double quote (").
If you want to install on via an ssh connection, be sure to connect using X server tunneling.
ssh -X user@hostname
then, before doing anything else in the tutorial, run the following
export LIBGL_ALWAYS_INDIRECT=y
which should prevent OpenGL errors from halting the process.
This article derives from my blog post. See the original there.