blob: 47fb5097ee313964e79f4b9200b4d8744380577b [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 Casconea1812ad2018-08-13 18:57:06 -07006BAZEL_VER="0.15.2"
7BAZEL_DEB="bazel_${BAZEL_VER}-linux-x86_64.deb"
Carmelo Casconed6615072017-12-15 00:53:43 -08008# Create user sdn
9useradd -m -d /home/sdn -s /bin/bash sdn
10echo "sdn:rocks" | chpasswd
11echo "sdn ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99_sdn
12chmod 440 /etc/sudoers.d/99_sdn
13usermod -aG vboxsf sdn
Carmelo Casconef11513d2018-01-16 00:31:14 -080014update-locale LC_ALL="en_US.UTF-8"
Carmelo Casconed6615072017-12-15 00:53:43 -080015
Carmelo Cascone57defd32018-05-11 14:34:01 -070016
Carmelo Casconec5569c22018-04-18 10:09:15 +090017if [ ${VM_TYPE} = "tutorial" ]
18then
Carmelo Casconec5569c22018-04-18 10:09:15 +090019 su sdn <<'EOF'
Carmelo Cascone57defd32018-05-11 14:34:01 -070020cd /home/sdn
21bash /vagrant/tutorial-bootstrap.sh
Carmelo Casconec5569c22018-04-18 10:09:15 +090022EOF
Carmelo Casconec5569c22018-04-18 10:09:15 +090023fi
24
Carmelo Casconea1812ad2018-08-13 18:57:06 -070025# Bazel
26wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/${BAZEL_DEB}
27
Carmelo Casconed6615072017-12-15 00:53:43 -080028# Java 8
29apt-get install software-properties-common -y
30add-apt-repository ppa:webupd8team/java -y
31apt-get update
Carmelo Casconed6615072017-12-15 00:53:43 -080032
Carmelo Cascone95e5afd2018-07-17 14:45:23 +020033DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
34
35echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
Carmelo Casconec5569c22018-04-18 10:09:15 +090036apt-get -y --no-install-recommends install \
Carmelo Casconea1812ad2018-08-13 18:57:06 -070037 ./${BAZEL_DEB} \
Carmelo Cascone57defd32018-05-11 14:34:01 -070038 avahi-daemon \
39 bridge-utils \
40 git \
41 git-review \
42 htop \
Carmelo Casconec5569c22018-04-18 10:09:15 +090043 oracle-java8-installer \
44 oracle-java8-set-default \
Carmelo Cascone57defd32018-05-11 14:34:01 -070045 python2.7 \
46 python2.7-dev \
Carmelo Casconef11513d2018-01-16 00:31:14 -080047 valgrind \
Carmelo Cascone57defd32018-05-11 14:34:01 -070048 zip unzip \
49 tcpdump \
50 vlan \
51 ntp \
52 vim nano emacs \
Charles Chan84431b92018-08-16 20:30:09 -070053 arping \
54 gawk \
55 texinfo \
56 build-essential \
57 iptables \
58 automake \
59 autoconf \
60 libtool \
61 isc-dhcp-server
62
63DEBIAN_FRONTEND=noninteractive apt-get -yq install wireshark
Carmelo Cascone57defd32018-05-11 14:34:01 -070064
Carmelo Casconea1812ad2018-08-13 18:57:06 -070065rm -f ${BAZEL_DEB}
Carmelo Cascone57defd32018-05-11 14:34:01 -070066
67curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
68python2.7 get-pip.py --force-reinstall
69rm -f get-pip.py
Carmelo Casconed6615072017-12-15 00:53:43 -080070
Charles Chan84431b92018-08-16 20:30:09 -070071pip install ipaddress
72
Carmelo Casconed6615072017-12-15 00:53:43 -080073tee -a /etc/ssh/sshd_config <<EOF
74
75UseDNS no
76EOF
77
78su sdn <<'EOF'
79cd /home/sdn
80bash /vagrant/user-bootstrap.sh
81EOF