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 | # |
| 4 | # This script installs ONOS dependencies and installs a desktop environment on a Miniet VM. |
| 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 | 22a2c3a | 2014-11-17 14:37:18 -0800 | [diff] [blame] | 9 | export USER_HOME=/home/${CURRENT_USER} |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 10 | |
Jonathan Hart | 449f446 | 2014-12-04 15:37:46 -0800 | [diff] [blame] | 11 | URL='https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=tutorial1-setup.sh' |
| 12 | SDNIP_URL='https://gerrit.onosproject.org/gitweb?p=onos-vm.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=sdnip-setup.sh' |
alshabib | 3881a14 | 2014-11-17 15:04:35 -0800 | [diff] [blame] | 13 | |
alshabib | 22a2c3a | 2014-11-17 14:37:18 -0800 | [diff] [blame] | 14 | 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] | 15 | 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 | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 16 | |
alshabib | cf82ac7 | 2014-12-01 09:42:32 -0800 | [diff] [blame] | 17 | |
alshabib | 19073f7 | 2014-11-18 17:02:55 -0800 | [diff] [blame] | 18 | echo "${CURRENT_USER} ALL=(ALL) NOPASSWD:ALL" >> tutorial1 |
alshabib | 3881a14 | 2014-11-17 15:04:35 -0800 | [diff] [blame] | 19 | sudo cp tutorial1 /etc/sudoers.d |
| 20 | sudo chown root:root /etc/sudoers.d/tutorial1 |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 21 | |
alshabib | b32cca8 | 2014-12-01 10:12:01 -0800 | [diff] [blame] | 22 | echo "${SDN_IP_USER} ALL=(ALL) NOPASSWD:ALL" >> sdnip |
| 23 | sudo cp sdnip /etc/sudoers.d |
| 24 | sudo chown root:root /etc/sudoers.d/sdnip |
| 25 | |
alshabib | cf82ac7 | 2014-12-01 09:42:32 -0800 | [diff] [blame] | 26 | |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 27 | sudo apt-get update |
| 28 | |
alshabib | cf82ac7 | 2014-12-01 09:42:32 -0800 | [diff] [blame] | 29 | sudo apt-get install -y git openjdk-8-jdk maven unzip quagga |
alshabib | 8b561d4 | 2014-11-18 10:54:06 -0800 | [diff] [blame] | 30 | 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] | 31 | 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] | 32 | |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 33 | #--------------- Setup Mininet ---------------- |
Brian O'Connor | 10d941e | 2014-06-12 19:55:09 -0700 | [diff] [blame] | 34 | |
alshabib | 91de3b5 | 2014-11-17 10:52:55 -0800 | [diff] [blame] | 35 | #git clone git://github.com/mininet/mininet |
Brian O'Connor | 10d941e | 2014-06-12 19:55:09 -0700 | [diff] [blame] | 36 | |
alshabib | 91de3b5 | 2014-11-17 10:52:55 -0800 | [diff] [blame] | 37 | #mininet/util/install.sh -a |
Brian O'Connor | 3ca8402 | 2014-08-11 19:46:54 -0700 | [diff] [blame] | 38 | |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 39 | # -------------- Switch User ------------------ |
Brian O'Connor | 3ca8402 | 2014-08-11 19:46:54 -0700 | [diff] [blame] | 40 | |
alshabib | 3881a14 | 2014-11-17 15:04:35 -0800 | [diff] [blame] | 41 | wget -O tutorial1-setup.sh $URL |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 42 | |
alshabib | 3881a14 | 2014-11-17 15:04:35 -0800 | [diff] [blame] | 43 | 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] | 44 | |
Jonathan Hart | 2af01a0 | 2014-12-01 21:38:50 -0800 | [diff] [blame] | 45 | wget -O sdnip-setup.sh $SDNIP_URL |
| 46 | |
| 47 | sudo -u ${SDN_IP_USER} -H sh -c 'cp sdnip-setup.sh ~/ && cd ~/ && sh sdnip-setup.sh' |