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.


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 ~/.spack/Spack

Step 4 – Shell support

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

. ~/.spack/Spack/share/spack/

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

# echo ‘. ~/.spack/Spack/share/spack/’ >> ~/.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



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