Creating Virtual Machines with Oracle VM VirtualBox

What is Virtualization?

Virtual machines enable the user to run multiple guest systems on the same computer. This image shows a virtual machine with Windows XP installed, , referred to as the guest system, running on a Windows 7 host machine.

Several years ago, I wrote an article for this site about Microsoft Virtual PC, Microsoft’s implementation of virtualization technology for the Windows desktop. Virtualization software enables a computer to act as a host, running multiple computer sessions with different operating systems for the purpose of testing software, isolating specific programs from the rest of the software on the host machine or maintaining older operating systems as needed after an upgrade. Virtual PC was a somewhat simplified virtualization software which officially supported various versions of DOS and Windows and made the virtualization concept a little more accessible to the average user. With the release of Windows 8, it was succeeded by Hyper-V on machines with the necessary hardware requirements and Windows 8 editions.

Oracle VM VirtualBox

A couple years ago, I decided to start exploring some of the other options for virtualization and stumbled across Oracle VM VirtualBox, Oracle’s free virtualization software which supports many operating systems including Windows, various flavors of Linux, Solaris and OS/2. I played around with it briefly last year, creating a few virtual machines, and then went on to other things but came back to it this past week when I started preparing for one of my latest projects and needed to setup some specialized machines. Since I needed machines I could run on both my Windows 7 and 8 computers, I decided to create them in VirtualBox.

The main screen for Oracle VM VirtualBox. Selecting a virtual machine displays many of its settings in the main window. A thumbnail preview shows a running machine’s current display.

VirtualBox puts more of the information right out there for the user to see than Virtual PC did. Selecting a virtual machine within the main screen shows many of the machine’s settings including the allocated memory, boot settings, storage options, network settings and shared folders. Like Virtual PC, VirtualBox includes a thumbnail preview of any machines that are currently running which is handy for monitoring any processes that are underway. Despite some extra features and settings available for virtual machines, the software shouldn’t be any less accessible than Microsoft’s solution was to anyone who is familiar with the basic hardware options for a desktop PC such as memory, hard disk storage, audio / video settings and network access. Some of the options might require a little research but the average experienced user should be able to start creating virtual machines right away.

VirtualBox is a free download which is licensed under the GPL so it doesn’t cost anything to try out and the installation is very straightforward although there are a few extra prompts for installing Oracle networking components to support the virtual machines. Versions of the host software are available for Windows, OS X, Solaris and different types of Linux.

Creating a Virtual Machine

Once you have VirtualBox installed, it’s fairly easy to create your first virtual machine.

  • From the main screen, select the New icon at the toolbar or Machine >> New from the top menu.
  • The first screen will ask for the name of the new virtual machine and the operating system you plan to use. Remember that you do need to have a valid license for whatever OS you decide to install. Various versions of Windows will require a license key and activation and will not allow you to use the same key on more than one machine for an extended period. This applies to virtual as well as physical machines.
  • VirtualBox will then ask you to allocate some of your computer’s memory to the new machine and will recommend an amount of memory based on the OS that you’re installing. I usually find this recommendation to be low and rarely allocate less than 1 GB to any OS if I can help it. Be careful to leave enough memory for your host machine to operate, however. VirtualBox will warn you if you allocate more than 50% of your physical memory to the virtual machine. You might also want to run more than one virtual machine at the same time depending on what you’re doing so keep this in mind.
  • The next step is to create or select a virtual hard drive. This is a file on your system that contains all the data for your new virtual machine. Virtual PC got me in the habit of using 16 GB as a default so that’s what I start with. If I know I’m going to be installing a lot of extra software on the new virtual machine, I’ll go bigger although it’s easier to resize a virtual hard drive under VirtualBox than it was with Virtual PC so use your discretion. You can also select an existing drive since more than one virtual machine can operate off of the same virtual hard drive if you simply want to apply different machine settings such as memory to the same drive for testing purposes.
  • There are a number of different virtualization software titles, each with their own file format for virtual hard drives. VirtualBox supports many of them, including Virtual PC’s VHD format. If you’re creating a new drive, the next step will ask you to select a file type. I stick with VirtualBox’s native VDI format. You can also select an existing virtual drive from another program to use with a new VirtualBox machine but I’ve had less than stellar results with this so use it with caution.
  • The next option asks if you want the size of the virtual hard drive file to be dynamically allocated so that the file will only use as much space on your host system as needed at the time or fixed so that it immediately reserves the entire amount of space allowed. Choosing a fixed size might provide better performance for your virtual machine but will take up more space regardless of how little data is contained on the virtual machine. On the next screen,VirtualBox asks for the virtual hard drive’s location and size. If you choose a fixed drive size, it will take a little longer to create the file.
In the System settings for a virtual machine, you can change the boot order just as you would on a physical machine as well as the allocated memory. The memory can be changed at any time when the machine is not running.
The Storage settings enable you to add virtual hard drive files and ISO files for the machine to read from. Under the SATA controller in the image above, you can see the virtual hard drive file that is created when setting up the machine.

Installing an Operating System

Once you’ve created the virtual machine, it will be displayed in the VirtualBox Manager and the next step is to install your preferred OS on the machine just as you would with a physical computer.

  • If you click on the Settings icon in the toolbar or select Machine -> Settings from the top menu, you can view all the settings for your new virtual machine. Selecting the Storage option from the Settings panel shows the data storage for the new machine, including the virtual hard drive file that you created earlier. Just like a physical computer, the virtual machine uses virtual controllers to group various types of storage and the IDE controller can hold options for an optical disk such as a CD drive or an ISO disk image file.
  • Select the empty slot under the IDE controller and then click on the CD icon next to the CD/DVD Drive under Attributes. Here, you can select the CD drive on your physical machine or an ISO file that contains the installation disk image which the virtual machine will treat like a physical disk. Many versions of Linux are distributed in ISO files.
  • Under the System section on the Settings panel, you can set the boot order for the virtual machine in order to boot from the CD. Alternately, you can press the F12 key when the machine first starts to access the machine’s boot menu.
  • After selecting the installation disk and boot settings, simply close the Settings panel and start the new virtual machine by double-clicking on it in the VirtualBox Manager or clicking on Start in the toolbar. If you’ve set everything up right, the machine should start and run the OS or its installation.

Once the installation is finished,  you can remove the ISO or CD from the virtual machine from the menu in the machine itself or by going back to the Settings / Storage panel and selecting a different item for the CD / DVD drive setting.

After your virtual machine has been setup, you’ll find that you can do almost anything with it that you could do with a normal physical computer, even running system utilities like disk defrag and optimization routines, although they might not accomplish much. You might find the occasional software that doesn’t run the same, or at all, on a virtual machine but that’s only happened once or twice for me.

An installation of Linux Mint in a new VirtualBox virtual machine.