Creating a Debian VirtualBox VM

Posted: January 7th, 2011 | Author: | Filed under: Debian, Mac, Virtual Box | Tags: , , , , , , , , | No Comments »

In the past, I used to use Parallels 5 for my VM needs (and I still do). Recently I have found out that in order to install the Parallel Guest Tools on the latest Ubuntu (10.10); I have to upgrade Parallels from version 5 to 6. Since Ubuntu updates every 6 month, it means that there is a good chance that I have to update Parallels every year on order for the latest version of Ubuntu to work. I have decided to check out VirtualBox and see how well it works with my Development environment.

To create a basic Debian VirtualBox image:

  1. Grab the latest netinst image
  2. For typical development use, I don’t think one will use more than 8GB of disc space.
  3. Use the Guided hard disc setup and use the whole drive
  4. Deselect everything else and only install Standard System
  5. Install GRUB to your bootloader
  6. Go through the system setup and reboot
  7. Install OpenSSH server by apt-get install openssh-server
  8. Run apt-get upgrade
  9. Run apt-get update
  10. Do a ACPI Shutdown via the Machine menu or run shutdown now
  11. Edit the VM’s Settings via the Oracle VM VirtualBox Manager
    I typically set:

    • Hardware clock in UTC time. This is to make sure that clocks are in sync so things like ssh won’t misbehave.
    • Disable Audio
    • Change Network -> Adapter 1 -> Attached to: Bridged Networking
    • Disable the Ports (both serial and USB)
    • Leave Shared Folders option unset, I just use SSH for everything.
  12. Reboot, Login
  13. Run ifconfig, the ip address will now be in your home network’s subnet (for me it is 192.168.123.0). So you can ssh into the machine via ssh username@ipaddress
  14. Shutdown again and select Export Appliance under File in the VirtualBox Manager. Now, whenever you need a debian vm, you just have to import the appliance. At this stage. I also highly recommend you take a snapshot of the image before you do any tinkering.
  15. Start the machine again, if you want to give the vm a static IP run nano /etc/network/interfaces
    Replace

    1
    2
    allow-hotplug eth0
    iface eth0 inet dhcp

    with (IP Address and Gateway adjusted to taste)

    1
    2
    3
    4
    5
    6
    iface eth0 inet static
           address 192.168.1.10
           netmask 255.255.255.0
           network 192.168.1.0
           broadcast 192.168.1.255
           gateway 192.168.1.1

    Run /etc/init.d/networking restart

  16. Next time, you can start the Virtual Machine via commandline by using VBoxHeadless -startvm “machinename”

Upgrading VirtualBox 3.1 -> 3.2 on Ubuntu 10.04

Posted: July 19th, 2010 | Author: | Filed under: Ubuntu, Virtual Box | Tags: , , , , , | No Comments »

Assume: you have VirtualBox (OSE / non OSE) 3.1 installed. You also have sudo rights.
Note: OSE version doesn’t have RDP support, non OSE has RDP support.
VirtualBox files are usually stored in: /home/username/.VirtualBox/ directory with HardDisks and Machines sub directories. (A backup is always a good idea before an upgrade!)

    Upgrade Steps:

  1. Shut down your existing VMs. I find if you are using VBoxHeadless, the process might not end after the VM has been shutdown.
  2. Quit VirtualBox GUI (if running); kill all VBoxHeadless processes.
  3. Use dpkg -remove packagename or Synaptic Package Manager to remove your exisiting installation. (Synaptic is probably easiest since you don’t need to look up the package name). Even if you remove the package your existing VMs will still be around, but it never hurt to do a backup before hand!
  4. Locate your VirtualBox 3.2 .deb package.
  5. Install via dpkg -i debfilelocation
  6. VirtualBox Guest Additions are located in /usr/share/virtualbox. You have to manually mount the Additions in the virtual machines. I find it the quickest to edit the setting via the VirtualBox GUI
  7. Restart VirtualBox, and run the Guest Addition updates.
  8. Stop the VMs and launch them via VBoxHeadless if so desired.

Configuring VirtualBox for useful Windows Guests.

Posted: May 20th, 2010 | Author: | Filed under: Virtual Box | Tags: , , , , , | No Comments »

I find VirtualBox 3.1 is quite mature and usable for everyday. Granted, I only use my Windows sessions via RDP and all of them are in 2D applications. VirtualBox has graphics acceleration, build in RDP viewer (even for pre XP computers). The only thing that is really missing is the clone functionality, but hey it is free and I am sure someone is working on it!

Here are a few tips to make things more useful (especially for people who are remote accessing the Guest OSes).

  1. Set default GUI resolution of Guest OS to any:
    This way you can RDP into the virtual machine at any resolution you like.
    Run the follow command in Terminal:

    1
    VBoxManage setextradata global GUI/MaxGuestResolution any
  2. You only need to enable RDP on pre XP Windows or non Windows Guest:
    Remember the IP address you have to RDP into is the host machine (in my case the Ubuntu machine). Also each VM Guest has to have a unique Server Port.
  3. If you want GuestOS to be accessible on the network remember to set it to bridged mode.
  4. If you feel the Windows GuestOS network performance is too slow.
    Try the virtio drivers.
    However chances are you might need to reactivate the Windows Genuine Advantage, if you are changing it once the GuestOS has been setup. YMMV.
  5. Get to know the VBoxHeadless command.
    Typically it is

    1
    VBoxHeadless -startvm "machinename"

    Note: VRDP is enabled by default, so for post XP machines you would want to add –vrdp off

Remote Display Settings for VirtualBox 3.1.8

Remote Display Settings for VirtualBox 3.1.8

Paravirtualised Virtio network driver settings for Virtualbox

Paravirtualised Virtio network driver settings for Virtualbox