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 |
| 8 | export USER_HOME=/home/${CURRENT_USER} |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 9 | |
alshabib | 3881a14 | 2014-11-17 15:04:35 -0800 | [diff] [blame] | 10 | URL='https://gerrit.onosproject.org/gitweb?p=ONOS-VM.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=tutorial1-setup.sh' |
| 11 | |
alshabib | 22a2c3a | 2014-11-17 14:37:18 -0800 | [diff] [blame] | 12 | 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} |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 13 | |
alshabib | 3881a14 | 2014-11-17 15:04:35 -0800 | [diff] [blame] | 14 | echo "${CURRENT_USER} ALL=NOPASSWD: ALL" >> tutorial1 |
| 15 | sudo cp tutorial1 /etc/sudoers.d |
| 16 | sudo chown root:root /etc/sudoers.d/tutorial1 |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 17 | |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 18 | sudo apt-get update |
| 19 | |
alshabib | 8b561d4 | 2014-11-18 10:54:06 -0800 | [diff] [blame] | 20 | sudo apt-get install -y git openjdk-8-jdk maven unzip |
| 21 | 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] | 22 | 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] | 23 | |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 24 | #--------------- Setup Mininet ---------------- |
Brian O'Connor | 10d941e | 2014-06-12 19:55:09 -0700 | [diff] [blame] | 25 | |
alshabib | 91de3b5 | 2014-11-17 10:52:55 -0800 | [diff] [blame] | 26 | #git clone git://github.com/mininet/mininet |
Brian O'Connor | 10d941e | 2014-06-12 19:55:09 -0700 | [diff] [blame] | 27 | |
alshabib | 91de3b5 | 2014-11-17 10:52:55 -0800 | [diff] [blame] | 28 | #mininet/util/install.sh -a |
Brian O'Connor | 3ca8402 | 2014-08-11 19:46:54 -0700 | [diff] [blame] | 29 | |
alshabib | bca6bf2 | 2014-11-15 16:38:45 -0800 | [diff] [blame] | 30 | # -------------- Switch User ------------------ |
Brian O'Connor | 3ca8402 | 2014-08-11 19:46:54 -0700 | [diff] [blame] | 31 | |
alshabib | 3881a14 | 2014-11-17 15:04:35 -0800 | [diff] [blame] | 32 | wget -O tutorial1-setup.sh $URL |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 33 | |
alshabib | 3881a14 | 2014-11-17 15:04:35 -0800 | [diff] [blame] | 34 | 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] | 35 | |