Home > Blogs > VMware vApp Developer Blog > Tag Archives: virtual appliance

Tag Archives: virtual appliance

VMware Studio 2.1 is now available for download

VMware Studio 2.1 GA was announced on Tuesday, July 13, 2010 in conjunction with the vSphere 4.1 release. The 2.1 release extends support for various OS and also brings enhanced flexibility, predictability and security to the Virtual Appliance development and update process.

• We listened to our customers and unlike previous versions, VMware Studio 2.1 can now create virtual appliances from virtual machines that were not originally created with VMware Studio, based on a discovery phase. In addition, while building an appliance, EULA(s) can now be retrieved from an input file in additional to being embedded in the build profile.

• Studio now enables users to create their own build profile templates. The CLI offers the –newos option using which you could generate a build profile for any RPM-based or DEB-based Linux OS.

• We also took a stride towards securing the appliance deployment and update process. We added support for digitally signed OVF files so that VMware vSphere 4.1 can verify the signed certificate during OVF import. In addition, using signed manifests during the update process, you could ensure that patches are coming from a trusted source.

• We also added a feature around localization. You can translate your EULA(s) into multiple languages, and vSphere Client as well as the VM first boot script will display it in the language of the prevailing locale. Also, you can now enforce EULA acceptance during the appliance update process.

• On the performance and optimization side, with Studio 2.1, you could now run concurrent builds. After a configurable limit is reached, builds wait in a queue. In addition, VMware Studio 2.1 optionally analyzes the list of RPM and DEB packages to locate unused items and generate a small-footprint virtual machine. It can also reduce the footprint post-installation with a file removal list.

• With Studio 2.1, during the appliance provisioning process, the generated virtual machine always reboots before your application installs. Some applications expect a full installed working system before they themselves will install. Rebooting after OS installation provides the real environment in which to install the application.

• A new utility program “vamisupport” is shipped with the output appliances for retrieving useful data for troubleshooting VAMI related issues.

• The new Linux OSs support we added are SLES 11, CentOS 5.4, RHEL 5.4, and Ubuntu 8.04.3 and 8.04.4.

In addition to the new features mentioned above, we fixed some of the major issues our customers faced with Studio 2.0. The issues around packages installation order (as specified in the Application Package Repositories) not always being honored has been fixed. Disk capacity set in build profile is now properly displayed in the web interface. VAMI is now fully functioning in SELinux enabled systems. Finally, OVF Tool used for transporting VM during provisioning has been upgraded to address known issues.

Download VMware Studio 2.1 GA release from here and give it a spin. We look forward to your feedback.

Adding Linux Management Service to Virtual Appliance

VMware Studio 2.0 allows author to add their own in-guest services that will show up as another tab in the appliance web interface. If you want to add additional appliance configuration capabilities or want to consolidate appliance and application configuration into single web interface, this blog will show how to achieve the same easily. 

Lets create a simple in-guest service, that can run
arbitrary commands on the appliance. Since it is allowed to run arbitrary
commands we need to ensure that the service has authentication and can only be
invoked by a user with proper credentials.

Eclipse Plugin for Studio (see installation instructions at VMware Studio Eclipse Plugin
) provides an easy way to create and build Management Service. You can also
create the management service by hand by constructing the same directory
structure, and having a service.xml please see VMware Studio Developer Guide
for details of the format of the Management Service.

Create an new Project, and pick “VMware Studio Linux
Management Service Project” as shown below.



Enter details about your service.

 This will create a directory structure for the service as
shown below.


 Generated service.xml has the details of the service, you
can modify this to fit your needs. If there are any external package
dependencies you can add them in service.xml.


<?xml version="1.0"




  <description>My Service to
run a command

  <!– Dependencies







View.xml in the view folder points to what will be shown to the user in the
management tab of the VM, by default it points to an index.html page you can
change this to any other content. You will put all your html related content
for the service in the view folder, they will be placed in the
/opt/vmware/share/httpd/service/myservice folder on the Appliance.


      <title>My Service</title>

      <content type="url"
url="index.html" />


For our service we would want to invoke some command on the
Appliance and show the result to the user. Lets add the necessary html to take
input from the user in the index.html page.

<script language="JavaScript">

// Obtain the
vami object, please read documentation for various functions that can be
executed on vami

var vami =

// Callback to
take the command result and show to the user

commandOutput(commandresult) {

      document.getElementById('output').value =


function runCommand() {

      var commandToRun =

      //cgi files are placed are served from

      var cgiToInvoke = '/service/myservice/cgi/backend.py?command=' + commandToRun;

      //Invoke vami.io to perform a httpGet
request with basic authentication and callback with the result to

      vami.io.httpGet(true, true, 'Running the
, cgiToInvoke, commandOutput);



<h3>Sample CGI</h3>

<p>Run any command
on the appliance and get the results.

Enter the command

<input type="text"
name="command" id="command"
size="50" value="pstree">

<button type="submit"

<p><textarea class="output"
id="output" readonly="true">Command output >>></textarea>



vami.io.httpGet is a VAMI Web API that does AJAX call to the back end
and callbacks a function when it is done. Refer to VMware Studio Developer Guide
for detailed list of VAMI Web API.


We need to take care of running the actual command on
the Appliance, you may wish to write the backend in any backend technology you
may wish, you can even write it as a CIM Provider on sfcb.  


We will write our backend in python, lighttpd on the
appliance is already configured to work with python. If you would like to write
the backend in php, perl or ruby make sure you add the necessary lighttpd.conf
file for the service to configure lighttpd to work with those technologies.


Our backend code in python will simply invoke the command
return the result.



# Back end code
that will be executed to return data to the user

def backend_code():

   #return http header, the extra
empty line is required

   print 'Content-Type: text/html'

   print 'Status: 200'


   form = cgi.FieldStorage()

   #Obtain the form fields

   command = form['command'].value

   #Run the command as passed by the user
with current directory set to /root

   pobj = subprocess.Popen(command, bufsize=1, shell=True,




   #Output of the command is sent back to
the user

   while True:

      line = pobj.stdout.readline()

      if not line:


      print line.strip()



When we are invoking the backend we asked VAMI to do basic
http authentication, using vami.io.httpGet(true , we would need to add
the necessary checks in our backend code that we will only execute a given command
if user is authenticated. User name and sessionid is sent as part of the http
basic authorization, we can use this information to make a call on the SFCB
server to make sure that user is authorized.


def autentication_failure():

   print 'Content-Type:

   print 'Status: 401'

   print 'WWW-Authenticate: Basic
realm="Authentication required"'




if "HTTP_AUTHORIZATION" in os.environ:

   #of the form 'HTTP_AUTHORIZATION':
'Basic cxadsfas='

   http_auth = os.environ["HTTP_AUTHORIZATION"].split(" ")[1]

   user, sessionid =
":", 1)

   #Authenticate user using CIM server to
process username,password


      cliconn = pywbem.WBEMConnection('http://localhost:5488', (user,


   except Exception, e:








To Build the Service, right click
build.xml and select run as “Ant Build”, this will create a tar.gz.




You can now
include this service as part of your appliance, please refer to “Importing a
Management Service” section in VMware Studio Developer Guide and when you do, your final appliance web UI will be as shown below.


 Download myservice.zip to get the full details of the code and the eclipse project.

Introduction to the Eclipse plugin in VMware Studio 2.0

There are many steps in developing, building and testing VMs and vApps using VMware Studio.  To make it easier Studio 2.0 adds a new tool to help, the VMware Studio Eclipse plugin. The plugin makes life simpler to many users by adding simple ways to package applications and build the application along with the VM or vApp, all in a single click.  To demonstrate the simplicity, in this blog entry, I will walk through an example of how to develop a simple web-based VM or vApp.

To follow along you will already need to have VMware Studio running and will need to set up an Eclipse development environment.

To get started I downloaded the Eclipse IDE distributed by Aptanu at http://www.aptana.org/ and installed the optional Aptana Aflax feature by going to Help->Install Aptana Features then selecting Ajax Libraries->Aflax and then clicking install.  You can also select the editing tools that you want to use for your app.

I then installed the VMware Studio Eclipse Plugin by following the guide at http://www.vmware.com/support/developer/studio/studio20/eclipse_plugin.html.

Now the normal application development tasks take place, I will just use a sample project that is provided by Aptana as my application.  If the Samples view is not open in your environment, then you can open it by selecting Window->Show View->Other…->Aptana Views->Samples then clicking OK.  Once the view is open, I will find the sample named spirograph, right click on it and select Import Sample as Project...

Once the project is opened I used the Project Explorer view to create a new directory named html and moved all the web files into it.  I then created a VMware Studio Package for Linux (.vsp) in the project and called it mypackage.  To created the vsp file, right-click on the project name and select New->Other…->VMware Studio->VMware Studio Package for Linux .

You can use the Eclipse tools to further test and develop this web app.  Open the index.html file and modify the source or preview the changes.

Once you are satisfied with the app, it is time to package it.  Open the mypackage.vsp file and fill out the package details.  This application requires a httpd server with php on the VM which is provided by the operating system, so add them to the dependencies line.

Now set up the file mapping.  The file tree on the left represents how the files will be laid out in the VM after it is built.  The source location is where the files are on your local machine.  For this application, we will just set the top level html directory, Eclipse will recursively go through all the files and automatically add them at build time.

This application needs the web server to automatically start when the VM is booted.  To make this happen, we edit the post-install script for vsp.

We are almost done!  Now we just need to set up a VM build profile on VMware Studio.  For this blog I chose to use CentOS and keep the default configuration for everything except setting the root password and editing the settings for the provisioning engine.

You can create the profile directly in Eclipse by clicking on VMware Studio Web Console in the VMware Studio Explorer view.  Create the profile then save and close it.

Then when you are ready, click on Build Package… in the vsp editor.  The first time you may be prompted to create a package repository, just accept the default by clicking Yes then OK.  Select the VM profile to add this package to, and enable Automatically start VM build.  Then click on Finish.

A new Eclipse job is started, which monitors the build, and will notify you when it is finished.  You can monitor the status of the build by opening the Progress view.

Once the build is done you can deploy the VM to test it.

That is all that is needed.  Easy!  Your VM is now ready to be shipped.

The Eclipse plugin provides several other feature, like looking at the build logs, and creating default service packages to extend the VAMI framework.

Please leave comments and let us know how this went for you!

VMware Studio – Adding RHEL 5.4 support in minutes.

Red Hat has recently released Red Hat Enterprise Linux (RHEL) 5.4. Here are the easy steps for enabling VMware Studio 2.0 to create VM or vApp for RHEL 5.4 Server i386 and x86_64.

Adding RHEL 5.4 i386 support structure based on the existing RHEL 5.3 i386 components:

  1. Log in to the Studio VM as root.
  2. Create the template profile, Studio runtime packages, and VMware Tools for the new OS:
    • cp -r /opt/vmware/etc/build/templates/redhat/5/3 /opt/vmware/etc/build/templates/redhat/5/4
    • cp -r /opt/vmware/lib/build/include/rhel/5/3 /opt/vmware/lib/build/include/rhel/5/4
    • cp -r /opt/vmware/www/vmware-open-vm-tools/redhat/5/3 /opt/vmware/www/vmware-open-vm-tools/redhat/5/4
  3. Edit and update /opt/vmware/etc/build/templates/redhat/5/4/build_profile.xml with the following content:
    • [line 25] <Product>Red Hat Enterprise Linux 5.4</Product>
    • [line 92] <vadk:url>http://[VADK.localIP]/vmware-open-vm-tools/redhat/5/4</vadk:url>
    • [line 208] <Description>Red Hat Enterprise Linux 5.4</Description>
    • [line 303] vadk:sourceDir="[VADK.vadkRoot]/lib/build/include/rhel/5/4/"
    • [line 306] <vadk:ISO vadk:path="file:///opt/vmware/www/ISV/ISO/rhel-server-5.4-i386-dvd.iso"
          vadk:md5sum="7a12ec6599527e4f3d1790b51eadbfed" vadk:containFiles=""/>
    • [line 309] <vadk:Distribution vadk:vendor="Red Hat" vadk:OSverMajor="5" vadk:OSverMinor="4"

Adding RHEL 5.4 x86_64 support structure based on the existing RHEL 5.3 x86_64 components:

  1. Log in to the Studio VM as root.
  2. Create the template profile, Studio runtime packages, and VMware Tools for the new OS:
    • cp -r /opt/vmware/etc/build/templates/redhat/5/3_x86_64 /opt/vmware/etc/build/templates/redhat/5/4_x86_64
    • cp -r /opt/vmware/lib/build/include/rhel/5/3_x86_64 /opt/vmware/lib/build/include/rhel/5/4_x86_64
    • cp -r /opt/vmware/www/vmware-open-vm-tools/redhat/5/3_x86_64 /opt/vmware/www/vmware-open-vm-tools/redhat/5/4_x86_64
  3. Edit and update /opt/vmware/etc/build/templates/redhat/5/4_x86_64/build_profile.xml with the following content:
    • [line 25] <Product>Red Hat Enterprise Linux 5.4 64bit</Product>
    • [line 91] <vadk:url>http://[VADK.localIP]/vmware-open-vm-tools/redhat/5/4_x86_64</vadk:url>
    • [line 208] <Description>Red Hat Enterprise Linux 5.4 64bit</Description>
    • [line 303] vadk:sourceDir="[VADK.vadkRoot]/lib/build/include/rhel/5/4_x86_64/"
    • [line 305] <vadk:ISO vadk:path="file:///opt/vmware/www/ISV/ISO/rhel-server-5.4-x86_64-dvd.iso"
          vadk:md5sum="04fe3c10202402d7b389528d2bad0210" vadk:containFiles=""/>
    • [line 308] <vadk:Distribution vadk:vendor="Red Hat" vadk:OSverMajor="5" vadk:OSverMinor="4"

And that's it. You will now see the RHEL 5.4 template profiles through the VMware Studio web interface. With the new template profiles, you may then create your customized build profile for building the desired RHEL 5.4 Server VM or vApp.

VMware Studio 2.0 GA – What’s new?

VMware Studio 2.0 GA was announced at VMworld Developer Day. The GA release comes two months after Beta. It mainly focuses on product quality and usability improvements with few enhancements from the Beta feedback. One of the key features added was support for CD based updates for virtual appliances. This feature is critical for production appliances that are deployed behind firewall. Since these appliances cannot connect to ISV's web based update repository, GA version of Studio allows appliance authors to create CD based update repository alongwith web based version it supported since 1.0. The end-user web console allows users to configure updates to be received from CD or through the phone-home URL. The other key area where we spent a good time during GA release was ensuring support for various vCenter environments for building vApps and virtual appliances. You can have VC environments with distributed vSwitches, VC deployments integrated with Active Directory and specify them as provisioning target in Studio. GA version also allows the author to specify clusters and sub resource pools for provisioning hosts. It detects hosts that are in maintenance mode and prevents their use during provisioning. 

Minor features include support for web console footer customization, setting hostname explicitly in built vms and virtual appliances and control EULA acceptance on first boot amongst others. Disabling EULA acceptance is needed for build and test environments to enable running regression test suite on nightly appliance builds in automated fashion. With 2.0 GA release, VMware tools are optional and explicitly specified in the build profile similar to appliance packages. This makes it easy to update or replace the tools with the version preferred for your deployment environment.

Also check out the GA version of Eclipse Plugin. We have done few usability improvements here, ability to add individual packages instead of entire application package repositories, ability to automatically create application package repository when building an application package. Studio menu items in Eclipse are now context sensitive. VMware Studio 2.0 is a view in Eclipse. Try it out with your Java, J2EE, C++ perspectives and it should integrate seamlessly. Eclipse 3.5 was released just after Studio Beta and we have ensured Studio GA Plugin continues to work with 3.5 alongwith 3.4 version of Eclipse.

A common question seen in community forums is support for various guest Operating Systems. We plan to address it in a different form by making Studio build process agnostic of various Linux distros and enabling users to create their own templates. Expect this feature in near future. In the meanwhile we have various blog posts coming to describe how to create VMs with various guest operating systems that are not supported out of the box in VMware Studio. 

The GA version includes fixes that we encountered while creating large vApps. One of the exercises we conducted internally was creation of Sharepoint vApp using Studio. We successfully created the 3 tier vApp that has MSSQL database, Index server and Frontend. The Sharepoint vApp uses OVF properties to extract environment specific variables : computer names of each vm and domain to integrate into. On first boot it runs sysprep to complete the deployment process. It also asks for existing AD instance and integrates the vApp into the existing domain. The end result is a running sharepoint vApp integrated with AD. We plan to post the details around the same including first boot scripts, sysprep commands, etc in coming weeks. 

Below are part 1 and 2 of videos that show how to build vApps using VMware Studio. Download VMware Studio 2.0 GA release from here and give it a spin. We look forward for your feedback.

From Studio Team