blob: 71fd44c0d019f68136408657a4b6370085cb1ad7 [file] [log] [blame]
Brian O'Connor5abe3db2014-08-05 02:08:34 -07001#!/bin/bash
Brian O'Connor37f0cc72014-06-06 20:03:05 -07002# vm-setup.sh
3#
4# This script installs ONOS dependencies and installs a desktop environment on a Miniet VM.
5
6ONOS_USER=mininet
7ONOS_USER_HOME=/home/${ONOS_USER}
8
Yuta HIGUCHIe74a76d2014-08-10 01:17:06 -07009ECLIPSE_URL=http://download.eclipse.org/technology/epp/downloads/release/luna/R/eclipse-java-luna-R-linux-gtk-x86_64.tar.gz
Brian O'Connor37f0cc72014-06-06 20:03:05 -070010
11sudo apt-get update
12
13# ------------- Install ONOS Dependencies -------------
Brian O'Connor10d941e2014-06-12 19:55:09 -070014sudo apt-get install -y openjdk-7-jdk
Brian O'Connor37f0cc72014-06-06 20:03:05 -070015sudo apt-get install -y maven
Brian O'Connor10d941e2014-06-12 19:55:09 -070016
17# Not needed: Adding JAVA_HOME and adding java/bin to PATH
18#cat << EOF >> $ONOS_USER_HOME/.profile
19#JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
20#PATH=\$PATH:\$JAVA_HOME/bin
21#EOF
22
23# Install Zookeeper
24wget http://apache.osuosl.org/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
25tar xvzf zookeeper-3.4.6.tar.gz
26
Brian O'Connorab49e182014-06-09 11:41:51 -070027# CLI dependencies
28sudo apt-get install -y python-flask python-cmd2 python-pyparsing
Brian O'Connor37f0cc72014-06-06 20:03:05 -070029
30# -------------- Setup Desktop ----------------
31sudo apt-get install -y xorg lxde
32
33#TODO: add backgrounds folder
34#TODO: change background
35# Remove wallpaper, change background color, and disable screensaver
36sudo sed -i 's/wallpaper_mode=1/wallpaper_mode=0/g' /usr/share/lxde/pcmanfm/LXDE.conf
37sudo sed -i 's/desktop_bg=#000000/desktop_bg=#104187/g' /usr/share/lxde/pcmanfm/LXDE.conf
38sudo sed -i '/screensaver/d' /etc/xdg/lxsession/LXDE/autostart
39
40DESKTOP=${ONOS_USER_HOME}/Desktop
41
42mkdir -p ${DESKTOP}
43
44cat > ${DESKTOP}/Eclipse << EOF
45[Desktop Entry]
46Encoding=UTF-8
47Type=Application
48Name=Eclipse
49Name[en_US]=Eclipse
50Icon=/opt/eclipse/icon.xpm
51Exec=/usr/bin/eclipse
52Comment[en_US]=
53EOF
54
55cat > ${DESKTOP}/Terminal << EOF
56[Desktop Entry]
57Encoding=UTF-8
58Type=Application
59Name=Terminal
60Name[en_US]=Terminal
61Icon=konsole
62Exec=/usr/bin/x-terminal-emulator
63Comment[en_US]=
64EOF
65
66cat > ${DESKTOP}/Gerrit << EOF
67[Desktop Entry]
68Encoding=UTF-8
69Type=Application
70Name=ONOS Gerrit
71Name[en_US]=ONOS Gerrit
72Icon=internet-web-browser
Brian O'Connor690447e2014-08-05 02:45:14 -070073Exec=/usr/bin/chromium-browser http://gerrit.onlab.us
Brian O'Connor37f0cc72014-06-06 20:03:05 -070074Comment[en_US]=
75EOF
76
77cat > ${DESKTOP}/Docs << EOF
78[Desktop Entry]
79Encoding=UTF-8
80Type=Application
81Name=ONOS Docs
82Name[en_US]=ONOS Docs
83Icon=internet-web-browser
84Exec=/usr/bin/chromium-browser http://docs.onos.onlab.us
85Comment[en_US]=
86EOF
87
88cat > ${DESKTOP}/Wireshark << EOF
89[Desktop Entry]
90Encoding=UTF-8
91Type=Application
92Name=Wireshark
93Name[en_US]=Wireshark
94Icon=wireshark
95Exec=/usr/bin/wireshark
96Comment[en_US]=
97EOF
98
99# ------------- Install Other Tools -------------
100sudo apt-get install -y wireshark
101# Enable root-less wireshark and add mininet
102echo "Enabling wireshark group"
103echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections
104sudo dpkg-reconfigure -f noninteractive wireshark-common
105sudo usermod -a -G wireshark mininet
106
107sudo apt-get install -y git-review
108
109wget -c -N -O /tmp/eclipse.tar.gz ${ECLIPSE_URL}
110tar xzf /tmp/eclipse.tar.gz
111sudo mv eclipse /opt
112sudo ln -s /opt/eclipse/eclipse /usr/bin/eclipse
113
114# ------------ Change username and hostname ---------------
115echo 'mininet:onos' | sudo chpasswd
116sudo mv /home/mininet /home/onos
117sudo sed -i 's/mininet/onos/g' /etc/group /etc/gshadow /etc/hosts /etc/hostname /etc/passwd /etc/shadow /etc/sudoers
118