-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
165 lines (147 loc) · 4.32 KB
/
index.html
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#! /bin/sh
#
# PLEASE DO NOT EDIT IT DIRECTLY ON cloudmesh.github.io
#
# Instead if modifications are needed modify it here
#
# * https://github.com/cloudmesh/get/blob/main/pi/index.html
#
# Using python3
#
# curl -Ls http://cloudmesh.github.io/get/pi | sh
#
# Using python3.9
#
# VERSION='3.9.2' curl -Ls http://cloudmesh.github.io/get/pi | sh
#
# production: curl -Ls http://cloudmesh.github.io/get/pi | sh -
#
# development: curl -Ls https://raw.githubusercontent.com/cloudmesh/get/main/pi/index.html | sh -
#
# <pre>
start_total=`date +%s`
NORMAL='\033[0m'
RED='\033[0;31m'
if [ -z "$VERSION" ]
then
VERSION='3'
PYTHON="python3"
PIP="pip3"
else
PYTHON="python${VERSION%.*}"
PIP="pip{VERSION%.*}"
fi
AddToBashrc(){
grep -qF -- "${1}" ~/.bashrc || echo "${1}" >> "${HOME}/.bashrc"
}
Echo() {
echo "${RED}${1}${NORMAL}"
}
Echo "#################################################"
Echo "# Raspbery Pi Cloudmesh Cluster Installation #"
Echo "#################################################"
echo
echo "Aproximate instalation time: 4-7 minutes"
echo
echo "Using Python ${VERSION}"
echo "Expecting it to be accessible via $PYTHON"
echo
Echo "# -----------------------------------------------"
Echo "# Update the system"
Echo "# -----------------------------------------------"
start_update=`date +%s`
sudo apt-get update
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sudo cp /etc/ssh/sshd_config.orig /etc/ssh/sshd_config
sudo apt-get full-upgrade -y
sudo cp /etc/ssh/sshd_config.bak /etc/ssh/sshd_config
sudo apt-get install -y autossh
sudo systemctl restart sshd
sudo apt-get install -y nmap
sudo apt-get install -y libatlas-base-dev
sudo apt-get install -y pv
sudo apt-get install -y libjpeg-dev
sudo apt-get install -y git
sudo apt-get install -y libopenjp2-7
sudo apt-get install -y libtiff5
end_update=`date +%s`
echo
Echo "# -----------------------------------------------"
Echo "# Create a Python Virtual Env ~/ENV3"
Echo "# -----------------------------------------------"
start_venv=`date +%s`
sudo apt-get install python3-venv python3-wheel python3-dev build-essential -y
${PYTHON} -m venv ~/ENV3
. ${HOME}/ENV3/bin/activate
pip install pip -U
which python
which pip
python --version
pip --version
pip install cython -U
end_venv=`date +%s`
echo
Echo "# -----------------------------------------------"
Echo "# Install cloudmesh"
Echo "# -----------------------------------------------"
start_cloudmesh=`date +%s`
pip install cloudmesh-installer -U
mkdir -p ${HOME}/cm
cd ${HOME}/cm
cloudmesh-installer get pi
#### BEGIN WINDOWS BRANCH. IT IS ALSO THE BBRANCH FOR PI LINUX AND MAC E.G. THE NEW VERSION
# IN FUTURE THIS SECTION WILL BE REMOVED AND THE BRANCH WILL BE RENAMED TO main
# Temporarily use the windows mods als as we have not yet made it to main
cd ${HOME}/cm/cloudmesh-pi-burn
git checkout windows
install -e .
cd ${HOME}/cm/cloudmesh-inventory
git checkout windows
pip install -e .
#### END WINDOWS BRANCH
end_cloudmesh=`date +%s`
cd ${HOME}
Echo "# -----------------------------------------------"
Echo "# Create ssh key if it does not exist"
Echo "# -----------------------------------------------"
FILE=$HOME/.ssh/id_rsa.pub
if [ ! -e "$FILE" ]; then
mkdir -p -m 700 $HOME/.ssh
yes y | ssh-keygen -q -N "" -f $HOME/.ssh/id_rsa
fi
echo
Echo "# -----------------------------------------------"
Echo "# Update .bashrc"
Echo "# -----------------------------------------------"
echo
AddToBashrc 'if [ -z "$SSH_AUTH_SOCK" ] ; then eval "$(ssh-agent -s)"; fi'
AddToBashrc "ssh-add"
AddToBashrc 'source ${HOME}/ENV3/bin/activate'
Echo "#################################################"
Echo "# Install Completed #"
Echo "#################################################"
echo
end_total=`date +%s`
time_update=$((end_update-start_update))
time_total=$((end_total-start_total))
time_venv=$((end_venv-start_venv))
time_cloudmesh=$((end_cloudmesh-start_cloudmesh))
echo
echo
echo "Time to update and upgarde: ${time_update} s"
echo "Time to install the venv: ${time_venv} s"
echo "Time to install cloudmesh: ${time_cloudmesh} s"
echo
echo "Time for total install: ${time_total} s"
echo
echo "Time to install: ${time_total} s"
echo
Echo "#################################################"
echo
Echo "Please activate with"
echo
Echo " source ~/ENV3/bin/activate"
echo
Echo "Followed by a reboot"
exit 0
# </pre>