blob: cac34b7912edb6b6e8600da920e815566f17dd82 [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 Casconec5569c22018-04-18 10:09:15 +090016if [ ${VM_TYPE} = "tutorial" ]
17then
Carmelo Casconec5569c22018-04-18 10:09:15 +090018 su sdn <<'EOF'
Carmelo Cascone57defd32018-05-11 14:34:01 -070019cd /home/sdn
20bash /vagrant/tutorial-bootstrap.sh
Carmelo Casconec5569c22018-04-18 10:09:15 +090021EOF
Carmelo Casconec5569c22018-04-18 10:09:15 +090022fi
23
Carmelo Casconed6615072017-12-15 00:53:43 -080024# Java 8
25apt-get install software-properties-common -y
26add-apt-repository ppa:webupd8team/java -y
27apt-get update
Carmelo Casconed6615072017-12-15 00:53:43 -080028
Carmelo Cascone95e5afd2018-07-17 14:45:23 +020029DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
30
Carmelo Casconeea2c1102018-08-21 18:32:58 -070031wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/${BAZEL_DEB}
Carmelo Cascone95e5afd2018-07-17 14:45:23 +020032echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
Carmelo Casconec5569c22018-04-18 10:09:15 +090033apt-get -y --no-install-recommends install \
Carmelo Casconea1812ad2018-08-13 18:57:06 -070034 ./${BAZEL_DEB} \
Carmelo Cascone57defd32018-05-11 14:34:01 -070035 avahi-daemon \
36 bridge-utils \
37 git \
38 git-review \
39 htop \
Carmelo Casconec5569c22018-04-18 10:09:15 +090040 oracle-java8-installer \
41 oracle-java8-set-default \
Carmelo Cascone57defd32018-05-11 14:34:01 -070042 python2.7 \
43 python2.7-dev \
Carmelo Casconef11513d2018-01-16 00:31:14 -080044 valgrind \
Carmelo Cascone57defd32018-05-11 14:34:01 -070045 zip unzip \
46 tcpdump \
47 vlan \
48 ntp \
49 vim nano emacs \
Charles Chan84431b92018-08-16 20:30:09 -070050 arping \
51 gawk \
52 texinfo \
53 build-essential \
54 iptables \
55 automake \
56 autoconf \
57 libtool \
58 isc-dhcp-server
59
60DEBIAN_FRONTEND=noninteractive apt-get -yq install wireshark
Carmelo Cascone57defd32018-05-11 14:34:01 -070061
Carmelo Casconea1812ad2018-08-13 18:57:06 -070062rm -f ${BAZEL_DEB}
Carmelo Cascone57defd32018-05-11 14:34:01 -070063
64curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
65python2.7 get-pip.py --force-reinstall
66rm -f get-pip.py
Carmelo Casconed6615072017-12-15 00:53:43 -080067
Charles Chan84431b92018-08-16 20:30:09 -070068pip install ipaddress
69
Carmelo Casconed6615072017-12-15 00:53:43 -080070tee -a /etc/ssh/sshd_config <<EOF
71
72UseDNS no
73EOF
74
75su sdn <<'EOF'
76cd /home/sdn
77bash /vagrant/user-bootstrap.sh
78EOF