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/go-fuzz-headers@v0.0.0-20210319161527-f761c2329661: 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 <command> [<subcommand>]
  $ singularity help build
  $ singularity help instance start


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

成功

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1. 分布式系统核心问题 参考书籍:《区块链原理、设计与应用》 一致性问题例子:两个不同的电影院买同一种电影票,如...
    molscar阅读 935评论 0 0
  • 申金鑫 17101223365 转载自公众号flysnow_org 【嵌牛导读】:本文介绍了各种系统下的Go语言环...
    Felixxin阅读 3,403评论 0 20
  • 一、简介 Go(又称Golang)是Google开发的一种静态强类型、编译型、并发型,并具有垃圾回收功能的编程语言...
    Mr_Michael阅读 516评论 0 0
  • 欢迎扫码关注公众号flysnow_org,第一时间看后续文章。觉得有帮助的话,顺手分享到朋友圈吧,感谢支持。 前段...
    飞雪无情flysnow_org阅读 33,233评论 4 45
  • 目标 检查操作系统 检查并安装所需工具 可选安装Node及npm 任务实现 1.2.1 操作系统 学习,必须要有一...
    Terry_007阅读 483评论 0 0