-
Notifications
You must be signed in to change notification settings - Fork 31
/
install-apptainer-ubuntu.sh
58 lines (52 loc) · 1.53 KB
/
install-apptainer-ubuntu.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
# exit when any command fails
set -e
APPTAINER_VERSION=$1
GO_VERSION=$2
# Install apptainer from release package on amd64
ARCH=$(arch)
if [ $ARCH == "x86_64" ]; then
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
ca-certificates \
squashfs-tools \
wget
DEBIAN_PACKAGE_NAME=apptainer_${APPTAINER_VERSION}_amd64.deb
wget -q https://github.com/apptainer/apptainer/releases/download/v$APPTAINER_VERSION/$DEBIAN_PACKAGE_NAME
dpkg -i $DEBIAN_PACKAGE_NAME
rm $DEBIAN_PACKAGE_NAME
exit
fi
# Else, build it from source.
# Install build dependencies.
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
build-essential \
ca-certificates \
cryptsetup \
git \
libgpgme11-dev \
libseccomp-dev \
libssl-dev \
pkg-config \
squashfs-tools \
uuid-dev \
wget
# Install Golang
if [ "$ARCH" == "aarch64" ]; then
GO_ARCH="arm64" # go uses "arm64" whereas ubuntu uses "aarch64", but it is the same.
fi
GO_ARCHIVE_NAME=go$GO_VERSION.linux-$GO_ARCH.tar.gz
wget -qO - https://go.dev/dl/$GO_ARCHIVE_NAME | tar -C /usr/local -xzv
export PATH=/usr/local/go/bin:$PATH
echo 'export PATH=/usr/local/go/bin:$PATH' >>~/.bashrc
go version
# Install Apptainer
APPTAINER_BASE_NAME=apptainer-$APPTAINER_VERSION
wget -qO - https://github.com/apptainer/apptainer/releases/download/v$APPTAINER_VERSION/$APPTAINER_BASE_NAME.tar.gz | tar -xzv
cd $APPTAINER_BASE_NAME
./mconfig
make -C builddir
make -C builddir install
cd ..
rm -rf $APPTAINER_BASE_NAME