-
Notifications
You must be signed in to change notification settings - Fork 264
/
Vagrantfile
executable file
·71 lines (52 loc) · 1.6 KB
/
Vagrantfile
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
ipythonPort = 8888
ipythonHost = 4545
sparkUIPort = 4040
$script = <<SCRIPT
# APT-GET
sudo apt-get update
sudo apt-get upgrade
# PIP
apt-get -y install python-pip
# ANACONDA
anaconda=Anaconda-2.3.0-Linux-x86_64.sh
if [[ ! -f $anaconda ]]; then
wget --quiet https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/$anaconda
fi
chmod +x $anaconda
./$anaconda -b -p /home/vagrant/anaconda
cat >> /home/vagrant/.bashrc << END
export PATH=/home/vagrant/anaconda/bin:$PATH
END
rm $anaconda
# JAVA
apt-get -y install openjdk-7-jdk
# APACHE SPARK
spark=spark-1.4.1-bin-hadoop2.6.tgz
if [[ ! -f $spark ]]; then
wget --quiet http://d3kbcqa49mib13.cloudfront.net/$spark
fi
tar xvf $spark
rm $spark
mv spark-1.4.1-bin-hadoop2.6 spark
# Install findspark & seaborn
/home/vagrant/anaconda/bin/pip install findspark seaborn
echo 'SPARK_HOME=/home/vagrant/spark' >> /etc/environment
echo 'PYSPARK_PYTHON=/home/vagrant/anaconda/bin/python' >> /etc/environment
# Start ipython notebook
sed -i "17i su vagrant -c 'cd /home/vagrant && /home/vagrant/anaconda/bin/ipython notebook --ip=\\"*\\"'" /etc/rc.local
SCRIPT
Vagrant.configure(2) do |config|
config.vm.box = "hashicorp/precise64"
config.vm.network "forwarded_port", guest: ipythonPort, host: ipythonHost,
auto_correct: true
config.vm.network "forwarded_port", guest: sparkUIPort, host: sparkUIPort,
auto_correct: true
config.vm.provider :virtualbox do |v|
v.memory = 1024
v.cpus = 2
end
config.vm.provision :shell, inline: $script
config.vm.synced_folder ".", "/home/vagrant/2015lab8"
end