-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_slurm.sh
executable file
·87 lines (67 loc) · 2.27 KB
/
install_slurm.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
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
#!/usr/bin/env bash
set -ex
if ! [ -z ${1+x} ] && [ $1 = "--client-only" ]; then
CLIENT_ONLY=$1
else
CLIENT_ONLY="no"
fi
GOSU_VERSION=1.11
groupadd -r --gid=$SLURM_GID slurm
useradd -r -g slurm --uid=$SLURM_UID slurm
grep $MUNGE_UID /etc/passwd || true
grep $MUNGE_GID /etc/group || true
groupadd -r --gid=$MUNGE_GID munge
useradd -r -g munge --uid=$MUNGE_UID munge
apt-get update --fix-missing --allow-releaseinfo-change
if [ $CLIENT_ONLY = "no" ]; then
apt-get install -y \
gnupg \
mariadb-server \
psmisc \
bash-completion \
slurmd slurm slurm-client slurmdbd slurmctld \
munge
else
apt-get install -y slurm-client munge
fi
# the step above generate /etc/munge.key, so it's shared across all the containers.
# so we don't need this:
# /sbin/create-munge-key
apt-get clean -y
if [ $CLIENT_ONLY = "no" ]; then
mkdir -p /etc/sysconfig/slurm \
/var/spool/slurmd \
/var/run/slurmd \
/var/run/slurmdbd \
/var/lib/slurmd \
/var/log/slurm \
/data
fi
mkdir -p /etc/slurm/
cp slurm.conf /etc/slurm/slurm.conf
if [ $CLIENT_ONLY = "no" ]; then
cp slurmdbd.conf /etc/slurm/slurmdbd.conf
chown slurm:slurm /etc/slurm/slurmdbd.conf
chmod 600 /etc/slurm/slurmdbd.conf
touch /var/lib/slurmd/node_state \
/var/lib/slurmd/front_end_state \
/var/lib/slurmd/job_state \
/var/lib/slurmd/resv_state \
/var/lib/slurmd/trigger_state \
/var/lib/slurmd/assoc_mgr_state \
/var/lib/slurmd/assoc_usage \
/var/lib/slurmd/qos_usage \
/var/lib/slurmd/fed_mgr_state
# the entrypoint script uses this.
set -ex \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64.asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& rm -rf "${GNUPGHOME}" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true
chown -R slurm:slurm /var/*/slurm*
fi
#echo "NodeName=$(hostname) RealMemory=1000 State=UNKNOWN" >> /etc/slurm/slurm.conf