#! /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 - # #
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
#