~~ The Basics
Recently I wanted to look at some of the latest versions of Linux that were available in hopes to provide more podcasts. But I did not want to have to have multiple hard drives or some special boot manager required reboots to see each one. In fact I wanted to use some of the OSes at the same time on the same computer using virtualization technology. By using VMWare Player and another tool like QEMU, I was able to get an operating system up and running in five minutes. This of course was minus the time to download the files and install but once everything was set up I could create new installs VMWare sessions in only minutes.
~~ The VMWare Solution
VMware Player is the perfect free solution to let you evaluate new or pre-release software contained in virtual machines, without any installation or configuration hassles. You can also share existing virtual machines with colleagues or friends or carry with you on a USB thumb drive/disk. Just use VMware Player to run any virtual machine within your existing Operating System.
A virtual machine is a computer defined in software, basically like running a PC on your PC. VMware Player runs any virtual machine created by VMware Workstation, GSX Server or ESX Server. VMware Player also supports Microsoft virtual machines and Symantec LiveState Recovery disk formats.
QEMU is a generic and open source processor emulator which achieves a good emulation speed by using dynamic translation. QEMU has two operating modes:
-- Full system emulation. In this mode, QEMU emulates a full system (for example a PC), including a processor and various peripherials. It can be used to launch different Operating Systems without rebooting the PC or to debug system code.
-- User mode emulation (Linux host only). In this mode, QEMU can launch Linux processes compiled for one CPU on another CPU.
~~ The Operating System
At this point you can use any operating system you wish, be it Windows XP or a Linux one like SuSE or Ubuntu. For this example we will be using the latest version of Ubuntu 6.10 located at: http://www.ubuntu.com/
~~ Getting Started
1) Download VMWare Player from: http://www.vmware.com/products/player/ and install.
2) Download QEMU on Windows from: http://fabrice.bellard.free.fr/qemu/download.html and install.
3) Download the latest ISO of Ubuntu from: http://www.ubuntu.com/ or whatever OS you wish to try.
~~ Creating the VMDK File (the hard way)
VMWare has appliances that you can download for free located at: http://www.vmware.com/vmtn/appliances/
I have tried a lot of these but there can be problems when they are not created right or have not been updated lately. But some people like to use the virtualization appliances as their base image and just wipe the existing OS on it. You can do this by downloading an appliance and then adjusting the .vmx file that comes with it. Open up the .vmx file in Notepad and look for lines that look like:
ide1:0.fileName = "auto detect" ide1:0.deviceType = "cdrom-raw"
And replace them with lines like:
ide1:0.fileName = "C:\targetcd.iso" ide1:0.deviceType = "cdrom-image"
Where "targetcd.iso" is the new Operating System ISO you wish to use. Then boot up the VMWare Player and boot to the CD. This will then allow you to overwrite the existing appliance OS with your new OS. Of course you are limited to the size of the VMDK file.
~~ Creating the VMDK File (the easy way)
Due to how hard it is to use existing VMDKs, it might just be easier to create your own install instances. You can use QEMU since it is a lot easier to create a specific sized file. For my test I created a ten Gig VMDK file to install my operating system on. Now you can make smaller files especially if you want to keep the OS small enough to put on a thumb drive but just make sure when you do the OS install that you keep it limited enough so you can fit within the smaller file. The file will only grow as you use it, so do not worry about creating large files. Using a DOS window I went to the folder where I installed QEMU and ran this command:
qemu-img.exe create -f vmdk Ubuntu610-test.vmdk 10G
In seconds it created the necessary file. I created an appliance folder under My Documents and moved the test VMDK into a folder there called Ubuntu610.
~~ The VMX File
The VMX file is a required file for VMWare to work. It basically contains the configuration settings for your VMWare instance. Within this folder I then created file called Ubuntu610-test.vmx and opened it with Notepad. Inside I pasted the following information:
config.version = "8" virtualHW.version = "3" ide0:0.present = "TRUE" ide0:0.filename = "Ubuntu610-test.vmdk" memsize = "256" MemAllowAutoScaleDown = "FALSE" ide1:0.present = "TRUE" #ide1:0.fileName = "auto detect" #ide1:0.deviceType = "cdrom-raw" ide1:0.fileName = "--path-to-ISO-image--" ide1:0.deviceType = "cdrom-image" ide1:0.autodetect = "TRUE" floppy0.present = "FALSE" ethernet0.present = "TRUE" usb.present = "TRUE" sound.present = "TRUE" sound.virtualDev = "es1371" displayName = "Ubuntu 6.10 Test" guestOS = "Ubuntu" nvram = "Ubuntu610-test.nvram" MemTrimRate = "-1" ide0:0.redo = "" ethernet0.addressType = "generated" tools.syncTime = "TRUE" ide1:0.startConnected = "TRUE" uuid.action = "create" checkpoint.vmState = ""
Now you need to adjust the following lines:
-- "ide0:0.filename" to the name of your VMDK file that you created. -- "memsize" to the memory size you wish to allocate to your VMWare virtualization instance. If you can afford 512 or 1GB set it otherwise at least give 256 or 192 mb. -- "ide1:0.fileName" replace --path-to-ISO-image-- to the location of where the ISO you download is. Like: C:\Documents and Settings\User\Desktop\Ubuntu610.iso -- "displayName" to the name you want displayed. -- "guestOS" to the version of OS you are installing. -- "nvram" to the name of the nvram file which is usually the same name as your VMDK file.
I then saved the file.
~~ Booting VMWare Player the First Time
Now I just started up the VMWare Player, browsed to the appropriate instance I wanted to start, selected the file, and hit Open. VMWware Player then booted up. It detected that the CD rom had a bootable ISO in it and started the Ubuntu install. Once Ubuntu loaded, I selected "install" off its desktop and proceeded to install the OS into the VMDK file. After the install I updated for latest security patches and other application. Rebooted and then I was up and going.
~~ A Different OS
Now with this setup it is easy to use QEMU to create another VMDK file and after downloading another Linux ISO, create a new VMX file and then boot VMWare Player to my new ISO and install. In less than 5 minutes I am able to install any OS that I want. Additionally I can back up the VMDK and VMX files and take them with me to work or other computers.
~~ Uses of VMWare Player
Probably the best reason I can see using VMWare Player like this is to create a mini OS virtualizations that can be used for Browsing the web. You would do this so that anything that was downloaded or done on the mini OS would not affect your primary desktop OS. This would protect you from spyware, viruses, etc to some extent.
Also these VMDK files are compatible with all VMWare programs. So if you set up VMWare Server that we talked about in our previous podcast you can use it there.