-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
101 lines (84 loc) · 3.32 KB
/
Vagrantfile
File metadata and controls
101 lines (84 loc) · 3.32 KB
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# 64 bit Ubuntu Vagrant Box
config.vm.box = "ubuntu/trusty64"
## Configure hostname and port forwarding
config.vm.hostname = "cos461"
config.ssh.forward_x11 = true
# For jupyter notebook server
config.vm.network "forwarded_port", guest: 8888, host: 8888
# For HTTP proxy
config.vm.network "forwarded_port", guest: 12000, host: 12000
vagrant_root = File.dirname(__FILE__)
# Emacs settings
config.vm.provision "file", source: "#{vagrant_root}/config_files/dot_emacs", destination: "~/.emacs"
# Jupyter notebook settings
config.vm.provision "file", source: "#{vagrant_root}/config_files/jupyter_notebook_config.py", destination: "~/.jupyter/jupyter_notebook_config.py"
## Provisioning
config.vm.provision "shell", inline: <<-SHELL
# Assignment 1
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y emacs
# Build Python 2.7.12 from source
sudo apt-get install -y libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev zlib1g-dev
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tar -xf Python-2.7.12.tgz
cd Python-2.7.12
./configure
make && sudo make install
cd .. && rm -f Python-2.7.12.tgz && rm -rf Python-2.7.12
# get pip
curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py
sudo python get-pip.py
rm -f get-pip.py
# Install old version of tornado before installing jupyter
sudo pip install tornado==4.5.3
sudo pip install jupyter
sudo pip install tzupdate==1.5.0
sudo apt-get install -y gccgo-go
# Set correct permissions for bash scripts
find /vagrant -name "*.sh" | xargs chmod -v 744
# If the repository was pulled from Windows, convert line breaks to Unix-style
sudo apt-get install -y dos2unix
printf "Using dos2unix to convert files to Unix format if necessary..."
find /vagrant -name "*" -type f | xargs dos2unix -q
# Assignment 2
sudo pip install mininet
sudo pip install nbconvert
sudo pip install numpy
sudo pip install matplotlib
sudo apt-get install -y mininet
sudo apt-get install -y python-numpy
sudo apt-get install -y python-matplotlib
# Assignment 3
sudo apt-get install -y whois
sudo pip install ipaddress
# Assignment 5
sudo apt-get install -y apache2-utils
echo "export GOPATH=/vagrant/assignment5" >> /home/vagrant/.profile
# Start in /vagrant instead of /home/vagrant
if ! grep -Fxq "cd /vagrant" /home/vagrant/.bashrc
then
echo "cd /vagrant" >> /home/vagrant/.bashrc
fi
SHELL
## Provisioning to do on each "vagrant up"
config.vm.provision "shell", run: "always", inline: <<-SHELL
sudo tzupdate 2> /dev/null
# Assignment 2
sudo modprobe tcp_probe port=5001 full=1
SHELL
## CPU & RAM
config.vm.provider "virtualbox" do |vb|
# vb.gui = true # Set to true to see the VM console
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "100"]
vb.memory = 2048
vb.cpus = 1
end
end