Environment Modules Deployment Guide#

The following instructions are for deploying Environment Modules on the Slurm, User, and Compute nodes. Environment Modules are TCL based application for configuring and setting environment variables for applications that users will execute during their sessions.

http://modules.sourceforge.net/

Prerequisites#

This guide is written for a Red Hat Enterprise Linux 8 based operating system which is operating within a cluster of systems and the following are the prerequisites:

References#

These instructions were written for Environment Modules 4.5.2 which is available in the baseos repository.

Deployment Scripts#

Note

An example bash script of the instructions has been provided: deploy-env-modules.sh

Deployment Steps#

Note

Instructions assume execution using the root account.

  1. Install user packages:

dnf -y install environment-modules
  1. Create Environment Modules directory:

Warning

The /app/ path must have been previously configured as an NFS mount. See: NFS Client Deployment Guide

mkdir -p /app/modulefiles/
  1. Add/Remove Environment Modules directories

# Create a backup of the configuration files
cp /etc/environment-modules/initrc /etc/environment-modules/initrc.bak
cp /etc/environment-modules/modulespath /etc/environment-modules/modulespath.bak

# Disable default locations in initrc
sed -i 's|^module use|# module use|g' /etc/environment-modules/initrc

# Enable new NFS based location in initrc
cat >> /etc/environment-modules/initrc <<EOF
module use --append {/app/modulefiles}
EOF

# Disable default locations in modulespath
sed -i \
    's|^/usr/share/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles|# /usr/share/Modules/modulefiles:/etc/modulefiles:/usr/share/modulefiles|g' \
    /etc/environment-modules/modulespath

# Enable new NFS based location in modulespath
cat >> /etc/environment-modules/modulespath <<EOF
/app/modulefiles
EOF

Note

The Environment Modules commands will be available after logging-out and back in.