Sometimes the best way to get access to a piece of software on the HPC systems is to install it yourself as a "local install". This document will walk you through the OSC-recommended procedure for maintaining local installs in your home directory or project space.
Before installing your software, you should first prepare a place for it to live. We recommend the following directory structure, which you should create in the top-level of your home directory:
local |-- src |-- share `-- lmodfiles
This structure is how OSC organizes the software we provide. Each directory serves a specific purpose:
local- Gathers all the files related to your local installs into one directory, rather than cluttering your home directory. Applications will be installed into this directory with the format "appname/version". This allows you to easily store multiple versions of a particular software install if necessary.
local/src- Stores the installers -- generally source directories -- for your software. Also, stores the compressed archives ("tarballs") of your installers; useful if you want to reinstall later using different build options.
local/share/lmodfiles- The standard place to store module files, which will allow you to dynamically add or remove locally installed applications from your environment.
You can create this structure with one command.
$HOME is the full path of your home directory. You can identify this from the command line with the command
After navigating to where you want to create the directory structure, run:
mkdir -p $HOME/local/src $HOME/local/share/lmodfiles
Now that you have your directory structure created, you can install your software. For demonstration purposes, we will install a local copy of Git.
First, we need to get the source code onto the HPC filesystem. The easiest thing to do is find a download link, copy it, and use the
wget tool to download it on the HPC. We'll download this into
cd $HOME/local/srcwget https://github.com/git/git/archive/v2.9.0.tar.gz
Now extract the tar file:
Next, we'll go into the source directory and build the program. Consult your application's documentation to determine how to install into
"software_name" with the software's name and
"version" with the version you are installing, as demonstrated below. In this case, we'll use the
--prefix option to specify the install location.
You'll also want to specify a few variables to help make your application more compatible with our systems. We recommend specifying that you wish to use the Intel compilers and that you want to link the Intel libraries statically. This will prevent you from having to have the Intel module loaded in order to use your program. To accomplish this, add
CC=icc CFLAGS=-static-intel to the end of your invocation of
configure. If your application does not use
configure, you can generally still set these variables somewhere in its Makefile or build script.
Then, we can build Git using the following commands:
cd git-2.9.0 autoconf # this creates the configure file ./configure --prefix=$HOME/local/git/2.9.0 CC=icc CFLAGS=-static-intel make && make install
Your application should now be fully installed. However, before you can use it you will need to add the installation's directories to your path. To do this, you will need to create a module.
Creating a Module
Modules allow you to dynamically alter your environment to define environment variables and bring executables, libraries, and other features into your shell's search paths.
We will be useing the filename 2.9.0.lua ("version".lua). A simple Lua module for our Git installation would be:
-- Local Variables local name = "git" local version = "2.9.0" -- Locate Home Directory local homedir = os.getenv("HOME") local root = pathJoin(homedir, "local", name, version)
-- Set Basic Paths prepend_path("PATH", pathJoin(root, "bin")) prepend_path("MANPATH", pathJoin(root, "share/man"))
NOTE: For future module files, copy our sample modulefile from
~support/doc/modules/sample_module.lua. This module file follows the recommended design patterns laid out above and includes samples of many common module operations
Any module file you create should be saved into your local lmodfiles directory ($HOME/local/share/lmodfiles). To prepare for future software installations, create a subdirectory within lmodfiles named after your software and add one module file to that directory for each version of the software installed.
In the case of our Git example, you should create the directory
$HOME/local/share/lmodfiles/git and create a module file within that directory named
To make this module usable, you need to tell lmod where to look for it. You can do this by issuing the command
module use $HOME/local/share/lmodfiles in our example. You can see this change by performing
module avail. This will allow you to load your software using either
module load git or
module load git/2.9.0.
module use$HOME/local/share/lmodfiles and module load "software_name" needs to be entered into the command line every time you enter a new session on the system.
If you install another version later on (lets say version 2.9.1) and want to created a module file for it, you need to make sure you call it
2.9.1.lua. When loading Git, lmod will automatically load the newer version. If you need to go back to an older version, you can do so by specifying the version you want:
module load git/2.9.0.
To make sure you have the correct module file loaded, type
which git which should give the output "~/local/git/2.9.0/bin/git" (NOTE: ~ is equivalent to $HOME).
To make sure the software was installed correctly and that the module is working, type git --version which shuold give the output "git version 2.9.0".
For more information about modules, be sure to read the webpage indicated at the end of
module help. If you have any questions about modules or local installations, feel free to contact the OSC Help Desk and email@example.com.