Wednesday, December 11, 2013

Setting up Bitnami tomcat stack on VirtualBox on OSX 10.9 (Mavericks), with a shared folder

I had such a hard time getting the Bitnami Tomcat stack to run on the latest VirtualBox (4.3.4), and especially with adding shared folders. I was all day long retrying over and over. Sheesh. These are the magic steps I took, recorded here in hopes that it can save someone else some time.

Creating the bitnami stack on OSX

Install (a couple of times until it works, dagnabit) a new version of virtual box from

Download the bitnami tomcat vm image from (the folder contains bitnami-tomcatstack...vmdk)

When starting a new virtual box image, pay attention to settings here:
  • type: Linux
  • version: Ubuntu (64 bit)
  • Use an existing virtual hard drive file (that bitnami-tomcatstack...vmdk file mentioned earlier)
  • Create ->
  • In settings, for Network, select Attached to: Bridged Adapter 
  • Press the big Start arrow
Shortly a new linux console will be running, with mysql, apache, tomcat, whooopee!

On first login “bitnami” with password “bitnami”. Your first login will force you to select a new password.

For java tools, I added this to ~/.bashrc
export JAVA_HOME
To verify the success, look in your local mac browser for the tomcat server at the address presented on the VM console (in my case “You can access the application at ***”)

Getting a shared folder that is ~/Desktop on both host and client (via Guest Additions):

1) download VBoxGuestAdditions_4.3.4.iso from here:

2) Then in virtual machine
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install dkms
$ sudo reboot
3) then (partially from
$ uname -a ### to get kernel version, e.g. 3.2.0-53-virtual
$ sudo apt-get -y install dkms build-essential linux-headers-3.2.0-53-virtual
$ sudo reboot
4) use VBoxGuestAdditions.iso stuff from the vbox menu Devices -> CD/DVD Devices -> Choose a Virtual CD/DVD… as found at to select “VBoxGuestAdditions.iso” (wherever you downloaded that to in step 1)
$ sudo mkdir /mnt/cdrom
$ sudo mount /dev/cdrom /mnt/cdrom
$ cd /mnt/cdrom
$ sudo sh ./ --nox11  # ignore “could not find…” error
5) Recreate (or update or something) the VB guest addition modules:
$ sudo /etc/init.d/vboxadd setup
$ sudo reboot
6) In the VB menu Devices -> “Shared Folders Settings...” set up ~/Desktop to be shared (auto-mounted, permanent,  and r/w) as “Desktop”

7) Mount that Desktop menu that was mounted 23r2
$ mkdir ~/Desktop
$ sudo mount -t vboxsf ~/Desktop Desktop
8) In theory I should have been able to make that mounting automatic, even after reboots, via an entry in /etc/fstab but I was never able to get that working. So in the end, to get the mounting happen each time I log in, I added this line to ~/.bashrc
sudo mount -t vboxsf ~/Desktop Desktop
Not that from the VM side, ~/Desktop is read-only for the bitnami user, and so “sudo” must be used for a bunch of the commands to read and copy files and such.

SSH to the bitnami machine

On the bitnami shell:
$ sudo mv /etc/init/ssh.conf.back /etc/init/ssh.conf
$ sudo start ssh
On my mac:
# ssh bitnami@

That's what worked for me. Good Luck!