Step 0) If installing over SSH (if not go to Step 1)
If you are installing over an SSH shell be sure you used the -X (and/or the -Y) flag when connecting (ssh -X host.name.etc). Then execute
to allow OpenGL to work correctly.
Step 1) Install system packages
sudo apt-get install libxi-dev \
libxmu-dev freeglut3-dev libgsl0-dev \
libnetpbm10-dev libplplot-dev \
pgplot5 build-essential gfortran
Step 2) Install Perl modules
I use cpanm, one may also use cpan, but it makes you hit 'y' many more times
cpanm Term::ReadLine::Perl Inline Astro::FITS::Header ExtUtils::F77
cpanm -v PGPLOT OpenGL
cpanm -v PDL
I like to use the -v on the graphical modules and PDL because they have tests where it helps to read the output that cpanm suppresses. If you don't need that, you may omit the -v.
Also if it seems that any of those hang, try hitting the enter key to continue. Some of the plotting tests require you click around, do so, sometimes hitting the right mouse button as well. You may need to close the PGPLOT server window at some point as well (black window that doesn't seem like its doing anything).
Step 3) Test the tricky modules
perl -e '