Step 1: List package groups on a CentOS / RHEL 8
Type the following dnf command to list package groups available on your CentOS / RHEL 8.
$ dnf group list
Step 2: The following command is used to install GCC and Development Tools on a CentOS
sudo dnf group install "Development Tools"
Check the installed versions
$ gcc --version
$ make --version
Step 3: Install module environment
Download then unpack the last release of Modules:
$ curl -LJO https://github.com/cea-hpc/modules/releases/download/v4.7.1/modules-4.7.1.tar.gz
$ tar xfz modules-4.7.1.tar.gz
The simplest way to build and install Modules is:
$ ./configure --prefix=/usr/local/apps --modulefilesdir=/apps/Modules/modulefiles (You may change these setup but need to be consistent for the rest of installation packages)
If you received an error of "Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh " Or "error you need Django", you probably did not install the tcl-devel. Please yum install tcl-devel
$ make
$ sudo make install
Step 4: Install packages as new modules
Step 4.1: OpenMPI
curl -LJO https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.0.tar.gz
tar xfz openmpi-4.1.0.tar.gz
Applications should be installed in /usr/local/apps/ within a folder specifying the name and version (i.e. for openmpi version 4.1.0 the installation directory is /usr/local/apps/openmpi-4.1.0). Read the instaltion document first but generally to build we have,
./configure --prefix=/usr/local/apps/openmpi-4.1.0
make -j 4 all
sudo make install
Make module directory to setup the module environments (up to you where you make this directory but need to be used for all the new packages under module environmrnt)
Then folder for openmpi inside a text file with the version being the name of the file.
sudo mkdir /apps/Modules/modulefiles/openmpi
sudo vim /apps/Modules/modulefiles/openmpi/4.1.0
Inside the file, you define the path and include the library path to the environment.
#%Module1.0#####################################################################
##
## openmpi-4.1.0 modulefile
##
## modulefiles/openmpi/4.1.0
##
proc ModulesHelp { } {
puts stderr "Sets the openmpi-4.1.0 environment."
}
module-whatis "Sets the openmpi-4.1.0 environment."
# for Tcl script use only
set version 4.1.0
prepend-path LD_LIBRARY_PATH /usr/local/apps/openmpi-4.1.0/lib
prepend-path LD_LIBRARY_PATH /usr/local/apps/openmpi-4.1.0/lib64
prepend-path MANPATH /usr/local/apps/openmpi-4.1.0/share/man
prepend-path PATH /usr/local/apps/openmpi-4.1.0/bin
prepend-path --delim " " CPPFLAGS -I/usr/local/apps/openmpi-4.1.0/include
prepend-path --delim " " LDFLAGS -L/usr/local/apps/openmpi-4.1.0/lib -L/usr/local/apps/openmpi-4.1.0/lib64
Step 5: Check the modules
list of all the available modules,
module avail
list the loaded module,
module list
load the module you need,
module load openmpi/4.1.0
Note: on many occasions, you may intentionally or unintentionally change the environment. Please source the sh if module load gives you an error of module command does not exist.
source /usr/local/apps/init/sh