Software Projects

Ubuntu VirtualBox Development Environment Setup

Posted in Uncategorized by rmt on June 2, 2011

To start fresh after encountering problems like bugs in VirtualBox’s snapshots/clones crashing the VM, the following are my notes for installing a clean-slate Ubuntu dev environment on a VirtualBox VM. These instructions work on my computer, and are a work in progress. Some instructions are for Ubuntu 11.04, and some are for Ubuntu 12.04.

Create new VM

Start VM and Install Ubuntu from ISO. Choose Download updates while installing. If computer name causes a problem, do Back then Forward, and the problem should disappear. Name=first name, Login=last name.

When prompted to restart, do Devices->CD/DVD Drive->Eject disk from virtual drive, and shut down VM

Configure VM Settings and Host/Guest Shared Folders:

Settings: System->Processor->8 CPUs
System->Acceleration->Enable VT-x
Display->Video Memory: Increase to max
Display->Video: Enable 3D Acceleration
USB->USB Device Filters->Add and choose handset hardware that’s connected to USB
USB->USB Device Filters->Add Empty Filter
Shared Folders: Add Folder Path to C:\eclipse-workspace on host
Check the checkbox for Auto-mount (Folder will be automatically mounted as /media/sf_eclipse-workspace on the Ubuntu guest system owned by root, and is mountable using mkdir ~/eclipse-workspace;sudo mount.vboxsf -o fmode=0777,dmode=0777 eclipse-workspace /home/username/eclipse-workspace/)
[Modification: don’t choose Auto Mount, just choose Make Permanent, and mount by doing the edit listed below to /etc/rc.local.]

Start VM
(Note message saying “It seems that you do not have the hardware required to run Unity…”)

Switch to Gnome classic desktop
Disable the screen saver and screen lock, and power management in System->Preferences->Screensaver or do

gsettings set org.gnome.desktop.screensaver idle-activation-enabled false
gsettings set org.gnome.desktop.screensaver lock-enabled false

Disable startup sound in System->Preferences->Startup Applications Preferences->GNOME Login Sound
Disable login sound in System->Administration->Login Screen, and choose “Ubuntu Classic” as window manager
Install updates in Update Manager
Restart Ubuntu

Ensure packages are updated:

sudo apt-get update
sudo apt-get upgrade

Do Devices->Install Guest Additions for copy/paste support. Ignore the message saying “the headers for the current running kernel were not found.”

Install packages:

sudo apt-get install vim chromium-browser eclipse-platform libarchive-zip-perl libtext-csv-xs-perl libxml-simple-perl git-core subversion mercurial ia32-libs conky-all proguard gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z1-dev libgl1-mesa-dev libarchive-zip-perl libfile-find-rule-perl subversion build-essential g++ pkg-config gawk libxml2 libxml2-dev libxml2-utils xsltproc flex automake autoconf libtool libpcre3-dev maven2

Set Nautilus preferences: List view
Set Terminal preferences: Scrolling->Unlimited, Use custom default terminal size: 120 columns, 60 rows
Add the Eclipse and Chromium launchers to the panel
Set up Chrome preferences/sync/authentication, Firefox preferences
Restart Ubuntu

Install Android SDK:

Restart Ubuntu

Install Android ADT Plugin for Eclipse:
Put in Eclipse->Help->Install New Software…
If this step fails with “There are no categorized items” or “There are no items available,” re-run as “eclipse -clean” and try this step again

Set location of Android SDK in Eclipse Window->Preferences->Android->SDK Location

Restart Ubuntu

Start Android SDK and AVD Manager and install all packages (except Real3D by LG, because its download speed is slow)

Install Android NDK

Install Subclipse: Eclipse->Help->Install New Software->

Install EGit: Eclipse->Help->Eclipse Marketplace->egit

Edit ~/.ssh/config (and add keystore as a read-only shared folder):
IdentityFile ~/keystore/github-id_rsa

Set up git:
git config --global "Your Name"
git config --global

Install vim-instant-markdown:
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm
sudo gem install redcarpet pygments.rb
sudo npm -g install instant-markdown-d

Add to ~/.bashrc:

PATH=$PATH:/home/$USER/android-ndk-rXX [where XX is 5c, for example]
export PATH

Add shared folder mount to /etc/rc.local:
sudo mount.vboxsf -o fmode=0777,dmode=0777 eclipse-workspace /home/username/eclipse-workspace/

Configure to log in automatically in System->Administration->Login Screen Settings

Test: Set handset to “PC Mode” and do “adb devices” to check if attached

Add conky to System->Preferences->Startup Applications

Configure conky system monitor panel

Save the following lines as ~/.conkyrc:

background yes
use_xft yes
xftfont 123:size=8
xftalpha 0.1
update_interval 0.5
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent no
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
minimum_size 250 5
maximum_width 400
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color white
default_shade_color red
default_outline_color green
alignment top_left
gap_x 10
gap_y 10
no_buffers no
uppercase no
cpu_avg_samples 2
net_avg_samples 1
override_utf8_locale yes
use_spacer yes
text_buffer_size 256


${voffset -10}
${color DimGray}
${font Arial:bold:size=10}${color Tan1}SYSTEM ${color DarkSlateGray} ${hr 2}
$font${color DimGray}$sysname $kernel $alignr $machine
Intel Pentium D $alignr${freq_g cpu0}Ghz
Uptime $alignr${uptime}
File System $alignr${fs_type}

${font Arial:bold:size=10}${color Tan1}PROCESSORS ${color DarkSlateGray}${hr 2}
$font${color DimGray}Core 1 ${cpu cpu1}% ${cpubar cpu1}
Core 2 ${cpu cpu2}% ${cpubar cpu2}
Core 3 ${cpu cpu3}% ${cpubar cpu3}
Core 4 ${cpu cpu4}% ${cpubar cpu4}

${font Arial:bold:size=10}${color Tan1}MEMORY ${color DarkSlateGray}${hr 2}
$font${color DimGray}MEM $alignc $mem / $memmax $alignr $memperc%

${font Arial:bold:size=10}${color Tan1}HDD ${color DarkSlateGray}${hr 2}
$font${color DimGray}/home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_free_perc /home}%
${fs_bar /home}
/disk $alignc ${fs_used /media/disk} / ${fs_size /media/disk} $alignr ${fs_free_perc /media/disk}%
${fs_bar /media/disk}
/disk-1 $alignc ${fs_used /media/disk-1} / ${fs_size /media/disk-1} $alignr ${fs_free_perc /media/disk-1}%
${fs_bar /media/disk-1}

${font Arial:bold:size=10}${color Tan1}TOP PROCESSES ${color DarkSlateGray}${hr 2}
${color DimGray}$font${top_mem name 2}${alignr}${top mem 2} %
$font${top_mem name 3}${alignr}${top mem 3} %
$font${top_mem name 4}${alignr}${top mem 4} %
$font${top_mem name 5}${alignr}${top mem 5} %

${font Arial:bold:size=10}${color Tan2}NETWORK ${color DarkSlateGray}${hr 2}
$font${color DimGray}IP on eth0 $alignr ${addr eth0}

Down $alignr ${downspeed eth0} kb/s
Up $alignr ${upspeed eth0} kb/s

Downloaded: $alignr ${totaldown eth0}
Uploaded: $alignr ${totalup eth0}

Add .vimrc:

Install Oracle JDK 7:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s