Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | set -xe |
| 3 | |
Carmelo Cascone | bcb055e | 2019-01-08 14:33:18 -0800 | [diff] [blame] | 4 | ONOS_BRANCH_DEV="master" |
| 5 | ONOS_BRANCH_TUTORIAL="onos-1.14" |
| 6 | BAZEL_VER="0.19.2" |
| 7 | |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 8 | VM_TYPE=${1:-dev} |
| 9 | |
Carmelo Cascone | bcb055e | 2019-01-08 14:33:18 -0800 | [diff] [blame] | 10 | if [[ ${VM_TYPE} = "tutorial" ]] |
| 11 | then |
| 12 | ONOS_BRANCH=${ONOS_BRANCH_TUTORIAL} |
| 13 | else |
| 14 | ONOS_BRANCH=${ONOS_BRANCH_DEV} |
| 15 | fi |
| 16 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 17 | # Create user sdn |
| 18 | useradd -m -d /home/sdn -s /bin/bash sdn |
| 19 | echo "sdn:rocks" | chpasswd |
| 20 | echo "sdn ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99_sdn |
| 21 | chmod 440 /etc/sudoers.d/99_sdn |
| 22 | usermod -aG vboxsf sdn |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 23 | update-locale LC_ALL="en_US.UTF-8" |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 24 | |
Carmelo Cascone | bcb055e | 2019-01-08 14:33:18 -0800 | [diff] [blame] | 25 | if [[ ${VM_TYPE} = "tutorial" ]] |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 26 | then |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 27 | su sdn <<'EOF' |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 28 | cd /home/sdn |
| 29 | bash /vagrant/tutorial-bootstrap.sh |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 30 | EOF |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 31 | fi |
| 32 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 33 | # Java 8 |
| 34 | apt-get install software-properties-common -y |
| 35 | add-apt-repository ppa:webupd8team/java -y |
| 36 | apt-get update |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 37 | |
Carmelo Cascone | 95e5afd | 2018-07-17 14:45:23 +0200 | [diff] [blame] | 38 | DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade |
| 39 | |
| 40 | echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 41 | apt-get -y --no-install-recommends install \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 42 | avahi-daemon \ |
| 43 | bridge-utils \ |
| 44 | git \ |
| 45 | git-review \ |
| 46 | htop \ |
Carmelo Cascone | c5569c2 | 2018-04-18 10:09:15 +0900 | [diff] [blame] | 47 | oracle-java8-installer \ |
| 48 | oracle-java8-set-default \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 49 | python2.7 \ |
| 50 | python2.7-dev \ |
Carmelo Cascone | f11513d | 2018-01-16 00:31:14 -0800 | [diff] [blame] | 51 | valgrind \ |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 52 | zip unzip \ |
| 53 | tcpdump \ |
| 54 | vlan \ |
| 55 | ntp \ |
| 56 | vim nano emacs \ |
Charles Chan | 84431b9 | 2018-08-16 20:30:09 -0700 | [diff] [blame] | 57 | arping \ |
| 58 | gawk \ |
| 59 | texinfo \ |
| 60 | build-essential \ |
| 61 | iptables \ |
| 62 | automake \ |
| 63 | autoconf \ |
| 64 | libtool \ |
| 65 | isc-dhcp-server |
| 66 | |
| 67 | DEBIAN_FRONTEND=noninteractive apt-get -yq install wireshark |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 68 | |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 69 | # Install Bazel |
Carmelo Cascone | bcb055e | 2019-01-08 14:33:18 -0800 | [diff] [blame] | 70 | BAZEL_SH="bazel-${BAZEL_VER}-installer-linux-x86_64.sh" |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 71 | wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VER}/${BAZEL_SH} |
| 72 | chmod +x ${BAZEL_SH} |
| 73 | ./${BAZEL_SH} |
| 74 | rm -f ${BAZEL_SH} |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 75 | |
Carmelo Cascone | 03ae0ac | 2018-10-11 08:31:59 -0700 | [diff] [blame] | 76 | # Install pip and some python deps (others are defined in install-p4-tools.sh) |
Carmelo Cascone | 57defd3 | 2018-05-11 14:34:01 -0700 | [diff] [blame] | 77 | curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py |
| 78 | python2.7 get-pip.py --force-reinstall |
| 79 | rm -f get-pip.py |
Charles Chan | 84431b9 | 2018-08-16 20:30:09 -0700 | [diff] [blame] | 80 | pip install ipaddress |
| 81 | |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 82 | tee -a /etc/ssh/sshd_config <<EOF |
| 83 | |
| 84 | UseDNS no |
| 85 | EOF |
| 86 | |
| 87 | su sdn <<'EOF' |
| 88 | cd /home/sdn |
Carmelo Cascone | bcb055e | 2019-01-08 14:33:18 -0800 | [diff] [blame] | 89 | bash /vagrant/user-bootstrap.sh ${ONOS_BRANCH} |
Carmelo Cascone | d661507 | 2017-12-15 00:53:43 -0800 | [diff] [blame] | 90 | EOF |