AWSResourcesSetupJavaDeveloperUbuntu

From GGCWiki
Jump to: navigation, search

Contents

Setup

Instance setup

  • create an instance w/ Ubuntu Server 13.10 ami-ace67f9c (64-bit)
  • pick m1.small instance size
  • unchecked option for delete on termination
  • increased root volume size to 20G
  • select security group quicklaunch-1
    • (inbound 22, 5900-5901 open)
    • (outbound all open)

Update and install packages (can take up to an hour)

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install ubuntu-desktop
sudo apt-get install vnc4server
sudo apt-get install xfce4-session
sudo apt-get install xrdb
sudo apt-get install git
sudu apt-get install emacs
sudo apt-get install gimp      ## just in case ...
sudo apt-get install inkscape  ##  " "
sudo apt-get install blender   ##  " "

sudo apt-get install libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1 ## for Android ADT

# enable multiverse repo
sudo sed -i "/^# deb.*multiverse/ s/^# //" /etc/apt/sources.list
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install bsdgames-nonfree  ## rogue!!

# chrome browser
sudo apt-get install libxss1
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome*.deb

Configure

  • setup passwd for user ubuntu (needed for xrdp)
sudo passwd ubuntu <<passwd>>
  • setup vnc password
run vncserver :1 and set password (non-sudo)
vncserver -kill :1
  • setup vnc config

edit ~/.vnc/xstartup as follows

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
  • timezone
sudo dpkg-reconfigure tzdata
  • setup auto start at boot time
edit /etc/init.d/vncserver as follows:

#!/bin/sh 
### BEGIN INIT INFO
# Provides:          vncserver
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Example initscript
# Description:       This file should be used to construct scripts to be
#                    placed in /etc/init.d.
### END INIT INFO

# Author: R Lutz <rlutz@ggc.edu>
#
PATH="$PATH:/usr/X11R6/bin/"

# The Username:Group that will run VNC
export USER="ubuntu"
#${RUNAS}

# The display that VNC will use
DISPLAY="1"

# Color depth (between 8 and 32)
DEPTH="16"

# The Desktop geometry to use.
#GEOMETRY="<WIDTH>x<HEIGHT>"
GEOMETRY="1280x800"

# The name that the VNC Desktop will have.
NAME="itec2150-vnc-server"

OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"

. /lib/lsb/init-functions

case "$1" in
start)
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
;;

stop)
log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
for fn in /tmp/.X11-unix/X1 /tmp/.X1-lock
  do
    if [ -e ${fn} ]; then
      echo "found ${fn}, removing ...."
      su ${user} -c "rm -rf ${fn}"
    fi
  done
;;

restart)
$0 stop
$0 start
;;
esac

exit 0
  • make executable; register with update-rc.d
sudo chmod +x /etc/init.d/vncserver

sudo update-rc.d vncserver defaults
  • configure xrdb, edit as follows:
[xrdp1]
name=sesman-Xvnc
lib=libvnc.so
username=ask
password=ask
ip=127.0.0.1
#port=-1 ## removed!
port=5901 ## added!

Personalize

...
...
JAVA_HOME=/usr/local/java/jdk1.7.0_51
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH

ECLIPSE_HOME=/usr/local/eclipse
export ECLIPSE_HOME
  • fix the tab key
edit
edit ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
change
<property name="<Super>Tab" type="string" value="switch_window_key"/>
to
<property name="<Super>Tab" type="empty"/>

Developer Tools

needed to:
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.7.0_51/jre/bin/java" 1
update-alternatives: using /usr/local/java/jdk1.7.0_51/jre/bin/java to provide /usr/bin/java (java) in auto mode      
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.7.0_51/bin/javac" 1 
update-alternatives: using /usr/local/java/jdk1.7.0_51/bin/javac to provide /usr/bin/javac (javac) in auto mode
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.7.0_51/bin/javaws" 1
update-alternatives: using /usr/local/java/jdk1.7.0_51/bin/javaws to provide /usr/bin/javaws (javaws) in auto mode
$ sudo update-alternatives --set java /usr/local/java/jdk1.7.0_51/jre/bin/java
$ sudo update-alternatives --set javac /usr/local/java/jdk1.7.0_51/bin/javac
$ sudo update-alternatives --set javaws /usr/local/java/jdk1.7.0_51/bin/javaws
needed to:
$ sudo ln -s /usr/local/eclipse/eclipse /usr/bin/eclipse
Personal tools