17.2. Uploading VMDK images and creating a RHEL virtual machine in vSphere


With RHEL image builder, you can create customized VMware vSphere system images, either in the Open virtualization Format (.ova) or in the Virtual Disk (.vmdk) format.

You can upload customized images to the VMware vSphere client. You can upload the .vmdk or .ova image to VMware vSphere using the govc import.vmdk CLI tool. The vmdk you create contains the cloud-init package installed, and you can use it to provision users by using user data, for example.

注意

Uploading vmdk images by using the VMware vSphere GUI is not supported.

Prerequisites

  • You created a blueprint with username and password customizations.
  • You created a VMware vSphere image either in the .ova or the .vmdk format by using RHEL image builder and downloaded it to your host system.
  • You installed and configured the govc CLI tool to be able to use the import.vmdk command.

Procedure

  1. Configure the following values in the user environment with the GOVC environment variables:

    GOVC_URL
    GOVC_DATACENTER
    GOVC_FOLDER
    GOVC_DATASTORE
    GOVC_RESOURCE_POOL
    GOVC_NETWORK
  2. Navigate to the directory where you downloaded your VMware vSphere image.
  3. Launch the VMware vSphere image on vSphere by following the steps:

    1. Import the VMware vSphere image into vSphere:

      $ govc import.vmdk ./api.vmdk <folder-name>
      • For the .ova format:

        $ govc import.ova ./api.ova <folder-name>
    2. Create the VM in vSphere without powering it on:

      govc vm.create \
      -net.adapter=vmxnet3 \
      -m=4096 -c=2 -g=rhel8_64Guest \
      -firmware=efi -disk="<folder-name>/api.vmdk” \
      -disk.controller=scsi -on=false \
       vmname

      For the .ova format, replace the line -firmware=efi -disk="folder_name/api.vmdk” with -firmware=efi -disk=”<folder-name>/api.ova”

    3. Power-on the VM:

      $ govc vm.power -on <vm-name>
    4. Retrieve the VM IP address:

      $ govc vm.ip <vm-name>
    5. Use SSH to log in to the VM, using the username and password you specified in your blueprint:

      $ ssh admin@ <vm-ip-address>
      注意

      If you copied the .vmdk image from your local host to the destination using the govc datastore.upload command, using the resulting image is not supported. There is no option to use the import.vmdk command in the vSphere GUI and as a result, the vSphere GUI does not support the direct upload. The .vmdk image is not usable from the vSphere GUI.

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部