Announcement

Sunday, November 01, 2009

Installing (K)Ubuntu as guest os in Virtualbox

So far I mainly used Windows machines as development machines as well at home. Recently I have started experimenting with Ubuntu linux. Hence I wanted to install Ubuntu as Guest os on VirtualBox.  However I faced few problems (like when maxium screen size was set to 800x600 and it took some time to figure out how enable screen size change). Hence i wrote down the steps that worked for me.

This is configuration that i used.
    Host OS : Windows Vista
    Guest OS : Kubuntu 8.1
    Virtualbox version 3.0

Install Kubutu in VirtualBox
  1. Create a new VM (lets name it 'Kubuntu') in the Virtualbox
  2. Mount CDROM drive. 3. Put the Kubuntu CD in the drive OR Mount Kubuntu ISO image as drive
  3. Start new VM (Kubuntu)
  4. Kunbuntu Install CD will be detected. Proceed with installation.
  5. Basic Kunbuntu installation is done.
  6. Now you should be able to 'boot' to Kubuntu.
Now you need to install Guest Additions for this guest OS so that we can  share files across host and guest os, change screen size etc.

Installing Guest Additions
  1. Goto 'VirtualBox->Device->Install Guest Additions'.
  2. If there is already mounted CDROM drive, this will not work. Unmount the CDROM drive.
  3. Then Goto menu 'VirtualBox->Device->Install Guest Additions' again. Select the 'VBoxGuestAdditions.iso' image and mount as device.
  4. You will get a 'device list' in the Kubuntu guest os.
  5. Select the 'virtualbox' device for installing the 'guest additions'.
  6. In the Kubuntu, run 'konsole' to start the terminal window
  7. run 'cd /media/cdrom0' (or wherever the cdrom VBoxGuestAdditions.iso is mounted to)
  8. run 'sudo sh ./VBoxLinux-x86.run'. This will install Guest Addition kernel modules.
  9. Reboot the guest os.
  10. Now guest additions are installed.
Reconfiguring Display size
  1. By default display size is set to 800x600 under VM. That is the maximum size set.
  2. Shut down the guest os and exit from Virtualbox.
  3. Goto virtualbox installation directory in the Host OS(Run 'cd ')
  4. Run 'VBoxManage setextradata global GUI/MaxGuestResolution 1200,800' from command line. Replace '1200,800' by whatever resolution supported by your computer.
  5. Start Virtual box and start the Kubuntu VM.
  6. Click 'Machine->Auto Resize Guest Display' menu
  7. Now Minimize/Maximize VM Window. Internal Kubuntu desktop window will now get resized.
  8. In Kubuntu, goto Application Laucher 'system settings->display'. Change the display size to the size you want and apply.
  9. Now next time when you start Kubuntu VM, you may just have to do the step 6 and 7.
Installing Development setup

  1. Run 'sudo apt-get install linux-kernel-headers'
  2. Now your basic compiler setup is done.
  3. You may want to download other softwares like CodeBlocks IDE.
  4. Run 'adept' package manager.
  5. Search 'Code blocks', Python etc. Click on 'Install' and then select 'Apply Changes' from Adept menu.
Now your setup is done. Create a 'Snapshot' of current VM. So that you can revert to known setup if required.

Sharing Files between windows host and linux guest.

  1. On Windows, create folder (e.g. c:\shared).
  2. Goto VirtualBox->Devices->Shared Folder and add the created folder. Give a name to the folder (e.g. 'shared')
    OR
    Run command 'vboxmanage sharedfolder add "Kubuntu" -name "shared" -hostpath "c:\shared"'  Kubuntu is VM name.
  3.  Goto Guest os and run following commands
    cd $HOME
    mkdir shared
    sudo mount -t vboxsf shared $HOME/shared

Now you can access the 'shared' folder from both windows and linux
  

If these steps help you or if you find any mistakes/want to suggest any improvements, please write a comment.