Brian O'Connor | 5abe3db | 2014-08-05 02:08:34 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 2 | # vm-setup.sh |
| 3 | # |
| 4 | # This script installs ONOS dependencies and installs a desktop environment on a Miniet VM. |
| 5 | |
| 6 | ONOS_USER=mininet |
| 7 | ONOS_USER_HOME=/home/${ONOS_USER} |
| 8 | |
Yuta HIGUCHI | e74a76d | 2014-08-10 01:17:06 -0700 | [diff] [blame] | 9 | ECLIPSE_URL=http://download.eclipse.org/technology/epp/downloads/release/luna/R/eclipse-java-luna-R-linux-gtk-x86_64.tar.gz |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 10 | |
| 11 | sudo apt-get update |
| 12 | |
| 13 | # ------------- Install ONOS Dependencies ------------- |
Brian O'Connor | 10d941e | 2014-06-12 19:55:09 -0700 | [diff] [blame] | 14 | sudo apt-get install -y openjdk-7-jdk |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 15 | sudo apt-get install -y maven |
Brian O'Connor | 10d941e | 2014-06-12 19:55:09 -0700 | [diff] [blame] | 16 | |
| 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 |
| 24 | wget http://apache.osuosl.org/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz |
| 25 | tar xvzf zookeeper-3.4.6.tar.gz |
| 26 | |
Brian O'Connor | ab49e18 | 2014-06-09 11:41:51 -0700 | [diff] [blame] | 27 | # CLI dependencies |
| 28 | sudo apt-get install -y python-flask python-cmd2 python-pyparsing |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 29 | |
| 30 | # -------------- Setup Desktop ---------------- |
| 31 | sudo 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 |
| 36 | sudo sed -i 's/wallpaper_mode=1/wallpaper_mode=0/g' /usr/share/lxde/pcmanfm/LXDE.conf |
| 37 | sudo sed -i 's/desktop_bg=#000000/desktop_bg=#104187/g' /usr/share/lxde/pcmanfm/LXDE.conf |
| 38 | sudo sed -i '/screensaver/d' /etc/xdg/lxsession/LXDE/autostart |
| 39 | |
| 40 | DESKTOP=${ONOS_USER_HOME}/Desktop |
| 41 | |
| 42 | mkdir -p ${DESKTOP} |
| 43 | |
| 44 | cat > ${DESKTOP}/Eclipse << EOF |
| 45 | [Desktop Entry] |
| 46 | Encoding=UTF-8 |
| 47 | Type=Application |
| 48 | Name=Eclipse |
| 49 | Name[en_US]=Eclipse |
| 50 | Icon=/opt/eclipse/icon.xpm |
| 51 | Exec=/usr/bin/eclipse |
| 52 | Comment[en_US]= |
| 53 | EOF |
| 54 | |
| 55 | cat > ${DESKTOP}/Terminal << EOF |
| 56 | [Desktop Entry] |
| 57 | Encoding=UTF-8 |
| 58 | Type=Application |
| 59 | Name=Terminal |
| 60 | Name[en_US]=Terminal |
| 61 | Icon=konsole |
| 62 | Exec=/usr/bin/x-terminal-emulator |
| 63 | Comment[en_US]= |
| 64 | EOF |
| 65 | |
| 66 | cat > ${DESKTOP}/Gerrit << EOF |
| 67 | [Desktop Entry] |
| 68 | Encoding=UTF-8 |
| 69 | Type=Application |
| 70 | Name=ONOS Gerrit |
| 71 | Name[en_US]=ONOS Gerrit |
| 72 | Icon=internet-web-browser |
Brian O'Connor | 690447e | 2014-08-05 02:45:14 -0700 | [diff] [blame] | 73 | Exec=/usr/bin/chromium-browser http://gerrit.onlab.us |
Brian O'Connor | 37f0cc7 | 2014-06-06 20:03:05 -0700 | [diff] [blame] | 74 | Comment[en_US]= |
| 75 | EOF |
| 76 | |
| 77 | cat > ${DESKTOP}/Docs << EOF |
| 78 | [Desktop Entry] |
| 79 | Encoding=UTF-8 |
| 80 | Type=Application |
| 81 | Name=ONOS Docs |
| 82 | Name[en_US]=ONOS Docs |
| 83 | Icon=internet-web-browser |
| 84 | Exec=/usr/bin/chromium-browser http://docs.onos.onlab.us |
| 85 | Comment[en_US]= |
| 86 | EOF |
| 87 | |
| 88 | cat > ${DESKTOP}/Wireshark << EOF |
| 89 | [Desktop Entry] |
| 90 | Encoding=UTF-8 |
| 91 | Type=Application |
| 92 | Name=Wireshark |
| 93 | Name[en_US]=Wireshark |
| 94 | Icon=wireshark |
| 95 | Exec=/usr/bin/wireshark |
| 96 | Comment[en_US]= |
| 97 | EOF |
| 98 | |
| 99 | # ------------- Install Other Tools ------------- |
| 100 | sudo apt-get install -y wireshark |
| 101 | # Enable root-less wireshark and add mininet |
| 102 | echo "Enabling wireshark group" |
| 103 | echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections |
| 104 | sudo dpkg-reconfigure -f noninteractive wireshark-common |
| 105 | sudo usermod -a -G wireshark mininet |
| 106 | |
| 107 | sudo apt-get install -y git-review |
| 108 | |
| 109 | wget -c -N -O /tmp/eclipse.tar.gz ${ECLIPSE_URL} |
| 110 | tar xzf /tmp/eclipse.tar.gz |
| 111 | sudo mv eclipse /opt |
| 112 | sudo ln -s /opt/eclipse/eclipse /usr/bin/eclipse |
| 113 | |
| 114 | # ------------ Change username and hostname --------------- |
| 115 | echo 'mininet:onos' | sudo chpasswd |
| 116 | sudo mv /home/mininet /home/onos |
| 117 | sudo sed -i 's/mininet/onos/g' /etc/group /etc/gshadow /etc/hosts /etc/hostname /etc/passwd /etc/shadow /etc/sudoers |
| 118 | |