blob: fd07be1e8ebef23508c9f4ef9c4317a1c55938b9 [file] [log] [blame]
Jonathan Hart53433b52015-03-26 17:23:34 -07001#!/bin/bash
2# vm-setup.sh
3#
4# This script sets up the VM ready to run ONOS and tutorials, including installing an LXC cluster
5# for ONOS to run in.
6
7sudo apt-get update
8
Jonathan Hart5815d9e2015-03-26 17:38:24 -07009# TODO erlang, quagga, wireshark
Jonathan Hart047c9032015-03-26 20:18:40 -070010#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
11sudo apt-get install -y git openjdk-8-jdk maven unzip curl wget lxc
Jonathan Hart53433b52015-03-26 17:23:34 -070012sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
13sudo update-alternatives --set javac /usr/lib/jvm/java-8-openjdk-amd64/bin/javac
14
Jonathan Hart2f4271d2015-03-26 18:40:57 -070015sudo lxc-create --name onos1 -t download -- --dist ubuntu --release utopic --arch amd64
Jonathan Hart53433b52015-03-26 17:23:34 -070016
Jonathan Hart2f4271d2015-03-26 18:40:57 -070017#sudo sh -c "echo lxc.network.ipv4=10.0.3.11 >> /var/lib/lxc/onos1/config"
Jonathan Hart53433b52015-03-26 17:23:34 -070018sudo sh -c "echo lxc.start.auto=1 >> /var/lib/lxc/onos1/config"
19
Jonathan Hart047c9032015-03-26 20:18:40 -070020#sudo sh -c "sed -i s/dhcp/static/ /var/lib/lxc/onos1/rootfs/etc/network/interfaces"
21#sudo sh -c "cat << EOF >> /var/lib/lxc/onos1/rootfs/etc/network/interfaces
22# address 10.0.3.11
23# netmask 255.255.255.0
24# gateway 10.0.3.1
25# dns-nameservers 10.0.3.1
26#EOF"
Jonathan Hart2f4271d2015-03-26 18:40:57 -070027
Jonathan Hart53433b52015-03-26 17:23:34 -070028sudo lxc-start --name onos1 --daemon
29sudo lxc-attach --name onos1 -- useradd -m sdn -s /bin/bash
30sudo lxc-attach --name onos1 -- /bin/bash -c "echo sdn:rocks | chpasswd"
31sudo lxc-attach --name onos1 -- /bin/bash -c "echo \"sdn ALL=(ALL) NOPASSWD:ALL\" > /etc/sudoers.d/sdn"
32sudo lxc-attach --name onos1 -- apt-get update
Jonathan Hart907f5692015-03-26 17:50:32 -070033sudo lxc-attach --name onos1 -- apt-get install openssh-server -y
Jonathan Hart53433b52015-03-26 17:23:34 -070034sudo lxc-attach --name onos1 -- apt-get install software-properties-common -y
35sudo lxc-attach --name onos1 -- add-apt-repository ppa:webupd8team/java -y
36sudo lxc-attach --name onos1 -- apt-get update
37sudo lxc-attach --name onos1 -- apt-get install oracle-java8-installer oracle-java8-set-default -y
38sudo lxc-stop --name onos1