TNS
VOXPOP
AI-Aided Coding
On average, how much time do you think you save per week by an AI-powered coding assistant such as GitHub Copilot or JetBrains AI Assistant?
I don’t use an AI coding assistant.
0%
Up to 1 hour/week
0%
1-3 hours
0%
3-5 hours
0%
5-8 hours
0%
More than 8 hours
0%
I don’t save any time, yet!
0%
Containers / Kubernetes

What Is Apptainer and How Do You Install It on Ubuntu Server?

The Apptainer container deployment system executes apps with bare-metal performance while offering security, portability, and reproducibility. 
Sep 30th, 2022 4:00am by
Featued image for: What Is Apptainer and How Do You Install It on Ubuntu Server?

The Apptainer/Singularity package has become one of the most widely-used container deployment systems for High-Performance Computing (HPC). This container system is designed to execute applications with bare-metal performance while retaining a high level of security, portability, and reproducibility.

Apptainer is an open source project with a growing community and ever-expanding user base. The feature set looks something like this:

  • Supports public/private key signing for trust.
  • Compatibility with Docker and the Open Containers Initiative.
  • Encryption.
  • Portability.
  • Containers run rootless to prohibit privilege escalation.
  • Leverages GPUs, FPGAs, high-speed networks, and filesystems.
  • Easy to use.
  • Commerical support available.

Although Apptainer isn’t nearly as easy to install as, say, Docker, if you’re looking for higher security in your containers, this might just be the deployment system you’re looking for.

But just how is it installed? That’s what I want to show you now.

Requirements

Apptainer can be installed on both RHEL and Ubuntu-based Linux distributions. I’ll demonstrate with my go-to server, Ubuntu Server 22.04, so you’ll need a running instance of that OS and a user with sudo privileges. That’s it… let’s get this party started.

Installing the Necessary Dependencies

The first thing to be done is the installation of the necessary dependencies. Log in to your Ubuntu instance and issue the command:


For those of you who might be new to Linux, the above is a single command broken into steps using the \ character. The single-line version of that command looks like this:


Do note, if you are using a RHEL-based distribution, the installation of the dependencies is a bit more complicated. First, you must install the Development Tools with:


Next, add the EPEL repository:


Finally, you can install the dependencies with:


Next, we must install Go. First, set the version and the architecture with:


Download the necessary file with:


Unpack and move the downloaded file with:


Add the Go executable to your user’s PATH with the following two commands:


We now need to install the golangcli-lint tool with:


Add this to your PATH with:

Clone the Apptainer Repo and Install

With the dependencies out of the way, we can now clone the Apptainer repository and install the software.

Clone the repository with:


Change into the newly created directory with:


Check out the latest version with:


Make sure to check out the releases page to ensure you’re using the latest version.

Run the configuration script with the command:


Change into the build directory:


Compile Apptainer with the following command:


The above command will take considerable time to complete (upwards of 10 minutes). At some point, you may think it has stalled. Don’t panic! Keep your fingers away from the [Ctrl]+[C] keyboard shortcut and allow the installation to complete.

Once the make command completes, install Apptainer with:


When the install process finishes, you can verify everything went as planned by viewing the Apptainer version with the command:


You should see something like the following in the output:


Outstanding. Apptainer is installed and ready for action.

How to Deploy a Container with Apptainer

Let’s now deploy the always fun Hello World container with Apptainer. To do this, we’ll pull down the hello-world app from the Singularity hub with the command:


You should then see a new file in that directory, named:


To run the app, issue the command:


The app will then print out:


You could also run the container with:


Let’s say you want to use Ubuntu 20.04 as a container. You could pull it with:


Once it’s pulled you can run a command from within the container with something like this:


You should see the following in the output:


And that’s all how you get started with the Apptainer container deployment system. This is a great option for any container admin looking to get a bit more security from their deployments.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Docker.
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.