blob: 20f8e1183e394e0437b237d8d7b02215a4ff1085 [file] [log] [blame]
Brian O'Connor5abe3db2014-08-05 02:08:34 -07001#!/bin/bash
Brian O'Connor37f0cc72014-06-06 20:03:05 -07002# vm-setup.sh
3#
4# This script installs ONOS dependencies and installs a desktop environment on a Miniet VM.
5
alshabibbca6bf22014-11-15 16:38:45 -08006
alshabib22a2c3a2014-11-17 14:37:18 -08007export CURRENT_USER=tutorial1
alshabibb32cca82014-12-01 10:12:01 -08008export SDN_IP_USER=sdnip
alshabib22a2c3a2014-11-17 14:37:18 -08009export USER_HOME=/home/${CURRENT_USER}
Brian O'Connor37f0cc72014-06-06 20:03:05 -070010
Jonathan Hart449f4462014-12-04 15:37:46 -080011URL='https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=tutorial1-setup.sh'
12SDNIP_URL='https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=sdnip-setup.sh'
alshabib3881a142014-11-17 15:04:35 -080013
alshabib22a2c3a2014-11-17 14:37:18 -080014sudo /usr/sbin/useradd -c "Basic ONOS Tutorial" -d /home/${CURRENT_USER} -U -m -p $(openssl passwd -1 ${CURRENT_USER}) -s /bin/bash ${CURRENT_USER}
Jonathan Hart2af01a02014-12-01 21:38:50 -080015sudo /usr/sbin/useradd -c "Basic SDN-IP Tutorial" -d /home/${SDN_IP_USER} -U -m -p $(openssl passwd -1 ${SDN_IP_USER}) -s /bin/bash ${SDN_IP_USER}
alshabibbca6bf22014-11-15 16:38:45 -080016
alshabibcf82ac72014-12-01 09:42:32 -080017
alshabib19073f72014-11-18 17:02:55 -080018echo "${CURRENT_USER} ALL=(ALL) NOPASSWD:ALL" >> tutorial1
alshabib3881a142014-11-17 15:04:35 -080019sudo cp tutorial1 /etc/sudoers.d
20sudo chown root:root /etc/sudoers.d/tutorial1
alshabibbca6bf22014-11-15 16:38:45 -080021
alshabibb32cca82014-12-01 10:12:01 -080022echo "${SDN_IP_USER} ALL=(ALL) NOPASSWD:ALL" >> sdnip
23sudo cp sdnip /etc/sudoers.d
24sudo chown root:root /etc/sudoers.d/sdnip
25
alshabibcf82ac72014-12-01 09:42:32 -080026
Brian O'Connor37f0cc72014-06-06 20:03:05 -070027sudo apt-get update
28
alshabibcf82ac72014-12-01 09:42:32 -080029sudo apt-get install -y git openjdk-8-jdk maven unzip quagga
alshabib8b561d42014-11-18 10:54:06 -080030sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
alshabib1207a832014-11-18 13:27:11 -080031sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
Brian O'Connor10d941e2014-06-12 19:55:09 -070032
alshabibbca6bf22014-11-15 16:38:45 -080033#--------------- Setup Mininet ----------------
Brian O'Connor10d941e2014-06-12 19:55:09 -070034
alshabib91de3b52014-11-17 10:52:55 -080035#git clone git://github.com/mininet/mininet
Brian O'Connor10d941e2014-06-12 19:55:09 -070036
alshabib91de3b52014-11-17 10:52:55 -080037#mininet/util/install.sh -a
Brian O'Connor3ca84022014-08-11 19:46:54 -070038
alshabibbca6bf22014-11-15 16:38:45 -080039# -------------- Switch User ------------------
Brian O'Connor3ca84022014-08-11 19:46:54 -070040
alshabib3881a142014-11-17 15:04:35 -080041wget -O tutorial1-setup.sh $URL
Brian O'Connor37f0cc72014-06-06 20:03:05 -070042
alshabib3881a142014-11-17 15:04:35 -080043sudo -u ${CURRENT_USER} -H sh -c 'cp tutorial1-setup.sh ~/ && cd ~/ && sh tutorial1-setup.sh'
Brian O'Connor24512552014-08-11 23:22:14 -070044
Jonathan Hart2af01a02014-12-01 21:38:50 -080045wget -O sdnip-setup.sh $SDNIP_URL
46
47sudo -u ${SDN_IP_USER} -H sh -c 'cp sdnip-setup.sh ~/ && cd ~/ && sh sdnip-setup.sh'