4.28.2011

VirtualBox Usage Note

Environment:
OS: CentOS 5.6
VirtualBox Ver: 4.0-4.0.6 (RPM)
VM Name: Windows XP


Assumption:
  • You have installed Development Tools and Library (yum -y groupinstall "Development Library" "Development Tools" 
  • You have installed kernel-devel package (yum -y install kernel-devel), please make sure the installed kernel-devel version is matched with your kernel version.
Install Kernel Modules

  1. "/etc/init.d/vboxdrv setup" #Please make sure you have installed kernel development rpms



Console Start VM:

  1. VBoxManage startvm 'CentOS-5.6' (optional: --type headless , this option make VM Guest run safer in background)
Console Stop VM:
  1. Power off -- VM guest will shutdown immediately, just like pressed power button
    command: VBoxManage controlvm 'CentOS-5.6' poweroff
  2. Save State -- System will save the VM guest State in "~/VirtualBox VMs/Windows XP/Snapshots", if you want to backup the VM guest please make sure you have backup the whole 'Windows XP' directory. In this state you won't allow change the VM guest settings.command: VBoxManage controlvm 'CentOS-5.6' savestate
  3. ACPI off -- System will send ACPI poweroff signal to VM guest (You must install VBox Guest Additions Package)
    command: VBoxManage controlvm 'CentOS-5.6' acpipowerbutton

    If you found that VM Guest can't shutdown, please make sure the x-windows/gnome is not running. (Actually "gnome-power-manager" is not running.)

    OR
    Make sure you VM Guest can receive shutdown signal (you can check /var/log/acpid), Run 
    "nano /etc/acpi/events/power.conf" and change action to "action=/sbin/shutdown -h nowthen try again. (The acpi config file path is used for CentOS only)

Install Virtual Box Guest Additions Package
  1. Please make sure you have installed all package which described in assumption section.
  2. Mount Guest Additions Disc ( Press Devices -> Install Guest Additions or Host + D )
  3. In VM guest, mount /dev/cdrom /media
  4. cd /media
  5. ./VBoxLinuxAdditions.run
  6. reboot (restart VM Guest)
  7. If it doesn't work please check the /var/log/vboxadd-install.log to find out what is the problem and run "/etc/inti.d/vboxadd setup" to reinstall the package
Remote Desktop Server Port

  1. Please download "VirtualBox Extension Packages" form VirtualBox website (Link)
  2. Add the Extension Pack to VirtualBox,  "File" -> "Preferences" -> "Extensions" -> "Add Package"
  3. Enable Remote Display, Stop VM -> Settings -> Display -> Remote Display -> tick "enable Server", enter server port (e.g. 3391)
  4. Config firewall enable prot 3391


Reference
Chinese Reference
Reference: Convert VDI <=> VMDK/VHD