Tutorials  /  Ubuntu

Install Spack on Ubuntu 20.04 – Step-by-Step Guide

Ccentron Redaktion · November 2025 ·3 min read ·Ubuntu, Tutorial

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.
VM

Matching infrastructure at centron

Ubuntu servers without your own hardware: ccloud³ VMs with full root access from €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →

1. Install Dependencies

First, install the build-essential package:

Console
$ sudo apt install build-essential

2. Clone the Spack Repository

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

Console
$ 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:

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

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

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

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

Console
$ source ~/.bash_profile

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:

Console
$ 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:

Console
$ 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:

Console
$ spack install pngwriter
$ spack load pngwriter

More Resources

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

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Ubuntu
Teilen
Noch offene Fragen?

Our team will help you with your specific setup - in German or English, by people who run the platform themselves.

War dieses Tutorial hilfreich?

Your answer is stored anonymously and helps us improve our tutorials.

Kommentare

No comments yet - be the first to ask a question about this tutorial.

Sign in to comment

Comments are open to centron customers. Sign in to your account to ask a question about this tutorial.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren