-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvm_setup.sh
32 lines (26 loc) · 1.01 KB
/
vm_setup.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
cd ~
# clone repo and install the conda env
git clone https://www.github.com/microsoft/computervision
# change permission as we copy this into each user's folder
chmod -R ugo+rwx /root/computervision
source /data/anaconda/etc/profile.d/conda.sh
conda env create -f /root/computervision/environment.yml --name cv
conda activate cv
python -m ipykernel install --name cv --display-name "MLADS CV LAB"
# add the 5 users to jupyterhub
echo 'c.Authenticator.whitelist = {"mlads1", "mlads2", "mlads3", "mlads4", "mlads5"}' | sudo tee -a /etc/jupyterhub/jupyterhub_config.py
# create the users to the vm
for i in {1..5}
do
USERNAME=mlads$i
PASSWORD=cvmlads$i
sudo adduser --quiet --disabled-password --gecos "" $USERNAME
echo "$USERNAME:$PASSWORD" | sudo chpasswd
rm -rf /data/home/$USERNAME/notebooks/*
# copy repo
cp -ar /root/computervision /data/home/$USERNAME/notebooks
done
# restart jupyterhub
sudo systemctl stop jupyterhub
sudo systemctl start jupyterhub
exit