banner



How Copy A Template From Vcenter To Disk

In this first installment from a 4-post series, I'll be introducing vSphere VM templates. The series kicks off by exploring the basics and ends with an automation example showing how PowerCLI is used to mass deploy VMs quickly and efficiently using templates and invitee OS customization. vSphere 6.5 is the platform referenced throughout this series.

What is a VM template?


As the proper noun suggests, a VM template is a blue-print, baseline image or master re-create of a generalized virtual car. As you probably know, creating and configuring VMs, is a time-consuming procedure. In this respect, deploying a VM from a template can drastically lower provisioning times and aid y'all maintain standards; templates tin can be readily configured to tally with the specifications demanded by your environment and organization.

There'south also the option of having a library of Windows and Linux templates perpetually updated to the latest for like shooting fish in a barrel provisioning. Guest Bone customization (GOSC), a symbiotic feature that allows y'all to automate template provisioning, is something I'll cover later on in the serial.

Notation that a VM template differs from an OVF/OVA template. The latter is used to import or consign VMs using the OVF format.

One question that regularly pops upwardly is "How does a VM clone differ from a VM template?". Simply put, a clone is an contained copy of a VM taken at a specific point in time. It is an verbal replica of the parent VM which is what ultimately makes cloning a bad provisioning choice due to IP conflicts, indistinguishable computer names and so on. A template on the other hand, is generic and left generally unconfigured to facilitate both manual and automatic provisioning. There are a few other subtleties you should be aware of. For case, you cannot power up a template or change settings salvage for the VM name and description. Yous'll come across no such restrictions when using clones.

Creating a bones template


Creating a template is a straight-frontwards albeit laborious procedure. Beginning, create the VM and install a invitee Os equally you would normally do. Depending on the intended use, install the required software packages and apply the latest product and Bone patches. You should also delete all temporary and redundant files. Remove unused hardware from the VM'southward settings and configure the VM for optimal functioning. In one case all this is taken care of, but power off the VM and convert it to a template.

As per Fig. 1, the vSphere Spider web client provides 2 very similar options to this effect. Right-clicking on a VM, gives you the options to either Convert to Template or Clone to Template. The significant difference is that with Convert to Template, the VM being converted must be powered off. The option is otherwise ghosted out. With cloning to template, the VM can be either on or off.  In either case, a magician will take you through a number of steps prior to converting or cloning a VM to a template.

If you are using Content Libraries, you also take the selection to Clone to Template in Library.

Figure 1 - Converting a VM to a template

Figure 1 – Converting a VM to a template

Alternatively, you tin can use New-Template PowerCLI cmdlet to convert a VM to a template. In the example shown in Fig.2,  I've created a template from an existing VM called Centos. Annotation that all the parameters supplied are mandatory.

Figure 2 - Using PowerCLI to create a template

Figure 2 – Using PowerCLI to create a template

In vSphere client, templates are but displayed under the VMs and Templates view. The Become-Template PowerCLI cmdlet replicates this.

Figure 3 - Templates displayed under vSphere Web Client

Figure 3 – Templates displayed nether vSphere Spider web Client

If you lot browse the datastore where a template resides, you volition find a respective folder simply like whatever other VM. The folder will incorporate all the files associated with whatever standard VM. The one exception is that the VM configuration file has a .vmtx file extension instead of .vmx as per Fig. 4.

Figure 4 - A template folder and its contents as listed in datastore browser

Figure 4 – A template binder and its contents as listed in datastore browser

Simply for the heck of it, I unregistered a template from inventory; correct-click and Remove from Inventory, renamed the .vmtx extension to .vmx and re-registered it as a VM. Surely enough, the resulting VM powered upwards with no apparent issues. This method is probably unsupported since the proper way to do this is to correct-click on a template and select Catechumen to Virtual Motorcar. However, you never know when this might come up in handy.

Preparing and converting a VM to a template


The process of finalizing a template is highly dependent on the VM'southward invitee Os and the intended utilize. Most likely, the invitee OS will be some flavour of Linux or Windows. To prepare a template, you'd follow something along these lines:

i) Create a bare VM with the required hardware resources.

2) Power on the VM and access the BIOS. Press F2 while consoled to the VM and change the following:

a) Main Menu

Set Legacy Diskette A: to Disabled. This is disabled automatically when y'all delete the floppy drive while creating the VM (Customize Hardware).

b) Advanced Menu -> I/O Device Configuration

Gear up Series ports A and B and the Parallel port to Disabled.

Set Floppy disk controller to Disabled.

c) Kick Screen

Move the Hard Bulldoze to the height of the list using the and + keys assuming you want the VM to boot from the virtual difficult drive.

d) Press F10 to save and get out.

Figure 5 - Changing a VM's BIOS settings

Figure 5 – Irresolute a VM'due south BIOS settings

three) Later you're done with the BIOS settings, using the vSphere Web client or otherwise, right-click on the VM only created and:

a) Delete the floppy drive, if still listed, forth with other hardware you won't be needing.

Figure 6 - Deleting redundant hardware from a VM's settings

Figure 6 – Deleting redundant hardware from a VM'south settings

b) Optional: Configure the VM to automatically cheque and upgrade VMware Tools and synchronize the VM's guest OS time with the ESXi host.

Figure 7 - Setting a VM to check for VMware Tools and configuring it to time sync with its host

Figure 7 – Setting a VM to check for VMware Tools and configuring it to fourth dimension sync with its host

c) Optional: Configure the VM for CPU and RAM Hot Add which allows you to add CPU and retentivity resources to the VM while powered on. The Hot Add feature is supported on operating systems such as Windows Server 2008 R2 or later on. Note that the location of some settings may differ from what's shown depending on the vSphere client or version used.

Figure 8 - Adding hardware Hot Add capabilities to a VM

Figure 8 – Calculation hardware Hot Add capabilities to a VM

4) When you're done configuring hardware, power on the VM and mountain the guest Bone ISO file. Install the Guest Bone as you'd commonly do. Some mutual steps are listed beneath. These mostly utilize to Windows templates simply some equally employ to Linux.

  • Set the correct time zone, date and time.
  • Install VMware Tools (Of import!).
  • Install any software you want included in the VMs deployed from this template.
  • Install any missing Os updates, software and Security patches. Use Windows Update for Windows OSes. For Linux, yous can use something similar yum update.
  • Choose a potent ambassador password and set it to never expire. Doing this ensures yous won't become locked out of your VM. Aye, there are tools to unlock accounts and change passwords offline, but prevention is better than cure!
  • Using services.msc, disable redundant services such every bit the ones for Audio and Wifi. For domain joined computers this tin can be handled via GPOs.
  • Configure the network card to use DHCP and set the hostname to something generic such as Win7-template or Centos6-template.
  • Run msconfig to enable/disable startup items, modify UAC settings, etc. When setting up a Windows x VM or template, utilize Job Managing director instead to manage kickoff-up items.
  • Clean up the OS use something like CCleaner or the Windows inbuilt Disk Cleanup. The following command is run from an administrative cmd prompt to reduce the size of WinSXS.
Dism.exe /online /Cleanup-Prototype /StartComponentCleanup

Figure 9 - Windows in-built Disk Clean-up tool

Figure 9 – Windows in-built Disk Make clean-upward tool

  • If you have Windows based VMs that are not members of an Active Directory domain, runsysprep to avoid issues resulting from indistinguishable SIDs. This step is optional when applying a GOSC every bit it provides the same functionality; this is discussed further down.

Figure 10 - Finalizing a Windows VM with sysprep.

Figure x – Finalizing a Windows VM with sysprep.

Equally per Figure 10, sysprep is configured to power off the VM once information technology's done doing its thing. It is important that yous practice non ability on the VM at this stage. Instead, right-click on the VM name and select Template -> Convert to Template. The same applies to Linux VMs. Use halt, poweroff or shutdown to power downwards the VM.

This is basically all there is to creating and configuring a VM prior to converting it as a template. I may take omitted a few steps since I cannot perhaps cater for all the possible example scenarios. There are a ton of articles out in that location describing how to create templates for specific operating systems. Two such examples, for Windows Server 2008 and 2012 respectively, are bachelor here and here.

In the case of Linux, make certain to cheque out this mail since it highlights of import stuff such as removing persistent udev rules and SSH keys, tackling MACs and UUIDs and how to zero logs.

Automating …


At present that your get-go template is set, y'all can start provisioning VMs off of it. The only problem is that y'all will still need to manually ready details such as the hostname and networking settings. This tin get especially ho-hum when deploying multiple VMs. Is at that place a solution? Aye there is and it's called guest Os customization where VM and OS settings are applied automatically during the provisioning procedure.

Jumping straight in, here's how you would create GOSCs for Linux, and Windows using the vSphere Web client.

1) Click on the Home icon at the pinnacle of the screen, select Home and so click on theCustomization Specification Manager icon.

Figure 11 - Accessing the Customization Specification Manager tool

Effigy xi – Accessing the Customization Specification Manager tool

ii) Click on the Create a new specification icon and select either Windows or Linux.

Figure 12 - Targeting an OS type for custimization

Figure 12 – Targeting an Os blazon for customization

Creating a Linux GOSC

iii) From the Specify Properties screen, assign a name and optionally, a description, so y'all can easily locate the GOSC when needed.

Figure 13 - GOSC - Properties Screen

Figure 13 – GOSC – Properties screen

4) On the Set up Reckoner Name screen, specify the hostname by which the Linux instance volition exist identified on a network. The hostname tin can be user-divers and/or suffixed automatically, prepare to lucifer the VM name, entered manually during VM deployment or generated automatically using an application or script. The Domain proper noun is obligatory.

Figure 14 - GOSC - Computer Name screen

Effigy fourteen – GOSC – Computer Name screen

v) On the Fourth dimension Zone screen, select the time zone area and location and prepare the Hardware Clock to use UTC or Local time.

Figure 15 - GOSC - Time Zone screen

Effigy fifteen – GOSC – Fourth dimension Zone screen

6) From the Configure Network screen, yous tin ready the VM to use the default DHCP settings on all network cards. Alternatively, utilise custom settings for both IPv4 and IPv6. The latter can be disabled altogether if it is non used.

Figure 16 - GOSC Network Configuration screen

Figure 16 – GOSC Network Configuration screen

seven) Next, type in the IP accost, or hostname, of a valid DNS server including a DNS search path. Both settings are optional when creating a Linux GOSC.

Figure 17 - GOSC DNS Settings screen

Figure 17 – GOSC DNS Settings screen

8) You tin review the settings 1 concluding time and modify any as required. Press Cease when washed.

Figure 18 - Saving the GOCS

Figure 18 – Saving the GOCS

Once created, a GOSC can exist edited at any time. You may also duplicate, export or delete it. A GOSC tin can likewise be imported from an XML file.

Figure 19 - Using the Customization Specification Manager in vSphere Web Client to manage GOSCs

Figure xix – Using the Customization Specification Director in vSphere Web Client to manage GOSCs

Conclusion


Today, we've covered the basics on templates and closed off with a gustation of automation. In the next part, I'll cover the procedure of creating a Linux template and a corresponding GOSC which we'll use to deploy and machine-configure Centos seven based VMs. I will as well demonstrate how to achieve the aforementioned effect using PowerCLI.

[the_ad id="4738″][the_ad id="4796″]

How Copy A Template From Vcenter To Disk,

Source: https://www.altaro.com/vmware/vsphere-vm-templates-complete-guide-part-1/

Posted by: doranspold1936.blogspot.com

0 Response to "How Copy A Template From Vcenter To Disk"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel