blob: f413cc64a02b80735ec5fef611bad3958f89ac90 [file] [log] [blame]
Carmelo Casconed6615072017-12-15 00:53:43 -08001#!/bin/bash
2set -xe
3
Carmelo Casconec5569c22018-04-18 10:09:15 +09004VM_TYPE=${1:-dev}
5
Carmelo Casconed6615072017-12-15 00:53:43 -08006# Create user sdn
7useradd -m -d /home/sdn -s /bin/bash sdn
8echo "sdn:rocks" | chpasswd
9echo "sdn ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99_sdn
10chmod 440 /etc/sudoers.d/99_sdn
11usermod -aG vboxsf sdn
Carmelo Casconef11513d2018-01-16 00:31:14 -080012update-locale LC_ALL="en_US.UTF-8"
Carmelo Casconed6615072017-12-15 00:53:43 -080013
Carmelo Cascone57defd32018-05-11 14:34:01 -070014
Carmelo Casconec5569c22018-04-18 10:09:15 +090015if [ ${VM_TYPE} = "tutorial" ]
16then
Carmelo Casconec5569c22018-04-18 10:09:15 +090017 su sdn <<'EOF'
Carmelo Cascone57defd32018-05-11 14:34:01 -070018cd /home/sdn
19bash /vagrant/tutorial-bootstrap.sh
Carmelo Casconec5569c22018-04-18 10:09:15 +090020EOF
Carmelo Casconec5569c22018-04-18 10:09:15 +090021fi
22
Carmelo Casconed6615072017-12-15 00:53:43 -080023# Java 8
24apt-get install software-properties-common -y
25add-apt-repository ppa:webupd8team/java -y
26apt-get update
27echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
28
Carmelo Casconec5569c22018-04-18 10:09:15 +090029apt-get -y --no-install-recommends install \
Carmelo Cascone57defd32018-05-11 14:34:01 -070030 avahi-daemon \
31 bridge-utils \
32 git \
33 git-review \
34 htop \
Carmelo Casconec5569c22018-04-18 10:09:15 +090035 oracle-java8-installer \
36 oracle-java8-set-default \
Carmelo Cascone57defd32018-05-11 14:34:01 -070037 python2.7 \
38 python2.7-dev \
Carmelo Casconef11513d2018-01-16 00:31:14 -080039 valgrind \
Carmelo Cascone57defd32018-05-11 14:34:01 -070040 zip unzip \
41 tcpdump \
42 vlan \
43 ntp \
44 vim nano emacs \
45
46
47curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
48python2.7 get-pip.py --force-reinstall
49rm -f get-pip.py
Carmelo Casconed6615072017-12-15 00:53:43 -080050
51tee -a /etc/ssh/sshd_config <<EOF
52
53UseDNS no
54EOF
55
56su sdn <<'EOF'
57cd /home/sdn
58bash /vagrant/user-bootstrap.sh
59EOF