失败人士的Singularity安装失败经历

官网上便有一些过时的失败教程

1
2
3
4
5
6
$ git clone https://github.com/singularityware/singularity.git
$ cd singularity
$ ./autogen.sh
$ ./configure --prefix=/usr/local --sysconfdir=/etc
$ make
$ sudo make install

如果满足于安装旧版本,能成功

1
2
3
4
5
6
7
VERSION=2.5.2
wget https://github.com/singularityware/singularity/releases/download/$VERSION/singularity-$VERSION.tar.gz
tar xvf singularity-$VERSION.tar.gz
cd singularity-$VERSION
./configure --prefix=/usr/local
make
sudo make install

测试

1
2
3
4
$ singularity
Increasing verbosity level (2)
Singularity version: 2.5.2-dist
USAGE: singularity [global options...] <command> [command options...] ...

但用着用着发现2.5.2这个版本太低了,有些bug

开启万能卸载重安装大法

1
sudo apt-get autoremove singularity

移除旧版本

https://singularity.lbl.gov/docs-installation#remove-an-old-version

之前将Singularity安装在/usr/local,需要移除它们

1
2
3
4
5
6
7
8
9
sudo rm -rf /usr/local/libexec/singularity
sudo rm -rf /usr/local/etc/singularity
sudo rm -rf /usr/local/include/singularity
sudo rm -rf /usr/local/lib/singularity
sudo rm -rf /usr/local/var/lib/singularity/
sudo rm /usr/local/bin/singularity
sudo rm /usr/local/bin/run-singularity
sudo rm /usr/local/etc/bash_completion.d/singularity
sudo rm /usr/local/man/man1/singularity.1

如果对系统配置目录做过修改,移除singularity.conf文件

1
$ ls /etc/*.conf

发现我没有配置过这个文件,那就不管了

如果只是将singularity安装在一个平常的文件目录下,移除那个文件目录即可(真不错,可惜我属于前一种情况)。比如--prefix=/some/temp/dir,则

1
$ sudo rm -rf /some/temp/dir

新版本

原来v3的安装教程在这里 https://sylabs.io/guides/3.6/admin-guide/installation.html#installation-on-linux

安装dependency

1
2
3
4
5
6
7
8
9
10
$ 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 v3主要是用Go编写的,需要安装Go 1.13或更高版本才能从源代码进行编译。

下载解压到/usr/local

1
2
3
4
$ export VERSION=1.13.5 OS=linux ARCH=amd64 && \
wget https://dl.google.com/go/go$VERSION.$OS-$ARCH.tar.gz && \
sudo tar -C /usr/local -xzvf go$VERSION.$OS-$ARCH.tar.gz && \
rm go$VERSION.$OS-$ARCH.tar.gz

设置Go环境变量

1
2
$ echo 'export PATH=/usr/local/go/bin:${PATH}' >> ~/.bashrc && \
source ~/.bashrc

源代码安装

1
2
3
4
export VERSION=3.6.3 && # 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
1
2
3
$ ./mconfig && \
make -C ./builddir && \
sudo make -C ./builddir install

版本>=3.6.4也可用git checkout安装

然而,真是可恶,GO被墙了,而且由于GO DEP不走proxy,可恶……

https://github.com/goproxy/goproxy.cn/issues/29

反正服务器上有,不弄了,哼!