Linux Commands and Scripts

How to Setup Spack on Ubuntu 20.04

In this article, we’ll explain how to setup Spack on Ubuntu 20.04.

Spack is a package management tool designed to support multiple versions and configurations of software on a wide variety of platforms and environments. We can install scientific packages such as 3proxy or PNGwriter.

Prerequisites

Let’s get started with the installation process.

Step 1 – Keep the server up to date

# apt update -y

Step 2 – Install the build-essential

# apt install build-essential

Step 3 – Clone Spack repository

Get spack from the github repository, store into your choice directory. Here we’re using ~/.spack/Spack and install your first package:

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

Step 4 – Shell support

Once you have cloned Spack, its recommend sourcing the appropriate script for the shell:

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

To use the spack command every login, append that command to ~/.bash_profile:

# echo ‘. ~/.spack/Spack/share/spack/setup-env.sh’ >> ~/.bash_profile

Then run source ~/.bash_profile to make changes take effect.

Step 5 – Clear Environment

Make sure your PATH only has the things you need.

# echo $PATH

Step 6 – Verify the installation

spack -V

Output:

0.16.0-1004-258bfff1da

That’s it. The installation has been completed successfully.

You can install lots of powerful scientific packages via Spack, such as 3proxy:

# spack install 3proxy

# spack load 3proxy

In this article, we’ve seen how to to setup Spack on Ubuntu 20.04.

Related Articles