I recently answered, what I thought was pretty straight forward question on the VMTN forums about whether it was possible to to deploy an OVA directly onto an ESXi host without leveraging remote tools such as the vSphere Client or the ovftool. The response that I provided was, no it was not possible to deploy an OVF/OVA within the ESXi Shell and recommended the user to take a look at the vSphere Client or the ovftool.

For whatever reason, my brain decided to ponder about this specific question over the weekend (even though I had answered dozen or so questions earlier in the week) and came up an idea that could make this work. As many of you know, I am a big fan of the ovftool and I have written several articles about the tool such as here and here. I wanted to see if I could get the ovftool to run in the ESXi Shell as all the necessary libraries and required packages are all self contained within /usr/lib/vmware-ovftool directory. If this works, it would allow a user to deploy a VM from an OVF or OVA format within the ESXi Shell and would not require a remote system which is great for kickstart deployments or ISO installations. As you probably have guessed, I was able to get this to work 🙂

Disclaimer: This is not officially supported by VMware, please test this in a lab before deploying on production systems.

Before you begin, you will need to get the ovftool installed on an existing Linux system, you can use vMA for your convenience. Next, you will need to use the scp command to copy the entire /usr/lib/vmware-ovftool directory onto an ESXi host. Ensure you place the contents on either a shared or local datastore as the size of the ovftool content is quite large (~119 MB).

In this example, I am scp'ing the ovftool directory to a local VMFS datastore (/vmfs/volumes/datastore1)

scp -r /usr/lib/vmware-ovftool/ root@vesxi50-7:/vmfs/volumes/datastore1

Once you have successfully copied the ovftool directory over to your ESXi host, you will need to make a small tweak to the file located in /vmfs/volumes/datastore1/vmware-ovftool/ovftool (shell script that calls the ovftool binary). You will need to modify the the first line using the vi editor from #!/bin/bash to #!/bin/sh as ESXi does not recognize the bash shell. You are now ready to copy an OVF or OVA to your ESXi host which should also reside within a shared or local datastore.

In this example, I uploaded a SLES OVF to the same datastore which contains the ovftool as seen below from the datastore browser:

Let's go ahead and perform a simple probe operation on the OVF we just uploaded to ensure that ovftool is working as expected. To do so, you just need to specify the full path to the ovftool as well as the full path to either your OVF or OVA file.

Note: The ovftool does take slightly longer to run in the ESXi Shell compared to a regular system with the ovftool installed.

Now that we have confirmed the ovftool is working, let's go ahead and deploy from the OVF image. Even though we are running the ovftool locally in the ESXi Shell, you will still need to specify the credentials to your ESXi host during deployment as ovftool was not designed for this use case.

Note: You must specify both the username and password in the ovftool command line, as the password prompt does not function properly in the ESXi Shell and you will see a looping of  "*" characters on the screen.

If you are familiar with the ovftool, you know you can specify an OVF/OVA from both a local resource as well as remote location such as a web server. Here is another example of deploying an OVF from a remote web server:

We can see that is pretty easy to deploy an OVF or OVA from within the ESXi Shell, but what about unattended installations such as ESXi kickstart? Yep, we can do that too! The easiest way is to compress the vmware-ovftool directory using tar command and then download it remotely using the wget command during the %firstboot stanza. I would also recommend placing your OVF/OVA images on a remote web server as well for centralize management and deployment.

Here is the sample code snippet that can be used in your kickstart:

As you can see, virtually anything is possible ... even if you thought it was not earlier 🙂

38 thoughts on “How to Deploy an OVF/OVA in the ESXi Shell

  1. Even though I have not tested this myself yet (will do so soon), is it possible to create an ovf/ova file from within the ESXi shell ?

    • @Anonymous,

      Yes, if you know how the ovftool works, it can be used to import/export OVF.

      You would still need to connect to the ESXi host and discover your VMs, but you can easily export an “offline”.

      Here is an example:

      /vmfs/volumes/datastore1/vmware-ovftool/ovftool “vi://root:vmware123@172.30.0.192/VM1” /vmfs/volumes/datastore1/VM1.ovf

    • Nice! Should we expect the next version of backup to include an option for ovf/ova backup and restore 🙂

    • I don’t have any plans on exposing this with ghettoVCB.

      As mentioned in the article, ovftool runs a little slower on ESXi Shell due to limited amount of resources and the biggest problem is that to export to an OVF, the VM must be offline. Though this may be okay for some users, I suspect the majority of users would like to perform online backups.

    • Just to keep the idea going …

      The backups that are produced by ghettoVCB are offline VM’s. Would it not be feasible to do a post process where we create an ova/ovf from the backup itself, and use that for storage, backup etc. The advantage would be smaller footprint, and better portability (no issues with moving the file around).

      Just thinking out loud ..

  2. In kickstart file, can’t we just do an NFS mount and run ovftool from the mounted file system ? That way we don’t need to run scp, tar and changing of ‘bash’ to ‘sh’ manually (which could be done on the NFS server side itself).

    • Yes that will probably work as well. The article is just to give you an idea on how you can accomplish the task, there’s more than one way to do anything 🙂 I would recommend you give it a try and post your findings

  3. Which version of ESX are you using? I am trying with ESXi 4.1. I am good up until it comes to deployment. Then i get an error, “Error: Unexpected option vi://root:”…
    Any ideas?

    • Hi William,

      Do you know what is the Linux OS which is most similar to that of esxi 4.1? I have been trying to auto deploy ovf file on 64 bit ESXi 4.x. Since it is ESXi 4.x, I cannot use ESXi 5.0 and vmware auto deploy. The method described in your post looks promising.

      I first tried to install 64 bit ovftool on the latest vma4, and then scp the vmware-ovftool directory to ESXi 4.1 shell. I got a “segment fault” when I was trying to probe the ovf file.

      And then I tried copying the vmware-ovftool from 32 bit ubuntu 10.04. Probing the ova file is successful (/vmfs/volumes/datastore1/vmware-ovftool/ovftool “http://10.10.1.1/kickstart/myos.ova”) . But when I was trying to deploy it , I got the following PANIC error.

      /vmfs/volumes/datastore1/vmware-ovftool/ovftool “http://10.10.1.1/kickstart/myos.ova” “vi://10.10.1.100”
      Opening OVA source: http://10.10.1.1/kickstart/myos.ova
      The manifest validates
      PANIC bora/lib/unicode/unicodeCommon.c:330

      VMware Workstation Error:
      VMware Workstation unrecoverable error: (vthread-3)
      PANIC bora/lib/unicode/unicodeCommon.c:330
      You can request support.
      To collect data to submit to VMware support, select Help > About and click “Collect Support Data”. You can also run the “vm-support” script in the Workstation folder directly.
      We will respond on the basis of your support entitlement.

      I have verified copying vmware-ovf directory from a host to another host with the same OS version works. I think if I install the ovftool to a OS which is very similar to that of ESXi 4.1, it will a have good chance to succeed.

      Any suggestions that I can try to make ovftool work for ESXi 4.1, besides finding the OS similar to ESXi 4.1?

      Really appreciate your help!

    • ESXi is it’s own OS, specifically the VMkernel and it’s not related to any Linux OS. The ESXi shell runs Busybox, you could try to get it working on Busybox and copying the files over, but YMMV. This was only tested on ESXi 5 and it’s not officially supported, so it may or may not work even on ESXi 5.0

      You might find these two articles useful:
      http://www.virtuallyghetto.com/2011/02/how-to-compile-busybox-for-esxi-kind-of.html
      http://www.virtuallyghetto.com/2011/02/how-to-compile-busybox-for-esxi-kind-of_15.html

      Good Luck

    • Hi William,
      Thanks for your explanation. I tried the Busybox solution without success. But I did figure out one workable solution. Here is what I did:
      1. install 64 bit CentOS 5.5 x86_64.
      2. on CentOS, get 32 bit ovftool installation script VMware-ovftool-2.0.1-260188-lin.i386.sh from vmware. (newer version or 64 bit version don’t work on esxi 4.1 shell in my testing)
      3. install ovftool on CentOS: ./VMware-ovftool-2.0.1-260188-lin.i386.sh
      4. modify first line of /opt/vmware/ovftool/ovftool from “#!/bin/bash” to “#!/bin/sh”.
      5. cd /opt/vmware
      6. tar -czvf ovftool.tar.gz ovftool/
      7. copy the tar file to esxi4.1 and untar it.
      8. using ovftool to deploy ova file on esxi4.1: /vmfs/volumes/datastore1/ovftool/ovftool –acceptAllEulas –name=”newname” “http://10.10.1.1/kickstart/my.ova” “vi://root@127.0.0.1”.

      Hope it might be helpful for someone.

      Thanks.

  4. Hi William

    Priceless….I was trying to do this a couple of months back for an audo-deployment project from a DVD disk sent out to a customer…I had to gz the entire VM and extract it into the newly deployed ESXi system (MD5 checks all the way!). Now I can chill…send out new OVF’s on DVD and do a nice clean import.

    My only thorn in my side is ESXi5’s 2GB USB limit which prevents me sending out loads of OVF’s updates on a 32GB USB stick?….I can dream I suppose?

    Oustanding!

    Luca (London)

  5. It looks like VMware changed ovftool binary and ver 3.0.1 is no longer static. I’m having troubles getting it work in ESXi 5.1 shell. Does anyone have a link to an older ovftool bundle ?

    The error is :

    SSLLoadSharedLibraries: Failed to load OpenSSL libraries. libdir is /usr/lib/vmware

    VMware Workstation Error:
    VMware Workstation unrecoverable error: (vthread-3)
    SSLLoadSharedLibraries: Failed to load OpenSSL libraries. libdir is /usr/lib/vmware

  6. 3.0.1 works on 5.1 you just have to symlink the files to /usr/lib e.g.

    ln -s /vmfs/volumes/501916f2-c5a348a7-b2f4-d4ae52a078f7/vmware-ovftool /usr/lib/vmware-ovftool

    where 501916f2-c5a348a7-b2f4-d4ae52a078f7 is replaced with your local volume ID. Don’t be tempted to use the Datastore name, this is a symlink itself so you will receive an error due “to too many levels of symbolic links”. Don’t try to move the files there either or you will run out of space.

    Then run the ovftool as follows

    /usr/lib/vmware-ovftool/ovftool /vmfs/volumes/datastore1/Filename.ova

    Finally, it allows me to install VMs easily across a transatlantic link 🙂

  7. Is there any other equivalent of ovftool which can be used to deploy a .ova file. We are trying to to automate our test environment so looking for options that we can use to create a working environment from .ova files.

  8. Hello, I’m trying to deploy an OVA on ESXi 5.1:

    /vmfs/volumes/5266a109-xxx-xxx-xx-xx/vmware-ovftool # /vmfs/volumes/datastore1/vmware-ovftool/ovftool -ds=datastore1 -dm=thin /vmfs/volumes/datastore1/Web.ova “vi://aaa:bbb@y.y.y.y”
    Opening OVA source: /vmfs/volumes/datastore1/Web.ova
    Opening VMX target: “vi://aaa:bbb@x.x.x.x”
    Error: Invalid target disk adapter type: thin
    Deleting directory tree below: “vi:
    Completed with errors

    Do you know why I’m receiving this error?

    Thanks!

  9. This doesn’t seem to work with OVFtool 3.5 on ESXi 5.0.

    The following comes up:
    /lib64/libstdc++.so.6: version GLIBCXX_3.4.9'
    /lib64/libstdc++.so.6: version
    GLIBCXX_3.4.11′
    /lib64/libstdc++.so.6: version GLIBCXX_3.4.9'
    /lib64/libstdc++.so.6: version
    GLIBCXX_3.4.11′
    /lib64/libstdc++.so.6: version `GLIBCXX_3.4.9′

    the libstdc++.so.6 is part of vmware tools install on Linux. I have taken the file and placed it both in the folder containing the ovftool as well as /usr/lib/ and I have also configured the symlink as suggested in the other comments, it still doesn’t work.

  10. Check to see if there is an updated version of libstdc++ available. On SLES, there is both the 4.3 and 4.6 versions – they can co-exist. Install libstdc++43, and the 32-bit (in on x86_64) AND the libstdc++46 (and 32-bit).

    Run a depmod -a afterwards. Reboot doesn’t hurt.

    Running the ‘strings command against the libstdc++.so.6 | grep GLIBC” should show you whether the version 3.4.11 is in
    the library or not.

  11. I am using ESXI6.0 OS . Now i have to create VM in ESXI6.0 using OVFtool. As the older ovftool 3.5.0 is not supporting ESXI6.0, help me out to get OVFtool for esxi6.0 OS.

  12. And primp industries is no more? Anyone have the link to ovftool.exe or ovftool linux binary from VMware without having to login?

  13. Hi,
    I successfully deployed ovf using this procedure with some warnings because my network have few adapters.
    This is the list of networks I have-

    Networks:
    Name: Check Point Management
    Description: The Check Point Management network

    Name: Check Point Sync
    Description: The Check Point Sync network

    Name: External Network
    Description: The External Network network

    Name: Internal Network
    Description: The Internal Network network

    I used this command to deploy the ovf with only 1st network – /vmfs/volumes/datastore1/vmware-ovftool/ovftool -dm=thick -ds=datastore1 “–net:Check Point Management=VM Network” ……

    My question is how to deploy more then 1 network ?

    Thanks

  14. Hi,

    I successfully install ovftool local on one ESX and it works fine for exporting ova locally.

    /vmfs/volumes/55484a4d-f560588d-cb1c-005056952125/vmware-ovftool # ./ovftool –disableVerification –noSSLVerify -ds=datastore1 vi://root:Admin123@172.18.235.15/Esxi1_VM3 /vmfs/volumes/datastore1/vm-tst.ova

    Opening VI source: vi://root@172.18.235.15:443/Esxi1_VM3
    Opening OVA target: /vmfs/volumes/datastore1/vm-tst.ova
    Writing OVA package: /vmfs/volumes/datastore1/vm-tst.ova
    Progress: 16%
    Transfer Completed
    Completed successfully

    Is it possible to export/import directly between 2 ESXi 5.1 host ? I’ve tied but get the following error:

    /vmfs/volumes/55484a4d-f560588d-cb1c-005056952125/vmware-ovftool # ./ovftool –disableVerification –noSSLVerify -ds=datastore1 –X:logFile=debug_o.log vi://root:Admin123@172.18.235.15/Esxi1_VM3 vi://root:Admin123@172.18.235.22

    Opening VI source: vi://root@172.18.235.15:443/Esxi1_VM3
    Opening VI target: vi://root@172.18.235.22:443/
    Error:
    – The task was canceled by a user.
    Completed with errors

    Here’s the log:

    2015-05-20T11:43:47.418Z verbose -[3FFCBD89F20] [Originator@6876 sub=Default] Getting target
    2015-05-20T11:43:47.419Z verbose -[3FFCBD89F20] [Originator@6876 sub=Default] Connecting to vi host
    2015-05-20T11:43:47.419Z verbose -[3FFCBD89F20] [Originator@6876 sub=Default] Skip SSL verification
    2015-05-20T11:43:47.419Z verbose -[3FFCBD89F20] [Originator@6876 sub=Default] Getting version of the VI host : 172.18.235.22
    2015-05-20T11:43:47.420Z verbose -[3FFCBD89F20] [Originator@6876 sub=Default] Initializing new curl session
    2015-05-20T11:43:47.478Z verbose -[3FFCBD89F20] [Originator@6876 sub=Default] WebRequest set basic http authorization, username : root
    2015-05-20T11:43:47.478Z verbose -[3FFCBD89F20] [Originator@6876 sub=Default] Getting http page: https://172.18.235.22/sdk/vimServiceVersions.xml
    2015-05-20T11:43:47.542Z verbose -[3FFCC191940] [Originator@6876 sub=Default] Curl session torn down
    2015-05-20T11:43:47.555Z verbose -[3FFCBD89F20] [Originator@6876 sub=Default] Http response code: 200
    2015-05-20T11:43:47.555Z verbose -[3FFCBD89F20] [Originator@6876 sub=Default] Http response body:

    2015-05-20T11:43:47.556Z verbose -[3FFCBD89F20] [Originator@6876 sub=Default] Curl session torn down

    Can you help please?

    Thanks

    • Hi,

      Given ovftool was never meant to run in ESXi, YMMV on what operations will work and I’ve not tried to run it between two ESXi within ESXi. I know this works when you run ovftool on a separate supported system.

  15. Hi,

    Your article was great and got me almost through this deployment. However, I’ve run into this problem. I’m using esx 3.5 and ovftool 3.5.2. I’m trying to deploy the ovf from the datastore (or locally), but it fails with the brilliant error:

    Error: vmodl.fault.InvalidRequest.

    Looking through the logs, it is failing on:

    2015-07-09T03:28:15.133+10:00 [16244 verbose ‘Default’] Getting http page: https://192.168.6.200/sdk/vimServiceVersions.xml
    2015-07-09T03:28:15.133+10:00 [16244 verbose ‘Default’] Proxy host :0
    2015-07-09T03:28:15.148+10:00 [18148 verbose ‘Default’] CURL: header data removed
    2015-07-09T03:28:15.148+10:00 [18148 verbose ‘Default’] CURL: header data removed
    2015-07-09T03:28:15.148+10:00 [18148 verbose ‘Default’] CURL: header data removed
    2015-07-09T03:28:15.148+10:00 [18148 verbose ‘Default’] CURL: header data removed
    2015-07-09T03:28:15.148+10:00 [18148 verbose ‘Default’] CURL: header data removed
    2015-07-09T03:28:15.148+10:00 [18148 verbose ‘Default’] CURL: header data removed
    2015-07-09T03:28:15.164+10:00 [16244 verbose ‘Default’] viConnection version: vim25:2.5u2 (apiVersion: 2.5.0)
    2015-07-09T03:28:15.179+10:00 [16244 verbose ‘Default’] Setting VI connection message locale (via login) to:
    2015-07-09T03:28:15.179+10:00 [16244 verbose ‘HttpConnectionPool-000002’] HttpConnectionPoolImpl created. maxPoolConnections = 1; idleTimeout = 900000000; maxOpenConnections = 1; maxConnectionAge = 0
    2015-07-09T03:28:15.195+10:00 [16244 verbose ‘Default’] Keeping VI session alive
    2015-07-09T03:28:15.195+10:00 [10172 verbose ‘vmomi.soapStub[3]’] initial service state request failed, disabling pings. error=HTTP Status:404 ‘Not Found’

    I’m assuming that because esx is older than version 4, the vimserviceVersions.xml file (and the sdk folder) do not exist so it is failing with the 404 error.

    Is it possible to get this working?

    C:\Program Files\VMware\VMware OVF Tool>ovftool –datastore=storage2 –vmFolder=”TestFolder” –X:logFile=d:\log.txt “https://root@192.168.1.200/folder/HipChatovfs/hipchat.ovf?dcPath=ha-datacenter&dsName=storage2” vi://root@192.168.1.200/

    Any help would be greatly appreciated.

  16. Thanks for the good stuff William, I have esxi server and I am able to create VM through ovftool and power it on. so far it is good but I want to manage (linux-vm) from esxi cli. Like this I want to login to the esxi through ssh from there I want to access linux-vm console. Is there any way to do it?

  17. Hello!

    I need help, I have everything going along. OVF tool is tar’d and working I am able to get the description read. my issue comes with the vi connection. I keep getting a connection refused on 192.168.x.x:443 and not sure where to go from here.

    ESXi 6

    Please help

  18. Hi William,
    I’ve created a ova and while deploying its showing web console networking properties tab for some ESX servers.
    How can I skip configuring these properties in web console while deploying ova?
    Do we have any configuration to make sure that this console tab can be hide while deploying.

    I appreciate you help, thanks in advance.

    Regards
    Sankar

  19. William, thank you a ton for this one! It was the *easiest* way for me to deploy an OVA on my Intel NUC ESX + Proxmox tuxcenter training machine without hitting the upload issues with VMware ESXi Host Client (I think it does not like that the vmdk is 5 GiB, at least it says it won´t accept OVAs larger than 1 GiB due to a browser limitation… and then suggests un-tar-ing ova and upload individual files, but, well VMDK is also larger than 1 GiB).

Thanks for the comment!