| #!/bin/bash |
| # vm-setup.sh |
| # |
| # This script sets up the VM ready to run ONOS and tutorials, including installing an LXC cluster |
| # for ONOS to run in. |
| |
| sudo apt-get update |
| |
| # TODO erlang, quagga, wireshark |
| sudo apt-get install -y git openjdk-8-jdk maven unzip curl make gcc wget autoconf openssl libssl0.9.8 libssl-dev libncurses5 libncurses5-dev lxc |
| 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 |
| |
| sudo lxc-create --name onos1 -t download -- --dist ubuntu --release trusty --arch amd64 |
| |
| sudo sh -c "echo lxc.network.ipv4=10.1.3.11 >> /var/lib/lxc/onos1/config" |
| sudo sh -c "echo lxc.start.auto=1 >> /var/lib/lxc/onos1/config" |
| |
| sudo lxc-start --name onos1 --daemon |
| sudo lxc-attach --name onos1 -- useradd -m sdn -s /bin/bash |
| sudo lxc-attach --name onos1 -- /bin/bash -c "echo sdn:rocks | chpasswd" |
| sudo lxc-attach --name onos1 -- /bin/bash -c "echo \"sdn ALL=(ALL) NOPASSWD:ALL\" > /etc/sudoers.d/sdn" |
| sudo lxc-attach --name onos1 -- apt-get update |
| sudo lxc-attach --name onos1 -- apt-get install openssh-server -y |
| sudo lxc-attach --name onos1 -- apt-get install software-properties-common -y |
| sudo lxc-attach --name onos1 -- add-apt-repository ppa:webupd8team/java -y |
| sudo lxc-attach --name onos1 -- apt-get update |
| sudo lxc-attach --name onos1 -- apt-get install oracle-java8-installer oracle-java8-set-default -y |
| sudo lxc-stop --name onos1 |