Tuesday, August 18, 2009

Entering Linux World with VirtualBox

Though I have worked with Linux earlier, it hasn't been so intense as in my current job.
So I thought I would use Virtualization techniques to keep closer to my Desktop environment for my personal sandbox purposes.
I have chosen Sun VirtualBox & Ubuntu 9 Desktop to be my companions.

To achieve:
I have a Windows Vista PC and I want to install Ubuntu Linux as a Guest OS. In VirtualBox terms, the base OS is called a HOST and every new OS you want to virtualize(install) is a GUEST.
Basic Steps:
  1. Download & Install VirtualBox from http://www.virtualbox.org/
  2. Download Ubuntu ISO image from http://www.ubuntu.com/getubuntu/download
  3. Create a new Guest for Ubuntu on VirtualBox
  4. Load the ISO and install.
Virtual Box Additions:
  1. Load VBoxGuestAdditions.iso from VIRTUALBOX_HOME to the Guest and reboot.
  2. In the Guest Ubuntu, goto /media/cdrom0 and run VBoxAdditionsx86.run. This will install all the additions virtualization packages.
  3. You can make shared folders from host available to the guest either manually or during startup (http://www.giannistsakiris.com/index.php/2008/04/09/virtualbox-access-windows-host-shared-folders-from-ubuntu-guest/)
Java Env Setup:
Accessing Apps running on the Guest OS:

My very intention of installing Linux as a Guest OS was to try out it server features. That being the case, I wanted to run servers in the Guest OS(Linux) and make them available to the outside world via my Host OS(Windows).
For this instance, I have started ssh server and apache server on the server and wish to externalize them. Here is how you can do it.

C:\>  cd "\Program Files\Sun\xVM VirtualBox"
VBoxManage setextradata ubuntu-desktop "VBoxInternal/Devices/pcnet/0/LUN#0/Config/cherokee/HostPort" 8888
VBoxManage setextradata ubuntu-desktop "VBoxInternal/Devices/pcnet/0/LUN#0/Config/cherokee/GuestPort" 80
VBoxManage setextradata ubuntu-desktop "VBoxInternal/Devices/pcnet/0/LUN#0/Config/cherokee/Protocol" TCP

VBoxManage setextradata ubuntu-desktop "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage setextradata ubuntu-desktop "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata ubuntu-desktop "VBoxInternal/Devices/pcnet/0/LUN#0/Config/ssh/Protocol" TCP





References: http://imshengh.spaces.live.com/blog/cns!9F02E6E8FFC2ED09!379.entry