| #!/bin/bash |
| # vm-setup.sh |
| # |
| # This script installs ONOS dependencies and installs a desktop environment on a Miniet VM. |
| |
| |
| export CURRENT_USER=tutorial1 |
| export USER_HOME=/home/${CURRENT_USER} |
| |
| URL='https://gerrit.onosproject.org/gitweb?p=ONOS-VM.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=tutorial1-setup.sh' |
| |
| 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} |
| |
| echo "${CURRENT_USER} ALL=NOPASSWD: ALL" >> tutorial1 |
| sudo cp tutorial1 /etc/sudoers.d |
| sudo chown root:root /etc/sudoers.d/tutorial1 |
| |
| sudo apt-get update |
| |
| sudo apt-get install -y git openjdk-8-jdk maven unzip |
| sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java |
| sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac |
| |
| #--------------- Setup Mininet ---------------- |
| |
| #git clone git://github.com/mininet/mininet |
| |
| #mininet/util/install.sh -a |
| |
| # -------------- Switch User ------------------ |
| |
| wget -O tutorial1-setup.sh $URL |
| |
| sudo -u ${CURRENT_USER} -H sh -c 'cp tutorial1-setup.sh ~/ && cd ~/ && sh tutorial1-setup.sh' |
| |