Introduction to Linux Container with Singularity

Introduction to Linux Containers with Singularity Part 1 (2020-03-10)
Introduction to Linux Containers with Singularity Part 2 (2020-03-11)

References

  1. https://github.com/NIH-HPC/Singularity-Tutorial

Compiling Singularity-CE-3.9.2 on CentOS-7

The Official Documentation can be found at https://sylabs.io/guides/3.0/user-guide/installation.html

Prerequisites 1 – Yum

If you are using CentOS, you may want to put the necessary libraries and dependencies in first.

yum install -y && \
yum groupinstall -y 'Development Tools' && \
yum install -y \
openssl-devel \
libuuid-devel \
libseccomp-devel \
wget \
squashfs-tools

Prerequisites 2 – Go

Go to the Download Page https://go.dev/dl/ to download the Linux Version.

Extract the archive you downloaded into /usr/local, creating a Go tree in /usr/local/go.

This step below will remove a previous installation at /usr/local/go, if any, prior to extracting. Please back up any data before proceeding.

% rm -rf /usr/local/go && tar -C /usr/local -xzf go1.17.5.linux-amd64.tar.gz

Add /usr/local/go/bin to the PATH environment variable. You can do this by adding the following line to your $HOME/.profile or /etc/profile (for a system-wide installation):

export PATH=$PATH:/usr/local/go/bin

Verify the Installation with the command

% go version

Compiling Singularity

To download Singularity, do visit the download site. Singularity uses a build system called makeit. mconfig is called to generate Makefile and them make is used to compile and install

% cd singularity
% ./mconfig
 --prefix=/usr/local/singularity-ce-3.9.2
% cd build
% make
% make install

Source bash-completion file

To enjoy bash completion with Singularity commands and options, source the bash-completion file. you need to source the appropriate file and add it to the bash-completion directory in /etc so that it will be sourced automatically when you start another shell.

% . /usr/local/singularity-ce-3.9.2/etc/bash_completion.d/singularity
% cp /usr/local/singularity-ce-3.9.2/etc/bash_completion.d/singularity /etc/bash_completion.d/

Testing

As long as you see a cow your installation is working properly…….

singularity run library://godlovedc/funny/lolcow
/ Q: What is the difference between a \
\ duck? A: One leg is both the same.  /
 -------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

References

  1. https://sylabs.io/guides/3.0/user-guide/installation.html
  2. https://github.com/NIH-HPC/Singularity-Tutorial