Build a Lightweight Browser ApplianceBuilding a browser appliance, has never been easier or quicker. Using the VMware player, EasyVMX and a linux liveCD you can have a virtual appliance up and running in just minutes.
Getting StartedTo build a virtual appliance, we'll use EasyVMX to create an empty virtual disk for use with the VMware player, and then boot VMware off an iso image of a live CD (so we don't even need to write the iso to a real CD/DVD) and then use the install-to-hard-drive option of the Live CD to quickly install linux to the virtual disk image, so we can customise the setup and add other software easy.
First up we need to grab a copy of the VMware player which is available free from their website. Download and install that.
Next we need to grab an iso for a liveCD to run with. I used Damn Small Linux (DSL) as it is only a 50Meg iso, and only needs a couple of hundred meg of diskspace to install in. I went with the 2.4 release of DamnSmallLinux. The observant will notice that DamnSmallLinux does provide their own VMware image, but this doesn't contain a virtual harddisk, so makes customising the setup harder.
Next we need to grab a disk image from EasyVMX. For Damn Small Linux, you only need a very small disk, 500MB is sufficient (and the smallest image EasyVMX provide) and 128MB of memory is ample. For other LiveCDs you might want to go with a 2GB image, as that provides ample space to add extra packages.
Click on Create virtual machine, and download the zip file containing all the files. Extract the files in to the same folder as the iso image you downloaded earlier.
Ready to BookNow we have all the files we need you need to edit the .vmx file to get vmware to use the iso image as the CDROM drive. On windows you may need to use wordpad to edit the file, as notepad doesn't handle the line endings correctly.
Scroll down to the section for the CDROM
# Settings for physical CDROM drive ide1:0.present = "TRUE" ide1:0.deviceType = "cdrom-raw" ide1:0.startConnected = "TRUE" ide1:0.fileName = "auto detect" ide1:0.autodetect = "TRUE"
we are going to comment out these lines for now (we can put them back once the liveCD is installed to the virtual hard disk) and add 3 lines pointing to the iso image. Remember to use the correct filename for your iso image
# Settings for physical CDROM drive #ide1:0.present = "TRUE" #ide1:0.deviceType = "cdrom-raw" #ide1:0.startConnected = "TRUE" #ide1:0.fileName = "auto detect" #ide1:0.autodetect = "TRUE" ide1:0.present = "TRUE" ide1:0.fileName = "dsl-3.0RC2.iso" ide1:0.deviceType = "cdrom-image"
Save the .vmx file, and we are now ready to run the image. Double click on the .vmx file to launch the VMware player. Because the virtual disk image doesn't yet have any partitions defined, the VMware player will boot from the iso image instead.
and wait while the iso boots.
Install to Virtual HardDiskOnce the Live CD is booted, you need to create a partition on the empty virtual disk. Load an XTerm (as root) and use
cfdisk /dev/hdato create the partition. Remember to mark the partition as bootable.
In DamnSmallLinux, the option to install-to-hd is on the menu under Apps -> Tools -> Install to Hard Drive . Choose the partition you just created, and install. It should only take a few moments, though larger LiveCDs might take a little longer.
Once install, reboot the virtual machine, and it should now boot from the hard drive image rather than the livecd. If it boots ok, then shut it down, and re-edit the .vmx file, returning the CDROM settings to their original values, as you no longer need to use the iso image.
I was very impressed how fast Firefox runs from DamnSmallLinux inside VMware, and you can now use the virtual appliance for whatever you want, running linux safely inside windows (or linux).