Modules in CentOS 7

Our CentOS 7 environment will continue to use the environment module system which we had in RHEL6.  The module system allows one to easily prepare a shell environment to use a specific program which may require the setting of environmental variables in order to function properly.

If you source the CIMS default shell rc file in your shell rc file, you will end up with an environment variable called MODULEPATH, which will include /usr/local/etc/modulefiles.  This is where we store our module files.  A module file can be viewed as any text file to see what it does exactly.

For example, we offer a newer version of gcc than what comes with CentOS 7: gcc version 4.9.2.  In order to successfully use this version of gcc, some environmental variables such as LD_LIBRARY_PATH and INCLUDE_PATH must be modified to look at gcc 4.9.2's files.  One could modify these variables manually, write a script to set them, or simply loading the module will do the trick:

user123@box999[~]$ which gcc
/usr/bin/gcc
user123@box999[~]$ echo $LD_LIBRARY_PATH

user123@box999[~]$ echo $INCLUDE_PATH

user123@box999[~]$ module load gcc-4.9
user123@box999[~]$ which gcc
/usr/local/stow/gcc-4.9.2/bin/gcc
user123@box999[~]$ echo $LD_LIBRARY_PATH
/usr/local/stow/gcc-4.9.2/lib64
user123@box999[~]$ echo $INCLUDE_PATH
/usr/local/stow/gcc-4.9.2/include


Command Effect
module avail List all available modules.  Will not work if environment variable MODULEPATH does not include /usr/local/etc/modulefiles
module load module_name Load a specific module
module unload module_name Unload a specific module
echo $LOADEDMODULES List modules which you currently have loaded