Using VMware Player to Create Images for New Virtual Machines
In two previous tutorials, you have learned how to install smaller and lighter Apache alternative for your desktop — nginx and lighttpd. While they are more than enough to satisfy the need of theme designers and plugin developers, some people prefer to have a full-blown server running for a few reasons.
The most obvious reason is server compatibility for which code will be deployed on. While the WLMP and WEMP are much like running your own server, there are issues like file and directory permissions that are not compatible between Linux and Windows.
The former is more widely used because of its efficiency and performance as a web server.
With current technology, it is possible for you to run different types of operating system, even at the same time if you have the resources, on a desktop machine.
So, that saves quite a bit on power and server cost.
Another great thing is that nowadays virtualization software are available for free. While there are more advanced versions that require payment, for starters the free version is more than enough.
VMware Player is one example. It is based on the lines of products released by VMware, including VMware Workstation and VMware Server. For blog designers and developers, VMware Player is more likely the choice. VMware Server is also free but more suitable for server environment.
Download VMware Player
You should at least read the overview and various documentations before downloading and running VMware Player, if this is your first time to install it.
For many people, including bloggers, virtualization is a relatively new concept. It is important to understand at least the basic before you try to run it.
Although the software is straightforward to install and run, it still involves some learning curve. You should be prepared for this, but not to the level that you resist it. This is something that will benefit you more as you get familiar with it.
With that said, here is the link that leads you to the overview page for VMware Player. The download button is above the fold, but please read the overview first!
Problems with VMware Player and Possible Solutions
VMware Player, as the name implies, runs virtual machines on your Windows or Linux desktop created by VMware Workstation, VMware Fusion, VMWare Server of VMware ESX. It is also capable of running Microsoft Virtual Server and VIrtual PC virtual machines.
The limitation is, you can’t create a new virtual machine from scratch with it. VMware Workstation is the product line that supports that. Currently, VMware provides a lot of ready-made virtual appliances for you to use.
Fortunately, there are hacks that allow you to bypass that limitation in VMware Player.
In this tutorial, I’m going to show you how to create your own virtual machine using VMware Player so you can install your chosen operating system, such as Windows, Linux or even BSD on top of it from scratch.
You may also pick the Linux distribution to install so you may experience different Operating Systems (OS) before deploying on your production server or virtual private server.
A VMware’s virtual machine consists of two main parts:
- A virtual machine image / disk (.vmdk)
- A virtual machine configuration file (.vmx)
Let’s solve these problems, one at a time.
Note: There is a solution that allows you to generate both VMware configuration file (.vmx) and disk images from the Web. Think of it as a Web-based wizard. Although still missing some options, it is still one-stop solution for VMware Player users for VM creation.
Download Empty VMware Player Images
Although not as flexible as other options, this is the fastest way to get you started. VMware’s configuration file is in plain text, so you should have no problem in editing it at all.
For instance, you may modify the CD-ROM drive to read from an ISO image in your hard drive. Ubuntu and other linux distributions provide free download of .iso image. This is the raw file that could be burned into a physical CD.
These empty disk images come in different sizes: 1GB, 4GB, 8GB and 15GB. Note these virtual disks have sparse files support. That means when you uncompress these files, you will see much smaller files. VMware will grow these files as you use them, so it is a good idea to have enough disk space, as much as what you plan to use.
- 1GB VMware virtual disk image (1KB compressed, 196KB uncompressed)
- 4GB VMware virtual disk image (1.6KB compressed, 589KB uncompressed)
- 8GB VMware virtual disk image (2.5KB compressed, 1.1MB uncompressed)
- 15GB VMware virtual disk image (4KB compressed, 2MB uncompressed)
While you can’t boot a thing yet with this image, they have ample of space for you to play. You can boot from CD and install operating system onto the image and make it bootable.
In other words, the first problem was solved.
Using Qemu to Create Virtual Disk Images
This is another option for disk image creation. Qemu is an emulator for various CPUs, but it also includes an executable called qemu-img.exe that allows you to create VMware disk image, among others.
The command syntax for qemu-img.exe is as follow:
qemu-img.exe create -f vmdk Linux.vmdk 4GB
In the same directory it will create a disk image ready to be used for your new virtual machine.
Download/Make VMware Configuration File
VMware’s configuration file (.vmx) is just plain text with a specific extension so Windows’ users may double click and run it from Windows Explorer.
Linux users may have #!/usr/bin/vmware on top of the configuration so they may set the file executable and the system knows which program to run.
Unlike disk image, this means you may change options easily, especially for values that are more obvious, such as the path to ISO image, etc.
Here is a VMware configuration file template that you can use for VMware Player. It should works for VMware Player 2.5 and above. It is always a good idea to upgrade to the latest and newest version though.
I have grouped the configuration options together so when you open the file you should see editable options on top.
This configuration file is created for people who want to follow along with me to install Ubuntu (Linux) and setup WordPress / Movable Type after it. However, if you want to run Windows Vista, edit the (.vmx) file to read as follow.
displayName = "Windows" guestOS = "winVista"
A list of supported guest Operating Systems is available below at the end of the article. Note that even if the guest OS you plan to install is not here, that doesn’t mean you can’t install it. The list shows systems that can be tweaked to perform better in virtual environment.
If you choose the right option, that means VMware will be virtualizing it better than if you choose a generic OS.
Here are a few other adjustable options:
# Common values are 32, 64, 128, 256, 512 and 1024 memsize = "256" # The path to the hard disk image (has to be in the right format) scsi0:0.fileName = "Linux.vmdk" # The path to Ubuntu CD-ROM image ide1:0.fileName = "C:\data\ubuntu-8.10-server-i386.iso"
All in One Solution for VMware Disk Image/Configuration File
Alternatively, you may use EasyVMX! to create virtual machine configuration for VMware. It is much like a web version of the VMware virtual machine creation wizard.
Let’s go through EasyVMX! one step at a time.
First off, you should choose a name that clearly identify the new virtual machine. If “Ubuntu Linux” is too generic, feel free to name it “Ubuntu 8.10″ or anything more specific. Also pick the right entry in the Select GuestOS dropdown list.
Leaving the Power ON / Power OFF options as is is usually a good idea unless you know what you are doing. If you intend to run this VM just for experiment, you certainly don’t need to adjust anything here.
You may give your VM a more descriptive name in the Virtual Machine Description section.
You should leave the Network Interface Cards options as is, unless you have specific requirements to have those features set to different values.
Floppy disk drive can be a nice option to have because with it you may be able to boot from floppy disk or a floppy image. For installation of Linux, you probably don’t need this though.
You should have at least one CD-ROM in EasyVMX! configuration. As the second drive, specify the path to Ubuntu JEOS image file. You may edit the .vmx file later if you haven’t downloaded the image file yet.
Set the hard disk drive to the size you want. In this case, we set it to 4GB, using virtual SCSI controller. This new version of Easy VMX also includes the capability to setup shared folder but that is optional. Only the first disk should be there.
As our goal is to setup a server machine without any graphical interface with minimal memory usage, you should uncheck all the other options unless you really want them.
Hit the Create Virtual Machine button to generate configuration file and hard disk image as you’ve selected above. The next screen allows you to download all the files in one compressed .zip file.
Download that file and save to your hard drive.
Unpack Your Files and Customize
Whichever route you take, you are now set. Unpack all the files into one folder. You are ready to install the guest operating system on your newly created virtual machine.
Open the (.vmx) file with Notepad or any other text editor. The following are the variables that you may want to adjust:
- displayName. The name of this virtual machine as displayed on the screen.
- guestOS. Guest operating system name. You should set this to the right OS for VMware to tweak the system so it performs better in virtualization.
- memsize. Memory size allocated for the virtual machine.
- scsi0:0.fileName. Point the value of this variable to the virtual machine image file (.vmdk).
- ide1:0.fileName. This one should point to the installation CD (raw image, .iso). If you already have CD of the guest OS, you may not need this.
VMware Supported Virtual Machine Operating Systems
I’ve tested running VMware using generic setting for an operating system. It works because VMware is just a virtual machine. However, if you want to take advantage of certain tweaks and optimization for virtualization, you should choose the right operating system. VMware may give you certain performance improvement for that.
For newer operating system, it is only officially supported by new versions of VMware. However, if you are running popular operating system, you should have no problem with it. Just look for one from the list below and substitute the VMware configuration file (.vmx) with the right value.
Here is the list of supported value for guestOS variable for VMware Workstation 6.5.x. If you don’t want to go through the whole process again just to change the value, this list can speed things up. You only need to edit the guestOS value in the .vmx file.
Windows 3.1 = win31
Windows 95 = win95
Windows 98 = win98
Windows Me = winme
Windows NT = winnt
Windows 2000 Professional = win2000pro
Windows 2000 Server = win2000serv
Windows 2000 Advanced Server = win2000advserv
Windows XP Home Edition = winxphome
Windows XP Professional = winxppro
Windows XP Professional x64 Edition = winxppro-64
Windows Vista = winvista
Windows Vista x64 Edition = winvista-64
Windows Server 2003 Web Edition = winnetweb
Windows Server 2003 Standard Edition = winnetstandard
Windows Server 2003 Enterprise Edition = winnetenterprise
Windows Server 2003 Small Business = winnetbusiness
Windows Server 2003 Standard x64 Edition = winnetstandard-64
Windows Server 2003 Enterprise x64 Edition = winnetenterprise-64
Windows Server 2008 = longhorn
Windows Server 2008 x64 Edition = longhorn-64
Red Hat Linux = redhat
Red Hat Enterprise Linux 2 = rhel2
Red Hat Enterprise Linux 3 = rhel3
Red Hat Enterprise Linux 3 64-bit = rhel3-64
Red Hat Enterprise Linux 4 = rhel4
Red Hat Enterprise Linux 4 64-bit = rhel4-64
Red Hat Enterprise Linux 5 = rhel5
Red Hat Enterprise Linux 5 64-bit = rhel5-64
Asianux 3 = asianux3
Asianux 3 64-bit = asianux3-64
SUSE Linux = suse
SUSE Linux 64-bit = suse-64
SUSE Linux Enterprise Server = sles
SUSE Linux Enterprise Server 64-bit = sles-64
SUSE Linux Enterprise Server 10 = sles10
SUSE Linux Enterprise Server 10 64-bit = sles10-64
Novell Linux Desktop 9 = nld9
Sun Java Desktop System = sjds
Mandrake Linux = mandrake
Mandriva Linux = mandriva
Mandriva Linux 64-bit = mandriva-64
Turbolinux = turbolinux
Turbolinux 64-bit = turbolinux-64
Ubuntu = ubuntu
Ubuntu 64-bit = ubuntu-64
Other Linux 2.2.x kernel = otherlinux
Other Linux 2.4.x kernel = other24xlinux
Other Linux 2.4.x kernel 64-bit = other24xlinux-64
Other Linux 2.6.x kernel = other26xlinux
Other Linux 2.6.x kernel 64-bit = other26xlinux-64
Other Linux 64-bit = otherlinux-64
NetWare 5 = netware5
NetWare 6 = netware6
Solaris 8 (experimental) = solaris8
Solaris 9 (experimental) = solaris9
Solaris 10 = solaris10
Solaris 10 64-bit = solaris10-64
MS-DOS = dos
FreeBSD = freebsd
FreeBSD 64-bit = freebsd-64
Other = other
Other 64-bit = other-64
Return to How to Make a Server — Building High Performance Server.
Return to Blog Tips for a Better Blog — Blog Building University.