How to Install Singularity on Linux in EO-Lab FRA1-1 Cloud
Singularity is an open-source application to create and run software containers on shared Linux-based computing clusters. Singularity environments act the same regardless of the hardware platform they run on, which paves the way for high-performance computing.
Singularity is written in Go so you have to install Go first.
What We Are Going To Cover
Install Singularity on Debian-based systems
Install Singularity on CentOS/RHEL systems
Set up the Go environment
Install Golangci-lint
Build Singularity from source
Compile SingularityCE, the Community Edition of Singularity
Prerequisites
No. 1 Account
You need a EO-Lab hosting account with access to the Horizon interface: https://tenant-manager.eo-lab.org/login .
No. 2 Access to Ubuntu or CentOS Linux
To install and run Singularity, use an existing Linux instance or launch a new one as described in
How to create a Linux VM and access it from Linux command line on EO-Lab
How to create a Linux VM and access it from Windows desktop on EO-Lab
This article was written for virtual machines using Ubuntu 20.04 and CentOS 7.
Install Singularity on Debian-based systems
Install development tools and libraries to your host.
sudo apt-get update && \
sudo apt-get install -y build-essential \
libseccomp-dev libglib2.0-dev pkg-config squashfs-tools cryptsetup
Download the Golang archive to /tmp, then extract the archive to /usr/local.
export VERSION=1.20.1 OS=linux ARCH=amd64
wget -O /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz https://dl.google.com/go/go${VERSION}.${OS}-${ARCH}.tar.gz && \
sudo tar -C /usr/local -xzf /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz
Install Singularity on CentOS/RHEL systems
Install both the libraries needed and the Go language:
sudo yum groupinstall -y 'Development Tools' && \
sudo yum install -y epel-release && \
sudo yum install -y golang libseccomp-devel \
glib2-devel squashfs-tools cryptsetup
Set up your environment for Go
This step is for both types of Linux distros:
echo 'export GOPATH=${HOME}/go' >> ~/.bashrc && \
echo 'export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin' >> ~/.bashrc && \
source ~/.bashrc
Install Golangci-lint
Linting is a way to catch common mistakes in a programming language. Golangci-lint bundles common linters into a single binary for the Go language. Here is how to install it:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
Build Singularity
The following commands will build Singularity from source:
mkdir -p ${GOPATH}/src/github.com/sylabs && \
cd ${GOPATH}/src/github.com/sylabs && \
git clone --recursive https://github.com/sylabs/singularity.git && \
cd singularity
Compile SingularityCE
Build SingularityCE with the following commands:
cd ${GOPATH}/src/github.com/sylabs/singularity && \
./mconfig && \
cd ./builddir && \
make && \
sudo make install
Check SingularityCE version by running:
singularity version
Test the installation:
singularity run library://godlovedc/funny/lolcow
You should see something like this:
INFO: Downloading library image
_______________________________________
/ Excellent day for putting Slinkies on \
\ an escalator. /
---------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
What To Do Next
To extensively use Singularity, you might need to learn how to use Docker too: