blob: cf90ea25c709ca2a60692615383d4f39de9afbcc [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"
Carmelo Cascone03ae0ac2018-10-11 08:31:59 -07007BAZEL_SH="bazel-${BAZEL_VER}-installer-linux-x86_64.sh"
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
31echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
Carmelo Casconec5569c22018-04-18 10:09:15 +090032apt-get -y --no-install-recommends install \
Carmelo Cascone57defd32018-05-11 14:34:01 -070033 avahi-daemon \
34 bridge-utils \
35 git \
36 git-review \
37 htop \
Carmelo Casconec5569c22018-04-18 10:09:15 +090038 oracle-java8-installer \
39 oracle-java8-set-default \
Carmelo Cascone57defd32018-05-11 14:34:01 -070040 python2.7 \
41 python2.7-dev \
Carmelo Casconef11513d2018-01-16 00:31:14 -080042 valgrind \
Carmelo Cascone57defd32018-05-11 14:34:01 -070043 zip unzip \
44 tcpdump \
45 vlan \
46 ntp \
47 vim nano emacs \
Charles Chan84431b92018-08-16 20:30:09 -070048 arping \
49 gawk \
50 texinfo \
51 build-essential \
52 iptables \
53 automake \
54 autoconf \
55 libtool \
56 isc-dhcp-server
57
58DEBIAN_FRONTEND=noninteractive apt-get -yq install wireshark
Carmelo Cascone57defd32018-05-11 14:34:01 -070059
Carmelo Cascone03ae0ac2018-10-11 08:31:59 -070060# Install Bazel
61wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/${BAZEL_SH}
62chmod +x ${BAZEL_SH}
63./${BAZEL_SH}
64rm -f ${BAZEL_SH}
Carmelo Cascone57defd32018-05-11 14:34:01 -070065
Carmelo Cascone03ae0ac2018-10-11 08:31:59 -070066# Install pip and some python deps (others are defined in install-p4-tools.sh)
Carmelo Cascone57defd32018-05-11 14:34:01 -070067curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
68python2.7 get-pip.py --force-reinstall
69rm -f get-pip.py
Charles Chan84431b92018-08-16 20:30:09 -070070pip install ipaddress
71
Carmelo Casconed6615072017-12-15 00:53:43 -080072tee -a /etc/ssh/sshd_config <<EOF
73
74UseDNS no
75EOF
76
77su sdn <<'EOF'
78cd /home/sdn
79bash /vagrant/user-bootstrap.sh
80EOF