It is sometimes useful to have one or more VMs of Ubuntu running on your native Ubuntu installation. For example, this can be useful for testing your code under certain software environments. One of the easiest ways to run VMs on Ubuntu is using VirtualBox.
It is pretty straightforward to setup a Ubuntu VM in VirtualBox. The only problem is to install Ubuntu from its ISO file into the VM. To do this, VirtualBox has to see the ISO file as a DVD disk that has been mounted from a (virtual) DVD drive. To do this:
Right-click on your VM and choose Settings > Storage > IDE Controller > Add CD/DVD Device.
Click on Choose disk and point it to your Ubuntu ISO file.
Now start the VM. it will boot from your ISO file and you can proceed with your Ubuntu installation on your VirtualBox.
Tried with: VirtualBox 4.1.12 and Ubuntu 12.04 LTS