Difference between revisions of "Creating and Managing VirtualBox Virtual Machines"

From Virtuatopia
Jump to: navigation, search
(The VirtualBox First Run Wizard)
 
(5 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
The mechanism for launching ''VirtualBox'' differs depending on the host operating system as follows:
 
The mechanism for launching ''VirtualBox'' differs depending on the host operating system as follows:
  
* '''Linux Host''' - With some desktop environments, VirtualBox will be available from the ''System Tools'' menu. The executable is also located in ''/usr/bin'' and may be launched from by entering ''VirtualBox'' at a terminal window prompt. If ''/usr/bin'' is not currently in the user's $PATH environment variable, the entire path to the executable (''/usr/bin/VirtualBox'') will need to be entered.
+
* '''Linux Host''' - With some desktop environments, a ''Sun xVM VirtualBox'' option will be available from the ''Applications->System Tools'' menu. The executable is also located in ''/usr/bin'' and may be launched from by entering ''VirtualBox'' at a terminal window prompt. If ''/usr/bin'' is not currently in the user's $PATH environment variable, the entire path to the executable (''/usr/bin/VirtualBox'') will need to be entered.
  
 
* '''Windows Host''' - On Windows hosts, VirtualBox can be launched by selecting ''Start->All Programs->Sun xVM VirtualBox->VirtualBox''. Alternatively, the tool can be launched from the command prompt by changing directory to the VirtualBox installation folder (C:\Program Files\Sun\xVM VirtualBox'' by default) and executing ''VirtualBox''.
 
* '''Windows Host''' - On Windows hosts, VirtualBox can be launched by selecting ''Start->All Programs->Sun xVM VirtualBox->VirtualBox''. Alternatively, the tool can be launched from the command prompt by changing directory to the VirtualBox installation folder (C:\Program Files\Sun\xVM VirtualBox'' by default) and executing ''VirtualBox''.
  
* '''Solaris Host''' - With some desktop environments, VirtualBox will be available from the ''System Tools'' menu. The executable is also located in ''/usr/bin'' and may be launched from by entering ''VirtualBox'' at a terminal window prompt. If ''/usr/bin'' is not currently in the user's $PATH environment variable, the entire path (''/usr/bin/VirtualBox'') will need to be entered.
+
* '''Solaris Host''' - With some desktop environments, a ''Sun xVM VirtualBox'' option will be available from the ''Applications->System Tools'' menu. The executable is also located in ''/usr/bin'' and may be launched from by entering ''VirtualBox'' at a terminal window prompt. If ''/usr/bin'' is not currently in the user's $PATH environment variable, the entire path (''/usr/bin/VirtualBox'') will need to be entered.
  
 
* '''Mac OS X Host''' - VirtualBox can be launched by double clicking on ''VirtualBox'' in the Applications folder of the Finder.
 
* '''Mac OS X Host''' - VirtualBox can be launched by double clicking on ''VirtualBox'' in the Applications folder of the Finder.
Line 77: Line 77:
  
  
Before the guest operating system can be installed, it is likely that a CD/DVD drive will need to be configured into the virtual machine. Details on these and other settings relating to VirtualBox virtual machines are covered in the next chapter - [[Configuring VirtualBox Virtual Machine Settings]].
+
== The VirtualBox First Run Wizard ==
 +
 
 +
It may not have gone unnoticed that none of the above steps involved configuring a CD or DVD drive for the virtual machine. This raises the obvious question of how to install the guest operating system.
 +
 
 +
Fortunately, this issue is resolved by the VirtualBox ''First Run Wizard''. This wizard is invoked automatically when a new virtual machine which has a new virtual disk as the boot device (VirtualBox assumes that an existing virtual disk already has a guest operating system installed on it) is started as illustrated in the following figure.
 +
 
 +
 
 +
[[Image:virtualbox_first_run_wizard.jpg|The VirtualBox First Run Wizard]]
 +
 
 +
 
 +
Note that VirtualBox will only display this wizard the first time a virtual machine is run, regardless of whether the guest operating system installation is successful or not. If the installation fails the first time, you will need to know how to manually configure a virtual CD/DVD drive. This topic is covered in the [[Configuring VirtualBox Virtual Machine Settings]] chapter of this book.
 +
 
 +
The purpose of the First Run Wizard is to configure the virtual machine so that it can find the guest operating system installation media. Clicking ''Next>'' on the ''Welcome'' screen displays the ''Select Installation Media'' settings screen as shown in the following figure:
 +
 
 +
 
 +
[[Image:virtualbox_select_installation_media.jpg|Selecting installation media for a new VirtualBox virtual machine]]
 +
 
 +
 
 +
The installation media may be in the form of a physical CD, DVD or floppy installed into a drive connected to the host computer system. Alternatively, the media may be an ISO image file which is accessible to the host operating system.
 +
 
 +
In the case of physical media, select the ''Host Drive'' from the ''Media Source'' section of the screen and select the drive into which the disk has been mounted.
 +
 
 +
When using an ISO image file, the file must first be added to the VirtualBox virtual media library. If the image file has not already been added, click on the button next to the ISO image name to launch the Virtual Media Manager, click the ''Add'' button and navigate to the file. Once the file has been added by the Virtual Media Manager it will appear in the drop down list of files ready for selection.
 +
 
 +
Once the selection has been made, click ''Next>'', review the summary information displayed and click ''Finish'' to boot the virtual machine and begin the guest installation process from the designated media:
 +
 
 +
 
 +
[[Image:virtualbox_running_vm.jpg|WIndows Vista installation in a VirtualBox virtual machine]]

Latest revision as of 18:51, 16 March 2009

Having downloaded and installed VirtualBox on a host computer, the next step is to create and run virtual machines within the VirtualBox environment. Virtual machines may be created and managed using a number of different tools included with the VirtualBox installation. For the the purposes of this chapter, the VirtualBox tool will be used.




Launching the VirtualBox Tool

The mechanism for launching VirtualBox differs depending on the host operating system as follows:

  • Linux Host - With some desktop environments, a Sun xVM VirtualBox option will be available from the Applications->System Tools menu. The executable is also located in /usr/bin and may be launched from by entering VirtualBox at a terminal window prompt. If /usr/bin is not currently in the user's $PATH environment variable, the entire path to the executable (/usr/bin/VirtualBox) will need to be entered.
  • Windows Host - On Windows hosts, VirtualBox can be launched by selecting Start->All Programs->Sun xVM VirtualBox->VirtualBox. Alternatively, the tool can be launched from the command prompt by changing directory to the VirtualBox installation folder (C:\Program Files\Sun\xVM VirtualBox by default) and executing VirtualBox.
  • Solaris Host - With some desktop environments, a Sun xVM VirtualBox option will be available from the Applications->System Tools menu. The executable is also located in /usr/bin and may be launched from by entering VirtualBox at a terminal window prompt. If /usr/bin is not currently in the user's $PATH environment variable, the entire path (/usr/bin/VirtualBox) will need to be entered.
  • Mac OS X Host - VirtualBox can be launched by double clicking on VirtualBox in the Applications folder of the Finder.

When VirtualBox starts for the first time, the following screen appears. Note that the left hand pane contains no existing virtual machines. The next step, therefore, is to create a new virtual machine.

VirtualBox with no Virtual Machines configured

Creating a New VirtualBox Virtual Machine

New virtual machines are created using the Create New Virtual Machine wizard. This wizard is launched by clicking on the New button in the toolbar or selecting the Machine->New menu option. After the Welcome screen has displayed, clicking Next displays the VM Name and OS Type screen illustrated below:


Specifying the name and OS type for a virtual machine


Enter a name which will descriptively and uniquely identify the virtual machine and then select the type of operating system to be installed as the guest in the virtual machine. If the exact operating system is not listed it may not be officially supported (see VirtualBox Supported Host and Guest Operating Systems for a list of supported guest operating systems). Even if the guest operating system is not listed it may still run inside a VirtualBox virtual machine. In this case, select the operating system which most closely resembles your chosen operating system.

Specifying Virtual Machine Memory

The next wizard screen allows the amount of memory to be allocated to the virtual machine to be defined. This is essentially the amount of physical memory installed in the host computer system which is to be made available to the virtual machine. The amount of memory allocated on this screen will depend on a number of factors:

  • The total amount of physical memory installed in the host computer
  • The amount of memory required by the host operating system to operate effectively
  • The amount of memory required by the guest operating system to operating effectively
  • The number of other virtual machines running on the host concurrently with the new virtual machine and the memory requirements of those virtual machines

Memory allocation is configured using the sliding scale control, the maximum value of which is equal to the amount of physical memory installed in the host:


Configuring memory for a VirtualBox virtual machine


Configuring a Virtual Hard Disk

Once the memory for the virtual machine has been defined, the next task is to configure disk storage. VirtualBox provides a number of options for providing disk space for a virtual machine. A detailed overview of virtual disks is provide in the Understanding and Configuring VirtualBox Virtual Hard Disks chapter.

The most straightforward method for providing a virtual machine with disk storage is to either create or use an existing virtual disk image file. A virtual disk image file is essentially a file which resides on, or is accessible to, the file system of the host operating system and acts as a virtual disk drive for the virtual machine. VirtualBox supports existing .vmdk, .vdi and .vhd image files. An existing disk image file may be attached to the virtual machine by clicking on the Existing...' button. Alternatively, a new virtual disk drive can be created using the Create New Virtual Disk wizard by clicking on New....:


Creating a new virtual disk for a VirtualBox VM


The Hard Disk Storage Type screen illustrated above defines the type of the virtual disk drive. The two options available are as follows:

  • Dynamically Expanding Storage - The disk image file is created at a minimal size and then grows automatically as more space is needed by the guest operating system (up to a specified maximum). This has the advantage that disk space on the host is not used until it is needed, but can result in slower performance if the disk needs to be enlarged frequently.
  • Fixed-size Storage - The disk image file is created to the specified size. This pre-allocates all the requested disk space regardless of whether it is immediately needed, but results in improved disk write performance.

Once the storage type has been defined, clicking Next displays the Virtual Disk Location and Size screen:


Specifying the size and location of a virtualbox virtual hard disk


By default, the disk image file will be located in the same folder as the other files relating to the new virtual machine. TYhe disk size is specified using the slider control (up to a maximum size of 2TB).

Click Next followed by Finish to create the virtual disk and return to the New Virtual Machine wizard.

Clicking Next in the wizard displays the Summary screen. Assuming that the information is correct, click Finish to create the new virtual machine. Once the creation process is complete, the new virtual machine will appear in the list pane on left hand side of the VirtualBox window, together with details of the configuration in the Details pane:


A new virtual machine with details


The VirtualBox First Run Wizard

It may not have gone unnoticed that none of the above steps involved configuring a CD or DVD drive for the virtual machine. This raises the obvious question of how to install the guest operating system.

Fortunately, this issue is resolved by the VirtualBox First Run Wizard. This wizard is invoked automatically when a new virtual machine which has a new virtual disk as the boot device (VirtualBox assumes that an existing virtual disk already has a guest operating system installed on it) is started as illustrated in the following figure.


The VirtualBox First Run Wizard


Note that VirtualBox will only display this wizard the first time a virtual machine is run, regardless of whether the guest operating system installation is successful or not. If the installation fails the first time, you will need to know how to manually configure a virtual CD/DVD drive. This topic is covered in the Configuring VirtualBox Virtual Machine Settings chapter of this book.

The purpose of the First Run Wizard is to configure the virtual machine so that it can find the guest operating system installation media. Clicking Next> on the Welcome screen displays the Select Installation Media settings screen as shown in the following figure:


Selecting installation media for a new VirtualBox virtual machine


The installation media may be in the form of a physical CD, DVD or floppy installed into a drive connected to the host computer system. Alternatively, the media may be an ISO image file which is accessible to the host operating system.

In the case of physical media, select the Host Drive from the Media Source section of the screen and select the drive into which the disk has been mounted.

When using an ISO image file, the file must first be added to the VirtualBox virtual media library. If the image file has not already been added, click on the button next to the ISO image name to launch the Virtual Media Manager, click the Add button and navigate to the file. Once the file has been added by the Virtual Media Manager it will appear in the drop down list of files ready for selection.

Once the selection has been made, click Next>, review the summary information displayed and click Finish to boot the virtual machine and begin the guest installation process from the designated media:


WIndows Vista installation in a VirtualBox virtual machine