forked from probcomp/probcomp-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
83 lines (65 loc) · 2.2 KB
/
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
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
#!/bin/sh
# Initialize a probcomp stack instance from the base AMI by running on
# that machine. The base AMI we have been using is ami-80861296, namely
# ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20170414
set -Ceu
sudo apt-get update -qq
# XXX BEGIN KLUDGE https://bugs.launchpad.net/cloud-init/+bug/1309079
sudo rm /boot/grub/menu.lst
sudo update-grub-legacy-ec2 -y
sudo apt-get upgrade -qq
# XXX END KLUDGE https://bugs.launchpad.net/cloud-init/+bug/1309079
sudo apt-get install -qq lsb-release
sudo apt-get install -qq wget
wget http://probcomp.csail.mit.edu/ubuntu-prerelease/probcomp-ubuntu-20170614.asc
echo fbdb2138c27e286e21ba6eea60061c96de7d73daefae930a6d3f7b630acd199e \
probcomp-ubuntu-20170614.asc \
| sha256sum -c
sudo apt-key add probcomp-ubuntu-20170614.asc
echo deb http://probcomp.csail.mit.edu/ubuntu-prerelease \
$(lsb_release -s -c) main \
| sudo tee /etc/apt/sources.list.d/probcomp.list
sudo apt-get update -qq
sudo apt-get install -qq probcomp-ubuntu-keyring
sudo apt-get install -qq python-bayeslite
sudo apt-get install -qq python-cgpm
sudo apt-get install -qq python-crosscat
sudo apt-get install -qq python-iventure
sudo apt-get install -qq python-pytest
sudo apt-get install -qq python-venture
sudo apt-get install -qq python-seaborn
sudo apt-get install -qq python-pip
sudo apt-get install -qq python-virtualenv
virtualenv --system-site-packages ~/venv
(
set -Ceu
. ~/venv/bin/activate
pip install -U 'ipython<6' jupyter
rm -rf ~/.jupyter
jupyter notebook --generate-config
)
sudo apt-get install -qq letsencrypt
mkdir -p /home/ubuntu/notebook
# Make sure the Jupyter server starts when the machine boots
sudo rm -f /etc/rc.local
cat > etc-rc.local.tmp <<EOF
#!/bin/sh
set -Ceu
sudo -u ubuntu /home/ubuntu/restart-jupyter.sh
exit 0
EOF
chmod 755 etc-rc.local.tmp
sudo mv etc-rc.local.tmp /etc/rc.local
rm -f restart-jupyter.sh
cat > restart-jupyter.sh <<EOF
#!/bin/sh
set -Ceu
killall jupyter-notebook || true
rm -f /home/ubuntu/jupyter.nohup.out
cd /home/ubuntu/notebook
. ~/venv/bin/activate
nohup jupyter notebook --no-browser \
--NotebookApp.iopub_data_rate_limit=10000000000 --ip=\* \
> /home/ubuntu/jupyter.nohup.out &
EOF
chmod 755 restart-jupyter.sh