Introduction: How to Setup a Virtual Machine?

Picture of How to Setup a Virtual Machine?

This brief Instructable will guide you through the steps needed to install and run a "guest OS" on a virtual machine inside your PC.

Step 1: Getting Your Virtualization Client.

Picture of Getting Your Virtualization Client.

There are several notable applications out there which allow you to setup a virtual machine inside your PC. Microsoft has its own client that can run Windows guest operating systems, but it isn't very good. The 2 renowned applications for this purpose are:

1) VMWare Player/Workstation
2) VirtualBox

With reference to VMWare Player, it is a free product, but leaves out on several crucial features which are a must-have. VMWare Workstation provides these features, but it costs $50 so this puts many people off.

On the other hand, VirtualBox (see home-page) is open-source (i.e. free), is highly customizable, has a very easy user interface and works flawlessly. So I would heavily recommend going with this.

You can download it from here:

After downloading, install it as you would install any other basic application, there is nothing out of the ordinary here.

Step 2: Getting Started & Specifying Memory Allocation

Picture of Getting Started & Specifying Memory Allocation

After installing it, fire up VirtualBox from the start menu. You will be greeted with a very simple User Interface. Click on "New" on the top-left to get started.

- The Virtual Machine Wizard will start, click "Next" to continue.

- Type a name for your VM, for example "My VM"

- Below, select the type of Operating System you wish to install on the virtual machine (for XP for example, select "Microsoft Windows" from the OS type and "Windows XP" from the version)

- Now you get to specify the amount of RAM you want to allocate to the VM. How much RAM you should allocate depends on 2 factors: First, which OS you intend to run on the VM, and secondly, how much total RAM you have (to find out that, check the Properties from My Computer). For a Linux distro, 512MB should be comfortable. For something like Vista or Windows 7, nothing less then 1GB will do (2GB recommended). Note that you shouldn't allocate more then 50% of your total RAM for the VM or there is a chance that the VM may freeze while it is running due to low host memory. I personally have 2GB RAM so I allocated 768MB to my XP install.

Step 3: Creating a Virtual Hard Disk

Picture of Creating a Virtual Hard Disk

After that, you need to create a virtual hard-disk to install your VM in. Now don't start panicking you don't need a separate partition for this or anything. Basically, this "virtual had disk" will be nothing more then a single file with a .vdi extension that you can place anywhere. So, check the "Create new hard disk" option and click "Next", the hard disk wizard should start, hit "Next" again.

- Next you get to specify the type of hard-disk you want to setup. Here's a brief description of the both types:

Dynamically Expanding Storage: In this type of storage, you specify a maximum size (you do that in the next step) but the vdi file doesn't take up that much space on your disc immediately. instead it will expand as your virtual machine demands more space. However, the expansion will (obviously) stop once the maximum specified size is reached.

Fixed Storage: The title says it all. You create a virtual hard-disk and it takes up that much space instantly.

I'd personally recommend the Dynamically expanding option, since it saves disk space. Either way, check the desired option and hit "Next"

- In the "Location" field, type a name for your virtual hard disk (this is basically the name of the vdi file which will be created). Be default, this file will be created in your system drive in a separate folder. If you want to save it somewhere else, click on the on the yellow folder icon beside it and specify a location and file name.

You also need to specify the maximum size of your virtual hard disk. This is entirely dependent on the amount of free disk space you have, and the amount of hard disk space you think will be used. As a rough guide, 2GB space is enough for a Linux install, 3GB for XP, 6GB for Vista and 10GB for Windows 7. Of course if you plan to store more files you will need more space.

- Click "Next". VirtualBox will give you a chance to review the specs of the HD. If you are satisfied with them, click "Finish", or go back if you want to make any changes.

- Click "Finish" and you're done!

Step 4: A Few More Things.

Picture of A Few More Things.

Now that the wizard is complete, the virtual machine should appear in the left pan of the VirtualBox Window. But before firing it up, its best to change the settings to your liking. Select the VM, and click on the "Settings" button.

As you can see in the General tab, only 4MB of video memory has been allocated to the VM! This might be enough for Linux and XP but Vista or Windows 7 will surely starve on this! You need to raise this number. Generally, 128MB should be enough for XP or Linux (though 256MB is recommended for Vista and Win 7). Also check the "Enable 3D Acceleration" option below if you have a decent graphics card.

Next, click on the "CD/DVD ROM" tab. You need to specify the bootable disc or ISO from which you plan to install the OS on the VM. Check the "Host CD/DVD Drive" to install from an install disc, or else select the second option for install from an ISO file on your PC (specify the ISO's location as well). Click "OK" to save the settings.

Now you're really done!

Select the OS from the left pane and press the "Start" button. The VM will start in a separate Window. From here on in, it should work like it does on a real PC, so install the OS normally.

Once installed, you may have noticed the OS is only appearing on a small window. To get around this problem, you have to increase the resolution (which, by default is 640x480). Once done, press Ctrl+F to go into full-screen mode. Press the same key combination again to exit full-screen mode.

Step 5: Installing Guest Additions and Other Miscellaneous Options

So now your VM is up and running, but wait, there's more functionality you can add, like in Linux, the maximum possible screen resolution is only 800x600. You can increase this by installing "Guest Additions". To do this, go into the "Devices" menu of the VM Window and click "Install Guest Additions". A 20MB ISO will download itself onto the desktop of the guest OS. Upon opening this, you will find executables for all OSes and all types (32-bit and 64-bit). Run and install these.

Another thing which you can do is that you can access files which are stored outside the VM. To do this, you first need to shut-down the guest OS. Then go into its settings --> Shared Folders tab, and add folders which you want to share.

Yet another interesting feature is seemless mode, which merges both your host and guest OS. (Press Ctrl+S to activate this).

For troubleshooting and getting more help, visit the VirtualBox forums


Arbitror (author)2009-07-07

The maximum possible screen resolution is not only 800x600 for Linux. Try openSUSE.

Ali_Athar (author)Arbitror2009-07-11

Probably depends on your monitor size as well. Mine is a 19" CRT, anyway, installing Guest Additions is a painless task that's very beneficial.