| #!/bin/bash |
| # vm-setup.sh |
| # |
| # This script installs ONOS dependencies and installs a desktop environment on a Miniet VM. |
| |
| ONOS_USER=mininet |
| ONOS_USER_HOME=/home/${ONOS_USER} |
| |
| ECLIPSE_URL=http://download.eclipse.org/technology/epp/downloads/release/luna/R/eclipse-java-luna-R-linux-gtk-x86_64.tar.gz |
| |
| sudo apt-get update |
| |
| # ------------- Install ONOS Dependencies ------------- |
| sudo apt-get install -y openjdk-7-jdk |
| sudo apt-get install -y maven |
| |
| # Not needed: Adding JAVA_HOME and adding java/bin to PATH |
| #cat << EOF >> $ONOS_USER_HOME/.profile |
| #JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 |
| #PATH=\$PATH:\$JAVA_HOME/bin |
| #EOF |
| |
| # Install Zookeeper |
| wget http://apache.osuosl.org/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz |
| tar xvzf zookeeper-3.4.6.tar.gz |
| |
| # CLI dependencies |
| sudo apt-get install -y python-flask python-cmd2 python-pyparsing |
| |
| # -------------- Setup Desktop ---------------- |
| sudo apt-get install -y xorg lxde |
| |
| #TODO: add backgrounds folder |
| #TODO: change background |
| # Remove wallpaper, change background color, and disable screensaver |
| sudo sed -i 's/wallpaper_mode=1/wallpaper_mode=0/g' /usr/share/lxde/pcmanfm/LXDE.conf |
| sudo sed -i 's/desktop_bg=#000000/desktop_bg=#104187/g' /usr/share/lxde/pcmanfm/LXDE.conf |
| sudo sed -i '/screensaver/d' /etc/xdg/lxsession/LXDE/autostart |
| |
| DESKTOP=${ONOS_USER_HOME}/Desktop |
| |
| mkdir -p ${DESKTOP} |
| |
| cat > ${DESKTOP}/Eclipse << EOF |
| [Desktop Entry] |
| Encoding=UTF-8 |
| Type=Application |
| Name=Eclipse |
| Name[en_US]=Eclipse |
| Icon=/opt/eclipse/icon.xpm |
| Exec=/usr/bin/eclipse |
| Comment[en_US]= |
| EOF |
| |
| cat > ${DESKTOP}/Terminal << EOF |
| [Desktop Entry] |
| Encoding=UTF-8 |
| Type=Application |
| Name=Terminal |
| Name[en_US]=Terminal |
| Icon=konsole |
| Exec=/usr/bin/x-terminal-emulator |
| Comment[en_US]= |
| EOF |
| |
| cat > ${DESKTOP}/Gerrit << EOF |
| [Desktop Entry] |
| Encoding=UTF-8 |
| Type=Application |
| Name=ONOS Gerrit |
| Name[en_US]=ONOS Gerrit |
| Icon=internet-web-browser |
| Exec=/usr/bin/chromium-browser http://gerrit.onlab.us |
| Comment[en_US]= |
| EOF |
| |
| cat > ${DESKTOP}/Docs << EOF |
| [Desktop Entry] |
| Encoding=UTF-8 |
| Type=Application |
| Name=ONOS Docs |
| Name[en_US]=ONOS Docs |
| Icon=internet-web-browser |
| Exec=/usr/bin/chromium-browser http://docs.onos.onlab.us |
| Comment[en_US]= |
| EOF |
| |
| cat > ${DESKTOP}/Wireshark << EOF |
| [Desktop Entry] |
| Encoding=UTF-8 |
| Type=Application |
| Name=Wireshark |
| Name[en_US]=Wireshark |
| Icon=wireshark |
| Exec=/usr/bin/wireshark |
| Comment[en_US]= |
| EOF |
| |
| # ------------- Install Other Tools ------------- |
| sudo apt-get install -y wireshark |
| # Enable root-less wireshark and add mininet |
| echo "Enabling wireshark group" |
| echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections |
| sudo dpkg-reconfigure -f noninteractive wireshark-common |
| sudo usermod -a -G wireshark mininet |
| |
| sudo apt-get install -y git-review |
| |
| wget -c -N -O /tmp/eclipse.tar.gz ${ECLIPSE_URL} |
| tar xzf /tmp/eclipse.tar.gz |
| sudo mv eclipse /opt |
| sudo ln -s /opt/eclipse/eclipse /usr/bin/eclipse |
| |
| # ------------ Change username and hostname --------------- |
| echo 'mininet:onos' | sudo chpasswd |
| sudo mv /home/mininet /home/onos |
| sudo sed -i 's/mininet/onos/g' /etc/group /etc/gshadow /etc/hosts /etc/hostname /etc/passwd /etc/shadow /etc/sudoers |
| |