| #!/bin/bash |
| # vm-setup.sh |
| # |
| # This script installs ONOS dependencies and installs a desktop environment on a Miniet VM. |
| |
| |
| export CURRENT_USER=tutorial1 |
| export SDN_IP_USER=sdnip |
| 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' |
| SDNIP_URL='https://gerrit.onosproject.org/gitweb?p=ONOS-VM.git;a=blob_plain;hb=refs/heads/onos-tutorial;f=sdnip-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} |
| 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} |
| |
| |
| echo "${CURRENT_USER} ALL=(ALL) NOPASSWD:ALL" >> tutorial1 |
| sudo cp tutorial1 /etc/sudoers.d |
| sudo chown root:root /etc/sudoers.d/tutorial1 |
| |
| echo "${SDN_IP_USER} ALL=(ALL) NOPASSWD:ALL" >> sdnip |
| sudo cp sdnip /etc/sudoers.d |
| sudo chown root:root /etc/sudoers.d/sdnip |
| |
| |
| sudo apt-get update |
| |
| sudo apt-get install -y git openjdk-8-jdk maven unzip quagga |
| 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' |
| |
| wget -O sdnip-setup.sh $SDNIP_URL |
| |
| sudo -u ${SDN_IP_USER} -H sh -c 'cp sdnip-setup.sh ~/ && cd ~/ && sh sdnip-setup.sh' |