Install Spack on Ubuntu 20.04

Spack is a flexible package manager designed for installing scientific software such as the Multidisciplinary Design Adaptation and Sensitivity Toolkit (MAST) or PNGwriter. This tutorial explains how to install Spack on an Ubuntu 20.04 cloud instance.

Prerequisites

  • Deploy an Ubuntu 20.04 cloud server instance.
  • Create a sudo-enabled user account.
  • Update the Ubuntu server.

1. Install Dependencies

First, install the build-essential package:

$ sudo apt install build-essential

2. Clone the Spack Repository

Clone the Spack repository into the ~/.spack/Spack directory or any other preferred location:

$ git clone https://github.com/spack/spack ~/.spack/Spack

3. Add Shell Support

To make Spack available in all shell sessions, add it to your PATH environment variable:

$ . ~/.spack/Spack/share/spack/setup-env.sh

To automatically enable Spack on every login, append the command to your ~/.bash_profile file:

$ echo '. ~/.spack/Spack/share/spack/setup-env.sh' >> ~/.bash_profile

Apply the changes by running the following command or logging out and back in:

4. Clear the Environment

Since Spack compiles and installs packages directly from source, a clean environment is recommended. Verify that your PATH contains only the necessary directories:

$ echo $PATH
/home/cus/.spack/Spack/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

5. Test the Spack Installation

Check whether Spack was installed correctly by verifying its version:

$ spack -V
0.16.0-359-860825ee1

Next Steps

After setting up Spack, you can install a wide range of powerful scientific software packages. For example, to install and load PNGwriter, run the following commands:

$ spack install pngwriter
$ spack load pngwriter

More Resources

For additional details and documentation, visit the official Spack website: Spack Official Site

Source: vultr.com

Create a Free Account

Register now and get access to our Cloud Services.

Posts you might be interested in: