blob: a7d119ee74e069342d32cdb05f5d320811e11183 [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#
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -08004# This script installs ONOS dependencies and installs a desktop environment on a Mininet VM.
Brian O'Connor37f0cc72014-06-06 20:03:05 -07005
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
alshabib48b63e12014-12-08 23:53:03 -08009export DIST_USER=distributed
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080010export OPT_USER=optical
alshabib22a2c3a2014-11-17 14:37:18 -080011export USER_HOME=/home/${CURRENT_USER}
Brian O'Connor37f0cc72014-06-06 20:03:05 -070012
Jonathan Hart449f4462014-12-04 15:37:46 -080013URL='https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=tutorial1-setup.sh'
14SDNIP_URL='https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=sdnip-setup.sh'
alshabib48b63e12014-12-08 23:53:03 -080015DIST_URL='https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=dist-setup.sh'
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080016OPT_URL='https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=opt-setup.sh'
alshabib3881a142014-11-17 15:04:35 -080017
alshabib22a2c3a2014-11-17 14:37:18 -080018sudo /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 -080019sudo /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}
alshabib48b63e12014-12-08 23:53:03 -080020sudo /usr/sbin/useradd -c "Distributed Tutorial" -d /home/${DIST_USER} -U -m -p $(openssl passwd -1 ${DIST_USER}) -s /bin/bash ${DIST_USER}
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080021sudo /usr/sbin/useradd -c "Optical Tutorial" -d /home/${OPT_USER} -U -m -p $(openssl passwd -1 ${OPT_USER}) -s /bin/bash ${OPT_USER}
alshabibbca6bf22014-11-15 16:38:45 -080022
alshabibcf82ac72014-12-01 09:42:32 -080023
alshabib19073f72014-11-18 17:02:55 -080024echo "${CURRENT_USER} ALL=(ALL) NOPASSWD:ALL" >> tutorial1
alshabib3881a142014-11-17 15:04:35 -080025sudo cp tutorial1 /etc/sudoers.d
26sudo chown root:root /etc/sudoers.d/tutorial1
alshabibbca6bf22014-11-15 16:38:45 -080027
alshabibb32cca82014-12-01 10:12:01 -080028echo "${SDN_IP_USER} ALL=(ALL) NOPASSWD:ALL" >> sdnip
29sudo cp sdnip /etc/sudoers.d
30sudo chown root:root /etc/sudoers.d/sdnip
31
alshabibcf82ac72014-12-01 09:42:32 -080032
alshabib48b63e12014-12-08 23:53:03 -080033echo "${DIST_USER} ALL=(ALL) NOPASSWD:ALL" >> dist
34sudo cp dist /etc/sudoers.d
35sudo chown root:root /etc/sudoers.d/dist
36
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080037echo "${OPT_USER} ALL=(ALL) NOPASSWD:ALL" >> opt
38sudo cp opt /etc/sudoers.d
39sudo chown root:root /etc/sudoers.d/opt
40
Brian O'Connor37f0cc72014-06-06 20:03:05 -070041sudo apt-get update
42
Marc De Leenheera95a4622015-01-09 17:57:16 -080043sudo apt-get install -y git openjdk-8-jdk maven unzip quagga docker.io curl erlang make gcc wget autoconf openssl libssl0.9.8 libssl-dev libncurses5 libncurses5-dev
alshabib8b561d42014-11-18 10:54:06 -080044sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
alshabib1207a832014-11-18 13:27:11 -080045sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
Brian O'Connor10d941e2014-06-12 19:55:09 -070046
alshabibbca6bf22014-11-15 16:38:45 -080047#--------------- Setup Mininet ----------------
Brian O'Connor10d941e2014-06-12 19:55:09 -070048
alshabib91de3b52014-11-17 10:52:55 -080049#git clone git://github.com/mininet/mininet
Brian O'Connor10d941e2014-06-12 19:55:09 -070050
alshabib91de3b52014-11-17 10:52:55 -080051#mininet/util/install.sh -a
Brian O'Connor3ca84022014-08-11 19:46:54 -070052
alshabibbca6bf22014-11-15 16:38:45 -080053# -------------- Switch User ------------------
Brian O'Connor3ca84022014-08-11 19:46:54 -070054
alshabib3881a142014-11-17 15:04:35 -080055wget -O tutorial1-setup.sh $URL
Brian O'Connor37f0cc72014-06-06 20:03:05 -070056
alshabib3881a142014-11-17 15:04:35 -080057sudo -u ${CURRENT_USER} -H sh -c 'cp tutorial1-setup.sh ~/ && cd ~/ && sh tutorial1-setup.sh'
Brian O'Connor24512552014-08-11 23:22:14 -070058
Jonathan Hart2af01a02014-12-01 21:38:50 -080059wget -O sdnip-setup.sh $SDNIP_URL
60
61sudo -u ${SDN_IP_USER} -H sh -c 'cp sdnip-setup.sh ~/ && cd ~/ && sh sdnip-setup.sh'
alshabib48b63e12014-12-08 23:53:03 -080062
63wget -O dist-setup.sh $DIST_URL
64
65sudo -u ${DIST_USER} -H sh -c 'cp dist-setup.sh ~/ && cd ~/ && sh dist-setup.sh'
Marc De Leenheer5dbd04f2015-01-09 12:51:49 -080066
67wget -O opt-setup.sh $OPT_URL
68
69sudo -u ${OPT_USER} -H sh -c 'cp opt-setup.sh ~/ && cd ~/ && sh opt-setup.sh'