-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.sh
executable file
·141 lines (117 loc) · 3.15 KB
/
install.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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/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="s3://spack-binaries/releases/v0.23/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 \
awscli \
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 \
rsync \
rsync \
sudo \
tree \
unzip \
vim \
wget \
zlib1g-dev
echo "==> Installing python3 packages needed by the tutorial"
python3 -m pip install --upgrade pip \
setuptools \
wheel \
gnureadline \
boto3 \
awscli # needed if we upgrdae boto3
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 1 10`; do
echo " creating $username"
username="spack${i}"
password=$(python3 -c "import crypt; print(crypt.crypt('${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 1 10`; do
sudo usermod -aG docker "spack${i}"
done
echo "== Starting Docker services"
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
sudo services docker start
sudo services containerd start
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
service sshd restart
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"
aws s3 sync --delete --no-sign-request $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