環(huán)境依賴
sudo yum update -y && \
yum groupinstall -y 'Development Tools' && \
yum install -y \
openssl-devel \
libuuid-devel \
libseccomp-devel \
wget \
squashfs-tools\
cryptsetup
golang安裝
sudo export VERSION=1.16.5 OS=linux ARCH=amd64 && \
wget https://studygolang.com/dl/golang/go$VERSION.$OS-$ARCH.tar.gz && \
tar -C /usr/local -xzvf go$VERSION.$OS-$ARCH.tar.gz && \
rm go$VERSION.$OS-$ARCH.tar.gz
echo 'export GOPATH=${HOME}/go' >> ~/.bashrc && \
echo 'export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin' >> ~/.bashrc && \
source ~/.bashrc
Singularity安裝
export VERSION=3.8.0 && export REL=rc.2 && # adjust this as necessary \
wget https://github.com/hpcng/singularity/releases/download/v${VERSION}-${REL}/singularity-${VERSION}-${REL}.tar.gz && \
tar -xzf singularity-${VERSION}-${REL}.tar.gz && \
cd singularity
sudo ./mconfig && \
make -C ./builddir && \
make -C ./builddir install
直接在默認(rèn)路徑上編譯會(huì)報(bào)錯(cuò),顯示Go沒(méi)有找到,可是明明能運(yùn)行g(shù)o:
Configuring for project `singularity' with languages: C, Golang
=> running pre-basechecks project specific checks ...
=> running base system checks ...
checking: host C compiler... cc
checking: host C++ compiler... c++
checking: host Go compiler (at least version 1.13)... not found!
mconfig: could not complete configuration
刪除整個(gè)singularity目錄磅甩,重新解壓安裝(普通用戶即可):
export VERSION=3.8.0
tar -xzf singularity-ce-${VERSION}.tar.gz
cd singularity-ce-${VERSION}
./mconfig --prefix=/opt/singularity/${VERSION}
cd builddir/
make && make install
echo "export PATH=/opt/singularity/${VERSION}/bin:\$PATH" >> ~/.bashrc
常用命令
singularity -h
singularity build #構(gòu)建鏡像
singularity run #容器內(nèi)啟動(dòng)執(zhí)行腳本
singularity exec #鏡像內(nèi)執(zhí)行命令
singularity shell #執(zhí)行一個(gè) shell 腳本
Ref:
http://www.reibang.com/p/b081c9622dda
http://www.reibang.com/p/b46ee066806b
后續(xù)
以上表面上是安裝成功了,但實(shí)際上運(yùn)行singularity容器時(shí)甜害,出現(xiàn)setuid
的錯(cuò)誤,說(shuō)明有些容器普通用戶安裝的singularity不行,最好用root安裝。問(wèn)題來(lái)了沫浆,root安裝默認(rèn)路徑編譯顯示如上的go錯(cuò)誤。
ERROR : No setuid installation found, for unprivileged installation use: ./mconfig --without-suid
重裝了幾次仍然不行脑题,網(wǎng)上說(shuō)明了go和singularity版本需要對(duì)應(yīng)件缸。
最后看了個(gè)回答:使用go version 1.13.15對(duì)應(yīng)singularity version 3.6.3是可以的铜靶。
sudo rm -r /usr/local/go
export VERSION=1.13.15 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
echo 'export GOPATH=${HOME}/go' >> ~/.bashrc && \
echo 'export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin' >> ~/.bashrc && \
source ~/.bashrc
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh |
sh -s -- -b $(go env GOPATH)/bin v1.21.0
github上已經(jīng)不能直接找到v3.6.3叔遂,可在此下載:https://github.com/apptainer/singularity/releases/tag/v3.6.3
如下:
wget https://github.com/apptainer/singularity/releases/download/v3.6.3/singularity-3.6.3.tar.gz
tar -xzf singularity-3.6.3.tar.gz
cd singularity
./mconfig && make -C ./builddir && sudo make -C ./builddir install
singularity
這時(shí),再運(yùn)行容器争剿,顯示正常了已艰。
Ref:
https://github.com/apptainer/singularity/issues/5099
https://blog.csdn.net/weixin_62940906/article/details/128586498