Ubuntu singularity安装

安装环境为Ubuntu 18.04.2 LTS

系统要求

140MB硬盘空间,

安装依赖

sudo apt-get update && sudo apt-get install -y \
    build-essential \
    uuid-dev \
    libgpgme-dev \
    squashfs-tools \
    libseccomp-dev \
    wget \
    pkg-config \
    git \
    cryptsetup-bin

GO 安装

singularity使用Go编写,需要安装Go
在https://golang.org/dl/ 下载合适版本的Go至 /usr/local。singularity3.0以上的版本需要下载Go 1.13以上的版本。下载完成后:

cd /usr/local
sudo tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
export PATH=$PATH:/usr/local/go/bin
source $HOME/.profile

验证Go安装

创建hello.go文件,写一个hello world

package main
import "fmt"
func main() {
    fmt.Printf("hello, world\n")
}

编译之后运行:

$ go build hello.go
$ ./hello
hello, world

安装成功。

下载singularity

export VERSION=3.5.2 && # adjust this as necessary \
    wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-${VERSION}.tar.gz && \
    tar -xzf singularity-${VERSION}.tar.gz && \
    cd singularity

或者通过git安装

git clone https://github.com/sylabs/singularity.git && \
    cd singularity && \
    git checkout v3.5.2

编译

$ ./mconfig && \
    make -C ./builddir && \
    sudo make -C ./builddir install

$ ./mconfig --prefix=/opt/singularity

编译这一步可能会报错,类似于:

GEN GO DEP /singularity/builddir/starter.d
go: github.com/AdamKorcz/[email protected]: Get "https://proxy.golang.org/github.com/%21adam%21korcz/go-fuzz-headers/@v/v0.0.0-20210319161527-f761c2329661.mod": dial tcp 216.58.200.241:443: i/o timeout

这里是proxy.golang.org被墙了,需要把mlocal/frags/go_common_opts.mk文件里的GOPROXY :=这条设置进行修改,改成GOPROXY := https://goproxy.io,direct。如果还不行再把shell环境变量也改下export GOPROXY=https://goproxy.io,direct

验证

singularity --help:

Linux container platform optimized for High Performance Computing (HPC) and
Enterprise Performance Computing (EPC)

Usage:
  singularity [global options...]

Description:
  Singularity containers provide an application virtualization layer enabling
  mobility of compute via both application and environment portability. With
  Singularity one is capable of building a root file system that runs on any
  other Linux system where Singularity is installed.

Options:
  -d, --debug     print debugging information (highest verbosity)
  -h, --help      help for singularity
      --nocolor   print without color output (default False)
  -q, --quiet     suppress normal output
  -s, --silent    only print errors
  -v, --verbose   print additional information
      --version   version for singularity

Available Commands:
  build       Build a Singularity image
  cache       Manage the local cache
  capability  Manage Linux capabilities for users and groups
  config      Manage various singularity configuration (root user only)
  delete      Deletes requested image from the library
  exec        Run a command within a container
  help        Help about any command
  inspect     Show metadata for an image
  instance    Manage containers running as services
  key         Manage OpenPGP keys
  oci         Manage OCI containers
  plugin      Manage Singularity plugins
  pull        Pull an image from a URI
  push        Upload image to the provided URI
  remote      Manage singularity remote endpoints
  run         Run the user-defined default command within a container
  run-help    Show the user-defined help for an image
  search      Search a Container Library for images
  shell       Run a shell within a container
  sif         siftool is a program for Singularity Image Format (SIF) file manipulation
  sign        Attach a cryptographic signature to an image
  test        Run the user-defined tests within a container
  verify      Verify cryptographic signatures attached to an image
  version     Show the version for Singularity

Examples:
  $ singularity help  []
  $ singularity help build
  $ singularity help instance start


For additional help or support, please visit https://www.sylabs.io/docs/

成功

你可能感兴趣的:(Ubuntu singularity安装)