Environment modules are useful to prepare the environment to compile and run your applications. Take a look at the official website:
http://modules.sourceforge.net/
You can use the yum repository to install as follow
yum install environment-modules.x86_64
Or download the C release (as a gz package). Then uncompress it and install it on /opt:
./configure --prefix=/opt
Finally run make and make install:
make
make install
Now you have Envinroment modules installed on your machine, on version 3.2.10 (november 2013). Take a look at the installed directories:
ls /opt/Modules/3.2.10
Look for the profile script. It should be in /etc/profile.d/modules.sh
cat /etc/profile.d/modules.sh
If 'modules.sh' does not exist creat it with the folowing
nano /etc/profile.d/modules.sh
#### BELLOW SHOULD BE ADDED TO THE FILE YOU CREATED ON TOP ####
trap "" 1 2 3
MID=/opt/Modules/3.2.10/init/
case "$0" in
-bash|bash|*/bash) test -f $MID/bash && . $MID/bash ;;
-ksh|ksh|*/ksh) test -f $MID/ksh && . $MID/ksh ;;
-sh|sh|*/sh) test -f $MID/sh && . $MID/sh ;;
*) test -f $MID/sh && . $MID/sh ;; # default for scripts
esac
trap - 1 2 3
You may want to create your first module. Look at the examples and try to modify one of them to create your first module:
ls /opt/Modules/3.2.10/modulefiles/
Once you created your module, you have to specify where the module commands must look for you module files. So add the above directory to the hidden file .modulepath under /opt/Modules/3.2.10/init:
vi /opt/Modules/3.2.10/init/.modulespath
Once you created your module, exit and enter the shell again. Then, type module avail to see if the module is correctly loaded:
module avail
Finally, try to load the module:
module load
Some usefull module configuration