R's Workshop

Install Singularity on Ubuntu 24.04

Install Dependencies

sudo apt-get update

sudo apt-get install -y \
    autoconf \
    automake \
    cryptsetup \
    fuse2fs \
    git \
    fuse3 \
    libfuse3-dev \
    libseccomp-dev \
    libtool \
    pkg-config \
    runc \
    squashfs-tools \
    squashfs-tools-ng \
    uidmap \
    wget \
    zlib1g-dev \
    libsubid-dev

Download Debian Package

Download .deb package latest release from Singularity release page, then install

sudo dpkg -i singularity-ce_4.3.7-noble_amd64.deb

Start Container with Bash

Execute bash and load bashrc

SINGULARITY_SHELL=/bin/bash singularity run [IMAGE]

To overwrite shell prompt

SINGULARITY_SHELL=/bin/bash singularity run --env PS1="\[\e[94;1m\]\u@\h-singularity:\[\e[34m\w\e[0m\]\$ " [IMAGE]

Save bash history in another file to avoid origin bash history file from being removed

SINGULARITY_SHELL=/bin/bash singularity run \
	--env HISTFILE=/${HOME}/.sin_bash_history \
	--env PS1="\[\e[94;1m\]\u@\h-singularity:\[\e[34m\w\e[0m\]\$ " \
	[IMAGE]

Resolve Conflict with Docker

If the server has installed docker-ce, install runc will autoly remove containerd.io and docker-ce. This is because there is a runc binary in the containerd package.

We can check which version’s runc is newer

runc --version

Generally, containerd.io does provide a latest version can cover the requirement of singularity. Hence, install containerd.io and docker-ce back.

sudo apt install containerd.io docker-ce

Reference

Singularity