-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·123 lines (107 loc) · 2.82 KB
/
install.sh
File metadata and controls
executable file
·123 lines (107 loc) · 2.82 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
#
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#
# This is a setup script for our Spack tutorial.
# It adds everything you need to a fresh ubuntu image.
#
#------------------------------------------------------------------------
# !! UPDATE BEFORE NEXT TUTORIAL !!
#------------------------------------------------------------------------
# URL for buildcache to copy into AMI
REMOTE_BUILDCACHE_URL="spack-binaries/v2025.11.0/tutorial"
# directory containing this script
script_dir="$(dirname $0)"
echo "==> Doing apt updates"
apt update -y
apt upgrade -y
echo "==> Installing apt packages needed by the tutorial"
apt install -y \
autoconf \
automake \
bash-completion \
bzip2 \
clang \
cpio \
curl \
docker.io \
emacs \
file \
findutils \
fish \
gcc g++ gfortran \
gcc-10 gfortran-10 g++-10 \
git \
git \
gpg \
graphviz \
iproute2 \
iputils-ping \
jq \
libc-dev \
libffi-dev \
libssl-dev \
libxml2-dev \
locate \
m4 \
make \
mercurial \
mpich \
ncurses-dev \
patch \
pciutils \
python3-pip \
rclone \
rsync \
sudo \
tree \
unzip \
vim \
wget \
zlib1g-dev
echo "==> Cleaning up old apt files"
apt autoremove --purge && apt clean
echo "==> Ensuring spack can detect gpg"
ln -s /usr/bin/gpg /usr/bin/gpg2
echo "==> Creating tutorial users"
for i in `seq 0 10`; do
echo " creating $username"
username="spack${i}"
password=$(openssl passwd -6 $username)
useradd \
--create-home \
--password $password \
--shell /bin/bash \
$username
done
echo "== Creating a group of docker users"
sudo groupadd docker
for i in `seq 0 10`; do
sudo usermod -aG docker "spack${i}"
done
echo "== Starting Docker services"
sudo systemctl enable --now docker.service
sudo systemctl enable --now containerd.service
echo "==> Enabling password login"
perl -i~ -pe 's/^\#?PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
perl -i~ -pe 's/^\#?PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config.d/*.conf
systemctl restart ssh
echo "==> Cleaning up home directories"
sudo rm -rf /home/spack*/.spack
sudo rm -rf /home/spack*/.gnupg
sudo rm -rf /home/spack*/.bash_history
sudo rm -rf /home/spack*/.cache
sudo rm -rf /home/spack*/.emacs.d
sudo rm -rf /home/spack*/.viminfo
echo "==> Installing the backup mirror"
rclone copy :s3:$REMOTE_BUILDCACHE_URL /mirror
chmod -R go+r /mirror
echo "==> Copying tutorial config into place"
mkdir -p /etc/spack
cp $script_dir/config/*.yaml /etc/spack/
chmod -R go+r /etc/spack
echo "==> Add some aliases"
echo "alias e='emacs -nw'" >> /etc/bash.bashrc