blob: 0c3302c3e78ad4c5e3656ea4d33fa429a4028e70 [file] [log] [blame]
Carmelo Casconed6615072017-12-15 00:53:43 -08001#!/bin/bash
2set -xe
3
Carmelo Casconebcb055e2019-01-08 14:33:18 -08004ONOS_BRANCH_DEV="master"
5ONOS_BRANCH_TUTORIAL="onos-1.14"
6BAZEL_VER="0.19.2"
7
Carmelo Casconec5569c22018-04-18 10:09:15 +09008VM_TYPE=${1:-dev}
9
Carmelo Casconebcb055e2019-01-08 14:33:18 -080010if [[ ${VM_TYPE} = "tutorial" ]]
11then
12 ONOS_BRANCH=${ONOS_BRANCH_TUTORIAL}
13else
14 ONOS_BRANCH=${ONOS_BRANCH_DEV}
15fi
16
Carmelo Casconed6615072017-12-15 00:53:43 -080017# Create user sdn
18useradd -m -d /home/sdn -s /bin/bash sdn
19echo "sdn:rocks" | chpasswd
20echo "sdn ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99_sdn
21chmod 440 /etc/sudoers.d/99_sdn
22usermod -aG vboxsf sdn
Carmelo Casconef11513d2018-01-16 00:31:14 -080023update-locale LC_ALL="en_US.UTF-8"
Carmelo Casconed6615072017-12-15 00:53:43 -080024
Carmelo Casconebcb055e2019-01-08 14:33:18 -080025if [[ ${VM_TYPE} = "tutorial" ]]
Carmelo Casconec5569c22018-04-18 10:09:15 +090026then
Carmelo Casconec5569c22018-04-18 10:09:15 +090027 su sdn <<'EOF'
Carmelo Cascone57defd32018-05-11 14:34:01 -070028cd /home/sdn
29bash /vagrant/tutorial-bootstrap.sh
Carmelo Casconec5569c22018-04-18 10:09:15 +090030EOF
Carmelo Casconec5569c22018-04-18 10:09:15 +090031fi
32
Carmelo Casconed6615072017-12-15 00:53:43 -080033# Java 8
34apt-get install software-properties-common -y
35add-apt-repository ppa:webupd8team/java -y
36apt-get update
Carmelo Casconed6615072017-12-15 00:53:43 -080037
Carmelo Cascone95e5afd2018-07-17 14:45:23 +020038DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
39
40echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
Carmelo Casconec5569c22018-04-18 10:09:15 +090041apt-get -y --no-install-recommends install \
Carmelo Cascone57defd32018-05-11 14:34:01 -070042 avahi-daemon \
43 bridge-utils \
44 git \
45 git-review \
46 htop \
Carmelo Casconec5569c22018-04-18 10:09:15 +090047 oracle-java8-installer \
48 oracle-java8-set-default \
Carmelo Cascone57defd32018-05-11 14:34:01 -070049 python2.7 \
50 python2.7-dev \
Carmelo Casconef11513d2018-01-16 00:31:14 -080051 valgrind \
Carmelo Cascone57defd32018-05-11 14:34:01 -070052 zip unzip \
53 tcpdump \
54 vlan \
55 ntp \
56 vim nano emacs \
Charles Chan84431b92018-08-16 20:30:09 -070057 arping \
58 gawk \
59 texinfo \
60 build-essential \
61 iptables \
62 automake \
63 autoconf \
64 libtool \
65 isc-dhcp-server
66
67DEBIAN_FRONTEND=noninteractive apt-get -yq install wireshark
Carmelo Cascone57defd32018-05-11 14:34:01 -070068
Carmelo Cascone03ae0ac2018-10-11 08:31:59 -070069# Install Bazel
Carmelo Casconebcb055e2019-01-08 14:33:18 -080070BAZEL_SH="bazel-${BAZEL_VER}-installer-linux-x86_64.sh"
Carmelo Cascone03ae0ac2018-10-11 08:31:59 -070071wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/${BAZEL_SH}
72chmod +x ${BAZEL_SH}
73./${BAZEL_SH}
74rm -f ${BAZEL_SH}
Carmelo Cascone57defd32018-05-11 14:34:01 -070075
Carmelo Cascone03ae0ac2018-10-11 08:31:59 -070076# Install pip and some python deps (others are defined in install-p4-tools.sh)
Carmelo Cascone57defd32018-05-11 14:34:01 -070077curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
78python2.7 get-pip.py --force-reinstall
79rm -f get-pip.py
Charles Chan84431b92018-08-16 20:30:09 -070080pip install ipaddress
81
Carmelo Casconed6615072017-12-15 00:53:43 -080082tee -a /etc/ssh/sshd_config <<EOF
83
84UseDNS no
85EOF
86
87su sdn <<'EOF'
88cd /home/sdn
Carmelo Casconebcb055e2019-01-08 14:33:18 -080089bash /vagrant/user-bootstrap.sh ${ONOS_BRANCH}
Carmelo Casconed6615072017-12-15 00:53:43 -080090EOF