VMware VM Templates A to Z

Subscribe banner

Manual deployment of many similar VMs in large virtual environments can exist a deadening task. VMware provides multiple methods of virtual machine (VM) cloning in vSphere virtual environment, ane of which is using VM templates. This blog postal service explores all aspects of VM templates: how they work, how to customize them, their use cases, and their advantages. The commodity also compares the concepts of VM templates and VM clones.

First 15-day Free Trial of NAKIVO Backup & Replication to access the Enterprise Edition feature set with no capacity limitations.

What Is a VM Template?

A VM template is a master copy paradigm of a virtual machine that includes VM disks, virtual devices, and settings. A VM template tin can be used many times over for the purposes of VM cloning. You cannot power on and edit the template once information technology has been created. This is past design, so that nobody tin accidentally edit the virtual machine that is used equally a template. This arroyo provides greater security (and a more "foolproof" method) for VM cloning. After cloning the VM from a template, VM clones are non linked to a VM template and are independent. If you want to edit a template, you lot should catechumen a template to a VM, edit the VM, and and so convert the edited VM to a new template.

When Can VM Templates Be Used?

VM templates are useful for deploying high numbers of similar VMs, since they preserve VM consistency. For example, suppose a team of testers needs to do their testing work on VMs with a new build of the company's proprietary software product. The company's arrangement administrator creates a VM template and clones an identical VM from that template for each worker who needs ane. If something goes wrong during testing or a new test scenario must exist implemented, then a fresh VM can be cloned from the template with minimal endeavour. You can create multiple templates from Linux and Windows virtual machines for different use cases (testing, development, educational activity, etc.). Unlike templates can include different sets of software. One template can exist used for deploying VMs for a financial squad, another VM template can be used for evolution team, etc.

The Difference Betwixt a VM Clone and a VM Template

A regular VM clone is an exact copy of the source VM at the advisable point of time. If you were to periodically clone a VM that is in a running land, the resulting clones would differ from ane another. It is preferable to clone a powered-off VM, although standard cloning even so doesn't offering all the benefits of a template.

When a VM is cloned, all settings such equally static IP network, reckoner name, and identifiers are left identical for each VM clone. As a result, network conflicts can occur. A VM template helps you lot prevent these bug, because a VM template cannot be edited, nor tin it ever exist in a running country. VMware provides tools that simplify guest OS customization for VM clones.

The Departure Between a VM Template and an OVA/OVF Template

OVA and OVF templates are used for distributing pre-configured software as virtual appliances. OVA and OVF are compressed file formats. They tin contain multiple VMs, which is useful for cases where software consists of multiple components that must be deployed on different machines. For example, NAKIVO Backup & Replication is available equally a virtual appliance (in addition to the other deployment options).

Deploying VMs from OVA/OVF templates is similar to deploying from VM templates. OVA/OVF can be accessed from vCenter inventory. Users can too deploy VMs using OVA/OVF from local storage (e.g., disk C: on a user'southward computer), mounted USB devices, and remote web servers that are accessible from vSphere Web Customer.

The OVF (Open up Virtualization Format) bundle can incorporate certificate files, ISO optical deejay image files, etc. The OVA (Open Virtual Appliance) file is similar to the TAR archive file; it tin can contain multiple OVF files.

VM templates are non compressed. They tin can exist accessed only from locations available for vCenter (local ESXi datastore, shared datastore) and are non intended for distribution among customers.

VM Guest OS Customization

Invitee OS customization is a vSphere characteristic that allows users to change the settings of a VM clone'south Linux or Windows guest Os. If the traditional approach were used, you would accept to manually get-go a VM, log into the guest Os, then modify the configuration in different parts of the Os via a GUI or the command prompt provided by the Bone. This method is cumbersome and consumes significant amounts of time. With VMware's Invitee Bone customization, you lot can create a guest OS customization specification and use this specification for every VM clone produced from the template. You can easily modify the IP network settings, hostname, username, countersign, time zone, license settings, SID (security identifier), and Domain/Workgroup for a invitee OS. (Note: the customization parameters for Linux and Windows differ slightly.) Using VM guest OS customization is convenient and saves you time. Configure your clone settings from one place in simply a few steps with the customization wizard.

You tin create multiple customization specifications for Linux and Windows virtual machines to make them useable as soon every bit the VM clone is deployed from the VM template. If you are going to use guest OS customization specification, prepare your VMs so that they meet the requirements.

The post-obit components must be installed on a guest VM for this purpose:

  • VMware Tools
  • Sysprep tool (Windows)
  • Perl (Linux)
  • Internet tools (Linux)

The guest OS must be installed on a virtual disk continued to the SCSI 0:0 node.

Check whether or not your guest Bone of choice is supported by your version of vSphere in the VMware Guest OS Customization Support Matrix.

Preparing a VM for Template Creation

Before creating a template, you should prepare your VM. Let'southward consider the main points of VM preparation.

Creating a new VM. Create a new VM with sufficient CPU, disk, and retentivity resources. Select the appropriate VM compatibility options. For example, if you take hosts with ESXi six.5 and ESXi 6.0, your VM should be compatible with ESXi 6.0 or later (virtual hardware version 11), so that choice should exist selected. Optionally, yous can enable CPU Hot Plug and Retention Hot Plug; this lets you add processor and memory resource while a VM is running.

Disconnecting unused devices from a VM. If you are using a VM that already exists, disconnect unnecessary hardware devices such as virtual floppy disk drives, virtual COM controllers, LPT controllers, etc. If USB devices and CD-ROMs volition not be used later on software installation, they tin can likewise be asunder. This approach reduces the risk of potential attacks and, as a effect, improves security. Yous can also enter the virtual BIOS and verify that all unnecessary devices are disabled in the VM'south BIOS.

Installing the required software on a VM. Install the operating system on the VM. Then install all the necessary updates, security patches, antivirus protection, and specific software needed for your purposes. Configure your Bone settings, such as environment variables, remote access, etc. Set passwords for users and the administrator(s). Passwords should never expire; this way, you can preclude accounts from getting locked. You tin too configure a default user contour.

Installing VMware Tools. VMware Tools is a gear up of drivers and utilities that increases the performance of a guest OS running on a VM as well as facilitating VM direction. Install VMware Tools on the guest OS. This is an important requirement for using VM templates because VMware Tools are used when customization specifications are applied for changing IP configuration, host name, time zone, or other guest Os settings when VMs are deployed from a template.

Removing unwanted software components from a VM. You can brand your VM template more lightweight by optimizing the invitee Os. The following are some general recommendations for Windows systems that may be useful for configuring your VMs:

  • Disable unnecessary organization services, such as wireless services, themes, Windows Audio, Windows Search, etc.
  • Disable Windows Aero, as information technology includes graphic furnishings that consume meaning amounts of computing resources.
  • Disable the screensaver to save some CPU resources.
  • Uninstall tablet PC components.
  • Uninstall unnecessary Windows components, such as Games, Messenger, etc.
  • Disable all unnecessary startup applications and services.
  • Delete temporary files, including files used for software iInstall the SSH server nstallation.
  • System restore can be disabled. Y'all tin use VMware snapshots instead of the Windows organisation restore functionality. If you want to back up your VMs for robust data protection, you can use NAKIVO Backup & Replication.

You tin carry out a deeper cleanup of your guest Os to optimize VM performance depending on your demands.

In the following sections, y'all tin learn well-nigh configuring a Linux virtual machine for the purposes of making a VM template (with which you could use guest OS customization specification). This walkthrough uses the example of Xubuntu 16 x64. It as well discusses how to create a customization specification for farther cloning of VMs from your template.

In order to set Xubuntu Linux for guest OS specification customization, enter the Linux panel (Last) and run the following commands as a user with root privileges:

1. Install the SSH server for remote admission via SSH.

apt-get install openssh-server

2. Restart the SSH server afterward installation.

service ssh restart

iii. Install VMware Tools for Linux from repositories (The alternative style to install VMware Tools is by inserting an ISO paradigm into a virtual CD bulldoze of a VM).

apt-go install open-vm-tools

4. Install the networking toolkit.

apt-get install net-tools

5. Install Perl.

apt-go install perl

Once the packages accept been installed, check the computer proper noun and IP configuration of the Linux VM. Blazon ifconfig to view the IP configuration of network interfaces. In this case, the virtual network interface used by the source VM has an IP address of 192.168.77.246.

Checking the settings of the network interfaces used by a Linux VM

Creating a VM Template

In one case your VM has been prepared, you lot can create a VM template. Y'all must have access to vCenter Server for managing your ESXi hosts, virtual machines, storage, networks and other vSphere components. As mentioned above, in the configuration examples considered in this blog post, a VM running Xubuntu Linux is used. Ii methods can be used for VM template creation – converting to a template and cloning to a template.

Converting to a template. When you convert a VM to a template, your source VM gets replaced past the resulting template, and every bit a result, your source VM would exist unavailable. In gild to convert a VM to a template, accept the post-obit steps:

  • Log into vCenter with VMware vSphere Spider web Client. Go to Hosts and Clusters or VMs and Templates, then select the VM that you take prepared for conversion.
  • Ensure that the VM is powered off when you convert it into a template.
  • Right-click the VM, and in the resulting context menu, select Template > Convert to Template.
  • A confirmation bulletin is displayed: Catechumen the virtual auto "VMname" to a template? Click Yes to proceed.

Converting a VM to a template with vSphere Web Client

Cloning to a template. This pick allows you to preserve the original VM and re-create the VM data to a template. The source VM tin can be powered on or off while you are cloning the VM to a template. Allow's consider how to create a template by cloning the original VM. Similarly to the previous method, navigate to your VM in the vSphere Web customer. Right-click the VM, and in the context bill of fare click Clone > Clone to Template.

Cloning a VM to a template with vSphere Web Client

A cloning assistant is launched. Go on through the steps as follows.

  1. Select a name and folder. Define a name for your VM template and select a target location. In this case, Xubuntu16-test is the template name, considering this template is going to be used for testing purposes. Click Next.

Setting a name and location for a new template.

  1. Select a compute resource. You tin select an ESXi host or a cluster every bit your resources. Click Next.

Selecting a compute resource for a VM template

  1. Select the storage location in which to store the template. Y'all can set a virtual deejay format (sparse-provisioned, lazy zero thick-provisioned, or eager cipher thick-provisioned) or simply let the virtual disk format be defined by that of its source. You can define a custom VM storage policy here, if needed. Click Next.

Selecting a storage location for the VM template files

  1. Gear up to complete. Check the summary and click Finish to proceed with the template cosmos.

Checking the summary for the VM template creation

At present, your newly created VM template is displayed at the end of the list in the VMs and Templates section. Every bit you can run into, the storage usage of the original VM and the VM template is the same (pinch is not used for VM templates, equally mentioned higher up).

A template is displayed in the VMs and Templates section

If you become to the Storage section, and then select the datastore and the directory of your VM template, you should see that all the files are similar to the files of your source VM except for one – the VMTX file. The VM configuration file has a .VMTX extension instead of a .VMX extension, which is used for configuration files of regular VMware VMs.

Viewing VM template files on the datastore

Creating a VM Guest Customization Specification

At present that a VM template is created, y'all can create a VM guest customization specification. In lodge to do this, open the Menu, then click Policies and Profiles.

Navigating Policies and Profiles in vCenter with vSphere Web Client.

Make sure that VM Customization Specifications are selected in the left pane. Click New to create a new VM customization specification. Yous should then see a new wizard window launched.

Creating a new VM customization specification

  1. Proper name and target OS. Set a unique proper name for the specification, enter a description, select the vCenter server, and specify the invitee OS of the target VM (Windows or Linux). In this walkthrough, Linux is used, and the specification is chosen Linux test spec. Click Adjacent.

Setting a name, description, vCenter server and guest OS for a VM guest customization specification.

  1. Computer Proper noun. Gear up a computer name (host name) and domain name. There are three available options to specify a computer name:
  • Use the virtual car name. The computer name of the guest Os inside the VM would be the same every bit the VM name. Using this choice can be convenient for assistants purposes.
  • Enter a name in the Clone/Deploy Wizard. Y'all can manually enter a figurer name when you apply the customization specification for a VM clone. You lot can apply this option if you don't know which names you lot want to use for these VMs in the time to come.
  • Enter a proper noun. You can enter the calculator name right now. In order to ensure uniqueness, tick the Append a numeric value checkbox (if y'all deploy multiple VMs, each VM must have a unique reckoner name for the invitee Os).

A computer name cannot be more than than 63 characters in length – if you try to input anything longer, the name gets truncated. Click the Next push button to continue.

Setting the computer name and domain name for a VM guest OS.

  1. Fourth dimension Zone. Specify a fourth dimension zone for the virtual machine. Then click Side by side.

Configuring the time zone for the VM.

  1. Network. Specify the network settings for the virtual machine. There are two options:
  • Employ standard network settings for the invitee OS, including enabling DHCP on all network interfaces.
  • Manually select custom settings.

For the purposes of this walkthrough, the second option is used; permit'southward configure the network settings manually. You tin click the Add together button to add a virtual network interface controller (NIC) to your VM. Click the icon with the row of three dots and select Edit in the resulting context carte du jour.

Editing virtual NIC settings.

A new configuration window is launched. There are three options available in the IPv4 tab.

  • Utilize DHCP to obtain an IP address automatically.
  • Prompt the user for an IP address when the specification is used. You tin can preconfigure a subnet mask and default gateways using this pick, but the IP address must be entered when the specification is applied to the VM.
  • Use custom settings. This option is like to the previous one, but the IP accost can exist set right now.

IPv6 tin be disabled. Click OK when you have finished configuring the network options. And then click Next.

Configuring IPv4 settings for a virtual NIC.

  1. DNS settings. Specify the DNS servers and DNS search paths for the VM. Yous tin gear up to three DNS servers. Click Adjacent.

Setting DNS servers and DNS search paths

  1. Ready to consummate. Review your settings and click Finish when you are satisfied.

Checking the summary of settings used for a guest OS customization specification

Yous should now be able to see your guest Bone customization specification in the list of VM customization specifications. You tin can edit, duplicate, export, and delete the specifications from hither.

Viewing the list of VM customization specifications.

Creating a VM from a Template

Now that you have a VM template and a invitee OS customization specification, y'all can create a virtual machine from your template. Go to the VMs and Templates section, right-click the template you created, and select New VM from This Template. In this case, the template is preserved. If you use the Catechumen to Virtual Automobile option, then your template gets converted to a VM; information technology would no longer be as a template.

Creating a new VM from the template

The Deploy From Template wizard is launched.

  1. Select a name and folder. At this phase, y'all should input a unique VM name and a target location. In this walkthrough example, the virtual auto is named Xubuntu16-test01. Click Adjacent to continue.

Selecting a VM name and location to store the VM

  1. Select a compute resource. Here, you lot can select the ESXi host or cluster on which the VM should run. Click Next.

Selecting a compute resource for the VM

  1. Select storage. Select the datastore in which to store configuration and disk files. Select the virtual disk format. You can manually gear up the virtual disk format (thin-provisioned, lazy zero thick-provisioned, or eager zilch thick-provisioned) or leave the virtual deejay format the same as that of the source. Select a VM storage policy if necessary. Click Next.

Selecting storage to store the VM files

  1. Select clone options. In order to apply your recently-created guest Bone customization specification, tick the Customize the operating system checkbox. So click Next.

  1. Customize guest Os. Select the guest OS customization specification yous created from the list. Call back that in this walkthrough, the proper name of the specification is Linux test spec. Click Side by side to proceed.

Selecting a guest OS customization specification for a VM clone

  1. User settings. Retrieve from earlier in this walkthrough that the guest OS specification customization used here allows united states of america to set up the IP accost during VM clone creation. Let's define the IP address for a virtual network adapter of this VM. In this case, the IP accost is 192.168.77.240. Click Next.

Setting the IP address for a VM clone during deployment from a VM template

  1. Gear up to consummate. Cheque the configuration summary and click Finish to initiate VM creation.

Checking the summary and finalizing deployment of a VM from a template

Once the VM has been created from a template with your invitee Bone customization specification, run the VM and launch the VMware Spider web Console to access the guest Os interface. Once you lot log into the VM, the VM is restarted and your customized settings are applied. Afterward the VM has rebooted, open up the Linux console and verify the host name, IP configuration, and time zone. You can check these parameters by inbound the post-obit commands.

View the host proper noun:

less /etc/hostname

Yous can also see the host name in the primary prompt string.

Check the IP configuration of network interfaces:

Ifconfig

Check the fourth dimension zone set in the system:

timedatectl | grep "Fourth dimension zone"

Cheque the gateways in the routing table:

netstat -rn

Checking the settings that were applied to a VM with Linux after using guest OS customization specification.

As you lot can see from the above screenshot with the Linux panel and the below screenshot showing VMware vSphere client, the IP address, computer proper name, and time zone have been inverse according to the settings divers in our invitee OS customization specification. The VM name and the host name are the same.

DNS name and IP addresses of the guest OS are displayed for the VM in vSphere Web Client

Automation with PowerCLI

The walkthrough higher up has explained the creation and application of VM templates with the vSphere Web Client GUI (graphical user interface). However, alternatively, you lot could use PowerCLI to manually create complex scripts and make VM deployment more automated. Some of the cmdlets that could be useful for these purposes are listed below:

New-Template – creates a new VM template.

New-OSCustomizationSpec – creates a new invitee Bone customization specification.

Become-OSCustomizationSpec – retrieves the OS customization specifications from vCenter.

Set-OSCustomizationSpec – changes the specified OS customization specification.

Get-OSCustomizationNicMapping – retrieves the NIC mapping settings for Bone customization specification.

Set-OSCustomizationNicMapping – alter the NIC mapping settings for the specified OS customization specification.

New-OSCustomizationNicMapping – adds the NIC mapping settings to the Bone customization specification.

For the total listing of PowerCLI cmdlets, their syntax, examples and other related data, refer to the VMware PowerCLI Reference web folio. You can likewise read our blog post virtually PowerCLI scripting.

Advantages of VM Templates

VM templates with guest Os customization specification are useful for VM deployment, particularly in large environments. The primary advantages of using VM templates are summarized here:

  • Standardize VM deployments. Standardization allows yous to avoid redundant efforts every bit well as improving quality and productivity. Assistants of standardized VMs is easier than administration of non-standardized VMs.
  • Fewer errors during deployment. When several virtual machines must be deployed manually in succession, there are many opportunities for a system ambassador to forget something, which could crusade errors. As an alternative, the organisation administrator can spend fourth dimension in one case to create a perfect VM template; this tin then be used for all further (like) VM deployments going forward.
  • Automation of the VM deployment process. Automation makes deployment easier and faster, increasing productivity while improving security.
  • Time savings. This benefit is related to the advantages listed higher up that brand templates an efficient solution. Furthermore, saving time ways reducing costs.

Conclusion

Today's blog mail has covered VMware VM templates, including their usage and configuration with VMware vSphere client. A VM template is a master epitome that can be used for making clones during mass VM deployment. VM templates cannot be edited and powered on like regular VMs, which improves security. Invitee OS customization specification helps you lot customize OS settings similar network configuration, figurer proper noun, time zone etc. afterwards VM cloning past using the single wizard, thus making VM deployment faster and more than convenient. As a event, you gain important advantages such as automation, reduced fault count, standardization, and rational fourth dimension consumption – which tin can too aid you salvage your budget!

VMware Backup