Brian O'Connor | 5abe3db | 2014-08-05 02:08:34 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 2 | # vm-setup.sh |
| 3 | # |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 4 | # This script installs ONOS dependencies and installs a desktop environment on a Mininet VM. |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 5 | |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 6 | |
alshabib | 22a2c3a | 2014-11-17 14:37:18 -0800 | [diff] [blame] | 7 | export CURRENT_USER=tutorial1 |
alshabib | b32cca8 | 2014-12-01 10:12:01 -0800 | [diff] [blame] | 8 | export SDN_IP_USER=sdnip |
alshabib | 48b63e1 | 2014-12-08 23:53:03 -0800 | [diff] [blame] | 9 | export DIST_USER=distributed |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 10 | export OPT_USER=optical |
alshabib | 22a2c3a | 2014-11-17 14:37:18 -0800 | [diff] [blame] | 11 | export USER_HOME=/home/${CURRENT_USER} |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 12 | |
Jonathan Hart | 449f446 | 2014-12-04 15:37:46 -0800 | [diff] [blame] | 13 | URL='https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=tutorial1-setup.sh' |
| 14 | SDNIP_URL='https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=sdnip-setup.sh' |
alshabib | 48b63e1 | 2014-12-08 23:53:03 -0800 | [diff] [blame] | 15 | DIST_URL='https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=dist-setup.sh' |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 16 | OPT_URL='https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=opt-setup.sh' |
alshabib | 3881a14 | 2014-11-17 15:04:35 -0800 | [diff] [blame] | 17 | |
alshabib | 22a2c3a | 2014-11-17 14:37:18 -0800 | [diff] [blame] | 18 | sudo /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 Hart | 2af01a0 | 2014-12-01 21:38:50 -0800 | [diff] [blame] | 19 | sudo /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} |
alshabib | 48b63e1 | 2014-12-08 23:53:03 -0800 | [diff] [blame] | 20 | sudo /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 Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 21 | sudo /usr/sbin/useradd -c "Optical Tutorial" -d /home/${OPT_USER} -U -m -p $(openssl passwd -1 ${OPT_USER}) -s /bin/bash ${OPT_USER} |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 22 | |
alshabib | cf82ac7 | 2014-12-01 09:42:32 -0800 | [diff] [blame] | 23 | |
alshabib | 19073f7 | 2014-11-18 17:02:55 -0800 | [diff] [blame] | 24 | echo "${CURRENT_USER} ALL=(ALL) NOPASSWD:ALL" >> tutorial1 |
alshabib | 3881a14 | 2014-11-17 15:04:35 -0800 | [diff] [blame] | 25 | sudo cp tutorial1 /etc/sudoers.d |
| 26 | sudo chown root:root /etc/sudoers.d/tutorial1 |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 27 | |
alshabib | b32cca8 | 2014-12-01 10:12:01 -0800 | [diff] [blame] | 28 | echo "${SDN_IP_USER} ALL=(ALL) NOPASSWD:ALL" >> sdnip |
| 29 | sudo cp sdnip /etc/sudoers.d |
| 30 | sudo chown root:root /etc/sudoers.d/sdnip |
| 31 | |
alshabib | cf82ac7 | 2014-12-01 09:42:32 -0800 | [diff] [blame] | 32 | |
alshabib | 48b63e1 | 2014-12-08 23:53:03 -0800 | [diff] [blame] | 33 | echo "${DIST_USER} ALL=(ALL) NOPASSWD:ALL" >> dist |
| 34 | sudo cp dist /etc/sudoers.d |
| 35 | sudo chown root:root /etc/sudoers.d/dist |
| 36 | |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 37 | echo "${OPT_USER} ALL=(ALL) NOPASSWD:ALL" >> opt |
| 38 | sudo cp opt /etc/sudoers.d |
| 39 | sudo chown root:root /etc/sudoers.d/opt |
| 40 | |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 41 | sudo apt-get update |
| 42 | |
Marc De Leenheer | a95a462 | 2015-01-09 17:57:16 -0800 | [diff] [blame^] | 43 | sudo 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 |
alshabib | 8b561d4 | 2014-11-18 10:54:06 -0800 | [diff] [blame] | 44 | sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java |
alshabib | 1207a83 | 2014-11-18 13:27:11 -0800 | [diff] [blame] | 45 | sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac |
Brian O'Connor | 10d941e | 2014-06-12 19:55:09 -0700 | [diff] [blame] | 46 | |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 47 | #--------------- Setup Mininet ---------------- |
Brian O'Connor | 10d941e | 2014-06-12 19:55:09 -0700 | [diff] [blame] | 48 | |
alshabib | 91de3b5 | 2014-11-17 10:52:55 -0800 | [diff] [blame] | 49 | #git clone git://github.com/mininet/mininet |
Brian O'Connor | 10d941e | 2014-06-12 19:55:09 -0700 | [diff] [blame] | 50 | |
alshabib | 91de3b5 | 2014-11-17 10:52:55 -0800 | [diff] [blame] | 51 | #mininet/util/install.sh -a |
Brian O'Connor | 3ca8402 | 2014-08-11 19:46:54 -0700 | [diff] [blame] | 52 | |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 53 | # -------------- Switch User ------------------ |
Brian O'Connor | 3ca8402 | 2014-08-11 19:46:54 -0700 | [diff] [blame] | 54 | |
alshabib | 3881a14 | 2014-11-17 15:04:35 -0800 | [diff] [blame] | 55 | wget -O tutorial1-setup.sh $URL |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 56 | |
alshabib | 3881a14 | 2014-11-17 15:04:35 -0800 | [diff] [blame] | 57 | sudo -u ${CURRENT_USER} -H sh -c 'cp tutorial1-setup.sh ~/ && cd ~/ && sh tutorial1-setup.sh' |
Brian O'Connor | 2451255 | 2014-08-11 23:22:14 -0700 | [diff] [blame] | 58 | |
Jonathan Hart | 2af01a0 | 2014-12-01 21:38:50 -0800 | [diff] [blame] | 59 | wget -O sdnip-setup.sh $SDNIP_URL |
| 60 | |
| 61 | sudo -u ${SDN_IP_USER} -H sh -c 'cp sdnip-setup.sh ~/ && cd ~/ && sh sdnip-setup.sh' |
alshabib | 48b63e1 | 2014-12-08 23:53:03 -0800 | [diff] [blame] | 62 | |
| 63 | wget -O dist-setup.sh $DIST_URL |
| 64 | |
| 65 | sudo -u ${DIST_USER} -H sh -c 'cp dist-setup.sh ~/ && cd ~/ && sh dist-setup.sh' |
Marc De Leenheer | 5dbd04f | 2015-01-09 12:51:49 -0800 | [diff] [blame] | 66 | |
| 67 | wget -O opt-setup.sh $OPT_URL |
| 68 | |
| 69 | sudo -u ${OPT_USER} -H sh -c 'cp opt-setup.sh ~/ && cd ~/ && sh opt-setup.sh' |