linux安装配置singularity

linux安装配置singularity,第1张

官方文档:singularity/INSTALL.md at master · apptainer/singularity · GitHub

我的是centos7的系统,Ubuntu系统的安装命令有所不同

按照官方文档的教程一步一步来:

1.安装所需的依赖

运行命令:

# Install basic tools for compiling
sudo yum groupinstall -y 'Development Tools'
# Ensure EPEL repository is available
sudo yum install -y epel-release
# Install RPM packages for dependencies
sudo yum install -y \
    libseccomp-devel \
    squashfs-tools \
    cryptsetup \
    wget git

2.由于singularity是使用go语言编写的,所以我们需要安装go:

首先创建一个目录:

mkdir ~/go && cd ~/go

接下来设置一些参数,不设置也没关系:

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

下载go:

wget -O /tmp/go${GOVERSION}.${OS}-${ARCH}.tar.gz \
  https://dl.google.com/go/go${GOVERSION}.${OS}-${ARCH}.tar.gz

在这条语句中就用到了我们在上一条语句中设置的参数。不过在运行这一条语句的时候遇到了问题

由于某些不可抗力,我们无法访问谷歌的资源,所以我们换一个国内的资源,使用下面这条语句:

sudo yum install golang

由于 Go 代码必需保存在 workspace(工作区)中,所以我们必需在 Home 目录(例如 ~/workspace)创建一个workspace 目录并定义 GOPATH 环境变量指向该目录,这个目录将被 Go 工具用于保存和编辑二进制文件。

mkdir ~/workspace
echo 'export GOPATH="$HOME/workspace"' >> ~/.bashrc
source ~/.bashrc

可以使用命令检查go是否安装成功

go version

3.安装golangci-lint:

golangci-lint 是一个代码检查工具的集合,聚集了多种 Go 代码检查工具,如 golint、go vet 等。文档中是这样描述的:如果你希望改变源代码,或者上传PRs,那么你需要安装它。安装命令如下:

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

注意,该工具软件和go是有版本适配的,建议两个都安装最新版本,应该就没问题。去golangci-lint官网查看最新版本号,将本命令的最后的v1.43.0改为最新版本号

在安装完毕之后,还需要更改环境变量,golangci-lint会安装在GOPATH/bin目录中,首先通过下面命令检查GOPATH(go的环境变量)

可以看到,如果按照上面的步骤走的话,GOPATH将会是/root/workspace/,所以 golangci-lint的安装目录就是/root/workspace/bin,添加全局变量:

vim /etc/profile

在末尾加上:

export PATH=$PATH:/root/workspace/bin

然后在~/.bashrc文件最后添加source /etc/profile:

重启终端后,运行golangci-lint --version检查是否安装成功。

4.下载singularity:在这里使用的是官方文档中,关于centos的安装方法:

运行下列命令:

git clone https://github.com/hpcng/singularity.git
sudo yum install -y rpm-build wget golang
export VERSION=3.8.4  # this is the singularity version, change as you need

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

一路下来,没有遇到任何问题 ,不过部分语句的运行时间较长,需要耐心等待。不过在这里,说实话我不确定使用sudo yum install -y rpm-build wget golang语句的话,是否还需要使用git clone https://github.com/hpcng/singularity.git这条语句,因为我一开始已经运行了git clone语句。。。不过都运行肯定是没问题的。

最后,运行singularity --help检查是否安装成功!

 

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/990054.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存