I’ve just been setting up Ubuntu as a virtual OS in my Windows machine using Sun Virtualbox. I did run into a couple of problems initially, so I’m listing out the steps involved in acse somebody else needs some help with the same.

Downlaod Virtualbox from here and install it. You will obviously need Ubuntu as well, and you can get the Ubuntu ISO from here.

Open Virtualbox and click on new to set up a new virtual machine. On clicking next, you will be prompted for the following details: operating system — Linux, version — Ubuntu, and name for the virtual machine, e.g. “ubuntu”.

In the next setting, set the base memory size. The recommended value will already be selected, but you can increase it a little if you have a lot of memory. (I set 512MB on my 2G machine.)

Now you’ll be prompted for a virtual hard disk, and since you haven’t already created one, select the option to created a new virtual hard disk. Set the storage type to “dynamically expanding”. Set the location, and the size to something like 8GB and click finish.

Now that you’ve created the VM and the virtual hard disk, you need to install Ubuntu. For this right click on the VM in the sidebar and go to settings. Here, in the storage tab, click on the CD/DVD icon and set the ubuntu installation CD ISO as the device. (Use your CD/DVD drive as the device if you’re installing from a CD and not from ISO.)

On starting the virtual machine, the CD gets booetd, and you can now install Ubuntu into the VM as you would do in case of a normal Ubuntu installation. Once installed, you can use this VM to boot into Ubuntu.

Since I work mostly on ruby, needed to install a ruby and rails environment on the virtual machine. I’m not going to post all the steps here, but there’s an awesome post on setting up a ruby and rails environment on Ubuntu on hackido.com.