How To Install Singularity On Linux

For full instructions on installation, including building RPMs, please check the installation section of the admin guide.

Install system dependencies

You must first install development tools and libraries to your host.

On Debian-based systems:

sudo apt-get update && \
sudo apt-get install -y build-essential \
libseccomp-dev pkg-config squashfs-tools cryptsetup


sudo yum groupinstall -y 'Development Tools' && \
sudo yum install -y epel-release && \
sudo yum install -y golang libseccomp-devel \
squashfs-tools cryptsetup

Install Golang

This is one of several ways to install and configure golang.

The CentOS/RHEL instructions above are already installed it so this method is not needed there.

First, download the Golang archive to /tmp, then extract the archive to /usr/local.

export VERSION=1.16.4 OS=linux ARCH=amd64

wget -O /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz${VERSION}.${OS}-${ARCH}.tar.gz && \
sudo tar -C /usr/local -xzf /tmp/go${VERSION}.${OS}-${ARCH}.tar.gz

Finally, set up your environment for Go:

echo 'export GOPATH=${HOME}/go' >> ~/.bashrc && \
echo 'export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin' >> ~/.bashrc && \
source ~/.bashrc

Install golangci-lint

curl -sSfL | sh -s -- -b $(go env GOPATH)/bin

Clone the repo

Golang is a bit finicky about where things are placed. Here is the correct way to build Singularity from source:

mkdir -p ${GOPATH}/src/ && \
cd ${GOPATH}/src/ && \
git clone && \
cd singularity

Compiling SingularityCE

You can build SingularityCE using the following commands:

cd ${GOPATH}/src/ && \
./mconfig && \
cd ./builddir && \
make && \
sudo make install

And that’s it! Now you can check your SingularityCE version by running:

singularity version