-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_singularity.sh
More file actions
executable file
·109 lines (89 loc) · 3.75 KB
/
install_singularity.sh
File metadata and controls
executable file
·109 lines (89 loc) · 3.75 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
# kindmesh Singularity Installer
# This script installs Singularity if it is not already installed
echo "=== KindMesh Singularity Installer ==="
# Function to detect OS
detect_os() {
if [ -f /etc/os-release ]; then
. /etc/os-release
OS=$NAME
VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
OS=$(lsb_release -si)
VER=$(lsb_release -sr)
else
OS=$(uname -s)
VER=$(uname -r)
fi
echo "Detected OS: $OS $VER"
}
# Check if Singularity is already installed
if command -v singularity &> /dev/null; then
echo "Singularity is already installed."
else
echo "Singularity is not installed. Installing..."
detect_os
# Install Singularity based on OS
if [[ "$OS" == *"Ubuntu"* ]] || [[ "$OS" == *"Debian"* ]]; then
# Install dependencies
sudo apt-get update
sudo apt-get install -y build-essential libssl-dev uuid-dev libgpgme11-dev squashfs-tools libseccomp-dev wget pkg-config git cryptsetup-bin
# Install Go (required for Singularity)
export VERSION=1.17.3 OS=linux ARCH=amd64
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 PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
# Download Singularity
export VERSION=3.8.4
wget -O /tmp/singularity-${VERSION}.tar.gz https://github.com/hpcng/singularity/releases/download/v${VERSION}/singularity-${VERSION}.tar.gz
tar -xzf /tmp/singularity-${VERSION}.tar.gz -C /tmp
cd /tmp/singularity-${VERSION}
# Build and install Singularity
./mconfig
make -C builddir
sudo make -C builddir install
echo "Singularity installed successfully."
elif [[ "$OS" == *"CentOS"* ]] || [[ "$OS" == *"Red Hat"* ]]; then
# Install dependencies
sudo yum groupinstall -y "Development Tools"
sudo yum install -y openssl-devel libuuid-devel libseccomp-devel wget squashfs-tools cryptsetup
# Install Go (required for Singularity)
export VERSION=1.17.3 OS=linux ARCH=amd64
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 PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
source ~/.bashrc
# Download Singularity
export VERSION=3.8.4
wget -O /tmp/singularity-${VERSION}.tar.gz https://github.com/hpcng/singularity/releases/download/v${VERSION}/singularity-${VERSION}.tar.gz
tar -xzf /tmp/singularity-${VERSION}.tar.gz -C /tmp
cd /tmp/singularity-${VERSION}
# Build and install Singularity
./mconfig
make -C builddir
sudo make -C builddir install
echo "Singularity installed successfully."
else
echo "Unsupported OS: $OS"
echo "Please install Singularity manually from https://sylabs.io/guides/latest/user-guide/quick_start.html"
exit 1
fi
fi
# Verify installation
echo "Verifying installation..."
singularity --version
echo ""
echo "=== Singularity installed successfully! ==="
echo ""
echo "You can now build and start the Neo4j container using:"
echo " ./singularity_build.sh"
echo " ./singularity_start.sh"
echo ""
# Ask if user wants to build and start the container now
read -p "Do you want to build and start the Neo4j container now? (y/n): " START_CONTAINER
if [[ "$START_CONTAINER" == "y" ]] || [[ "$START_CONTAINER" == "Y" ]]; then
./singularity_build.sh
./singularity_start.sh
fi
exit 0