Debian Clusters for Education and Research: The Missing Manual

Source Installation Paradigm

From Debian Clusters

Jump to: navigation, search

Contents

Overview

Installing from source is slightly different (and more complicated) than using the built-in Debian package manager, apt. When new software is installed with apt-get install, Debian takes care of making sure all the dependencies are taken care, and sometimes even takes care of most of the initial configuration of the package. Installing from source is a "roll your own" kind of installation, in a sense.

The general outline for installing from source is

get the software ---> run ./configure ---> run make ---> run make install

That's it!

When to Install From Source (and when not to!)

The Debian package maintainers go to lengths to ensure that the Debian software is stable and plays nicely together. Something that has to be given up for this stability, and that's the ability to use cutting-edge software. Installation from source should be used when important differences exist between the current version and the Debian packaged version. (This is often the case with scientific software.)

When using the apt package manager, it also takes care of many different little details for you during the installation. It's great to have a mostly vanilla option, but sometimes software should be customized more thoroughly for a system than the apt package would easily allow. This is another instance when installation from source should be used.

Software shouldn't be installed from source if you want it to be automatically and easily updated (like installing Apache, a web server), if you want a plain vanilla installation, and especially if the software you're installing is simple.

As a guideline, most scientific software and a lot of non-operating system software should be installed from source.

Step One: Getting the Software

The first step in installing from source is downloading a compressed version of the source code. For open source projects, this is usually easy to find in a "Downloads" or similar section. I always keep my source code in one directory so it's easy to find later; I picked up using /usr/local/src as a habit from my mentor. You can use a different directory if you want.

From your directory of choice, use the command wget. Wget is used to download a file from a website and place it in your directory. For instance, if you're installing MPICH, you might run

wget http://www-unix.mcs.anl.gov/mpi/mpich/downloads/mpich2-1.0.5p4.tar.gz

Source code usually comes in a format ending with .tar.gz. This indicates it's a tarball that has been gzipped. To untar it and ungzip it at the same time, run

tar xvf <your file>

This will spit out the contents of the tarball in a new directory with the same name, minus the .tar.gz. Nifty, huh?

Step Two: Configuration

The next step for installation is to run ./configure from within your new directory and specify all of the options that you want the compiler to use when it creates your version of the source code to install.

./configure -help

will show all of the available options. (If it's longer than a page or two, run ./configure -help | less for an easier reading experience.) A common and important option is --prefix. This is used to specify where all of the files installed should be located. For instance, often times I want software installed to be accessible to all of my worker nodes, so I'll specify --prefix=/shared/ in order to install it onto my NFS mount.

Once you've decided on all of the options needed, run

./configure <option 1> <option 2> <option 3> <etcetera>

If you ever need to remember what options you used when you ran it, check the top of the file config.log. This file is automatically generated when you run ./configure.

Step Three: make

The next step should be as easy as just running make. The program make takes all of the parameters for your system that ./configure found out, and creates a version of the source code to be installed specific to your system. It shouldn't need any input from you, just what ./configure created for it. However, there are a couple of show-stoppers:

-bash: make: command not found

means it's time to

apt-get install make

Run make again after it's done. Another possible error,

gyrfalcon:/shared/source/mpich2-1.0.5p4# make
Beginning make
all-local
make: all-local: Command not found
make: *** [all-redirect] Error 127

means you need to

apt-get install automake

Run make again when it's done.

Step Four: make install

Finally, make install is used to take the new installation created by the previous run of make and install it to your system, again using all of the preferences and such that you specified earlier with ./configure. Just run

make install

And that should be it.

Personal tools