Skip to content

Latest commit

 

History

History
318 lines (242 loc) · 8.46 KB

INSTALL.md

File metadata and controls

318 lines (242 loc) · 8.46 KB

Installing SingularityCE

Since you are reading this from the SingularityCE source code, it will be assumed that you are building/compiling from source.

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.

Debian / Ubuntu

# Ensure repositories are up-to-date
sudo apt-get update
# Install debian packages for dependencies
sudo apt-get install -y \
    autoconf \
    automake \
    cryptsetup \
    git \
    libfuse-dev \
    libglib2.0-dev \
    libseccomp-dev \
    libtool \
    pkg-config \
    runc \
    squashfs-tools \
    squashfs-tools-ng \
    uidmap \
    wget \
    zlib1g-dev

RHEL / Alma Linux / Rocky Linux 8+ and Fedora

# Install basic tools for compiling
sudo yum groupinstall -y 'Development Tools'
# Install RPM packages for dependencies
sudo yum install -y \
    autoconf \
    automake \
    crun \
    cryptsetup \
    fuse3-devel \
    git \
    glib2-devel \
    libseccomp-devel \
    libtool \
    squashfs-tools \
    wget \
    zlib-devel

RHEL / CentOS 7

# Install basic tools for compiling
sudo yum groupinstall -y 'Development Tools'
# Install RPM packages for dependencies
sudo yum install -y \
    autoconf \
    automake \
    cryptsetup \
    fuse3-devel \
    git \
    glib2-devel \
    libseccomp-devel \
    libtool \
    runc \
    squashfs-tools \
    wget \
    zlib-devel

SLES / openSUSE Leap

sudo zypper in \
    autoconf \
    automake \
    cryptsetup \
    fuse3-devel \
    gcc \
    gcc-c++ \
    git \
    glib2-devel \
    libseccomp-devel \
    libtool \
    make \
    pkg-config \
    runc \
    squashfs \
    wget \
    zlib-devel

Install sqfstar / tar2sqfs for OCI-mode

If you intend to use the --oci execution mode of SingularityCE, your system must provide either:

  • squashfs-tools / squashfs >= 4.5, which provides the sqfstar utility. Older versions packaged by many distributions do not include sqfstar.
  • squashfs-tools-ng, which provides the tar2sqfs utility. This is not packaged by all distributions.

Debian / Ubuntu

On Debian/Ubuntu squashfs-tools-ng is available in the distribution repositories. It has been included in the "Install system dependencies" step above. No further action is necessary.

Fedora

On Fedora, the squashfs-tools package includes sqfstar. No further action is necessary.

RHEL / Alma Linux / Rocky Linux / CentOS

On RHEL and derivatives a COPR is available at:

https://copr.fedorainfracloud.org/coprs/dctrud/squashfs-tools-ng/

This provides squashfs-tools-ng, which will not replace any standard EL or EPEL packages. To use it:

EL 8 / 9

sudo dnf install dnf-plugins-core
sudo dnf copr enable dctrud/squashfs-tools-ng 
sudo dnf install squashfs-tools-ng

EL 7

sudo yum install yum-plugin-copr 
sudo yum copr enable dctrud/squashfs-tools-ng 
sudo yum install squashfs-tools-ng

SLES / openSUSE Leap

On SLES/openSUSE, follow the instructions at the filesystems project to obtain an more recent squashfs package that provides sqfstar.

Install Go

Singularity is written in Go, and may require a newer version of Go than is available in the repositories of your distribution. We recommend installing the latest version of Go from the official binaries.

First, download the Go tar.gz archive to /tmp, then extract the archive to /usr/local.

NOTE: if you are updating Go from a older version, make sure you remove /usr/local/go before reinstalling it.

export VERSION=1.21.4 OS=linux ARCH=amd64  # change this as you need

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

Finally, add /usr/local/go/bin to the PATH environment variable:

echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc

Install golangci-lint

If you will be making changes to the source code, and submitting PRs, you should install golangci-lint, which is the linting tool used in the SingularityCE project to ensure code consistency.

Every pull request must pass the golangci-lint checks, and these will be run automatically before attempting to merge the code. If you are modifying Singularity and contributing your changes to the repository, it's faster to run these checks locally before uploading your pull request.

In order to download and install the latest version of golangci-lint, you can run:

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin

Add $(go env GOPATH) to the PATH environment variable:

echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc
source ~/.bashrc

Clone the repo

With the adoption of Go modules you no longer need to clone the SingularityCE repository to a specific location.

Clone the repository with git in a location of your choice:

git clone --recurse-submodules https://github.com/sylabs/singularity.git
cd singularity

By default your clone will be on the main branch which is where development of SingularityCE happens. To build a specific version of SingularityCE, check out a release tag before compiling. E.g. to build the 4.0.2 release, checkout the v4.0.2 tag:

git checkout --recurse-submodules v4.0.2

Compiling SingularityCE

You can configure, build, and install SingularityCE using the following commands:

./mconfig
make -C builddir
sudo make -C builddir install

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

singularity --version

The mconfig command accepts options that can modify the build and installation of SingularityCE. For example, to build in a different folder and to set the install prefix to a different path:

./mconfig -b ./buildtree -p /usr/local

See the output of ./mconfig -h for available options.

Building & Installing from an RPM

On a RHEL / CentOS / Fedora machine you can build a SingularityCE into an RPM package, and install it from the RPM. This is useful if you need to install Singularity across multiple machines, or wish to manage all software via yum/dnf.

To build the RPM, you first need to install the system dependencies and Go toolchain as shown above. The RPM spec does not declare Go as a build dependency, as SingularityCE may require a newer version of Go than is available in distribution / EPEL repositories. Go should be installed manually, so that the go executable is on $PATH in the build environment.

Download the latest release tarball and use it to build and install the RPM like this:

export VERSION=4.0.2  # this is the singularity version, change as you need

# Fetch the source
wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-ce-${VERSION}.tar.gz
# Build the rpm from the source tar.gz
rpmbuild -tb singularity-ce-${VERSION}.tar.gz
# Install SingularityCE using the resulting rpm
sudo rpm -ivh ~/rpmbuild/RPMS/x86_64/singularity-ce-${VERSION}-1.el7.x86_64.rpm
# (Optionally) Remove the build tree and source to save space
rm -rf ~/rpmbuild singularity-ce-${VERSION}*.tar.gz

Alternatively, to build an RPM from the latest main you can clone the repo as detailed above. Then use the rpm make target to build SingularityCE as an rpm package:

./mconfig
make -C builddir rpm
sudo rpm -ivh ~/rpmbuild/RPMS/x86_64/singularity-ce-${VERSION}*.x86_64.rpm

By default, the rpm will be built so that SingularityCE is installed under /usr/local.

To build an rpm with an alternative install prefix set RPMPREFIX on the make step, for example:

make -C builddir rpm RPMPREFIX=/opt/singularity-ce

For more information on installing/updating/uninstalling the RPM, check out our admin docs.