Environment Module

From Leo's Notes
Revision as of 01:11, 28 January 2021 by Leo (talk | contribs) (creating modulefiles)
This page was last edited on 28 January 2021, at 01:11.

Environment modules provides a reversible way to alter a user's environment to make software packages available.

Cheat Sheet

Action Command
Load a module module load gcc/6.1.1
Unload a module module unload gcc
Show what's available module avail
List what's loaded module list

Creating a module

Create a shared location for your modules so that other users can make use of it. For example /share/modulefiles. Append this path to your module by running:

module use --append /share/modulefiles

Create a modulefile

A modulefile defines what paths should be set when loaded. Below is a simple skeleton modulefile:

#%Module
set vers 1.4.1103
global version

proc ModulesHelp { } {
    puts stderr "\tThis module loads something.\n"
}

module-whatis "loads something to your environment."

# Base directory of your software
set rootdir "/software/modules/software/rstudio-1"

# Prepend to paths
prepend-path PATH "${rootdir}/usr/lib/rstudio/bin"
prepend-path LD_LIBRARY_PATH "${rootdir}/usr/lib/rstudio/lib"
# prepend-path MANPATH /path/to/manpages

See Also