How to install environment-modules Lmod on Ubuntu Server Latest

Introduction

Environment-modules is a software package that provides a convenient way to dynamically manage the user environment on various Unix-based systems such as Linux and macOS. Lmod, which stands for Lua-based Modules, is an enhanced version of the original environment-modules package that provides additional features and improves performance. In this tutorial, we'll walk you through the steps of installing Lmod on Ubuntu Server.

Prerequisites

Before we begin, make sure you have the following prerequisites on your Ubuntu Server:

Step 1: Update the system

First, log in to your Ubuntu Server using your non-root sudo user account. Then, update the system's package lists and upgrade the installed packages to their latest versions using the following commands:

sudo apt update
sudo apt upgrade

Step 2: Install necessary packages

Next, install the necessary packages to build and install Lmod by running the following command:

sudo apt install lua5.3 lua-filesystem lua-posix lua-bit32 lua-json

Once the installation is complete, check the version of Lua installed by running the following command:

lua5.3 -v

You should see output similar to the following:

Lua 5.3.3  Copyright (C) 1994-2017 Lua.org, PUC-Rio

Step 3: Download and extract Lmod

Now, download the latest version of Lmod from the TACC website using the following command:

wget https://github.com/TACC/Lmod/archive/refs/tags/v8.5.tar.gz

Once the download is complete, extract the source code from the archive by running the following command:

tar xzf v8.5.tar.gz

This command will create a new directory named Lmod-8.5 containing the Lmod source code.

Step 4: Build and install Lmod

Change into the Lmod directory by running the following command:

cd Lmod-8.5

Then, build and install Lmod using the following commands:

./configure --prefix=/opt/apps --with-spiderCacheDir=/tmp
make
sudo make install

This will configure Lmod to install into the /opt/apps directory and set the spider cache directory to /tmp.

Step 5: Configure Lmod

After installation, we need to make some configuration changes to Lmod. First, add the following line to the end of the /etc/profile.d/Z99-modules.sh file to load Lmod automatically when a user logs in:

source /opt/apps/lmod/lmod/init/bash

Next, create the /opt/apps/modulefiles directory by running the following command:

sudo mkdir -p /opt/apps/modulefiles

Then, set the MODULEPATH environment variable to include the /opt/apps/modulefiles directory by adding the following line to the end of the /etc/environment file:

MODULEPATH=/opt/apps/modulefiles

Finally, apply the changes to the system by running the following command:

sudo update-env

Step 6: Verify the installation

To verify that Lmod is correctly installed and configured, log out of your current session and log back in as the same user, or open a new terminal session. Then, run the following command to check that Lmod is running:

module --version

You should see output similar to the following:

Modules Release 8.5.13 (2021-06-03)

Congratulations, you have successfully installed environment-modules Lmod on Ubuntu Server Latest!

Conclusion

In this tutorial, we walked you through the steps of installing Lmod on Ubuntu Server Latest. You should now be able to use Lmod to dynamically manage the user environment on your Unix-based system.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!