Vsphere Combat Strategy 2: Virtual machine templates and clones

Source: Internet
Author: User
Keywords 2003 select Customize 2003 select customize
Tags allowing allowing users based class click client clone clones
The "template" is a feature that VMware provides for virtual machines, allowing users to "derive" or "clone" multiple virtual machines based on one of the virtual machines, which eases the burden on administrators.

1.1 Creating a template virtual machine

Before using a template, you need to install a "boilerplate" virtual machine and transform (or clone) the virtual machine into a "template", which you can use as a template to derive or clone multiple virtual machines.

In VMware ESX Server, you can support Windows Server 2003, Windows XP, Windows Server 2008, Windows Vista, or Windows 7 and Linux operating systems. You can create a template for each common operating system, such as a template for Windows Server 2003 and a template for Windows Server 2008. In some cases, you will also create templates for different versions of the same operating system, such as Windows Server 2003 R2, Windows Server 2003 Enterprise Edition, 64-bit versions of Windows Server 2003, Windows Server 2003 Web server version, and so on.

When creating a template virtual machine, consider the purpose of the virtual machines that you created, and consider the extensibility of future virtual machines. For example, if you create a template virtual machine with too little C disk space, you may not be able to meet your needs in many cases.

In the following example, you create a virtual machine for Windows Server 2003 that has 1GB memory, 30GB virtual hard disks, and the main steps are as follows:

(1) Log on to vcenter server using vsphere Client, create a virtual machine for Windows Server 2003, and set the virtual machine name to Ws03r2x86-temp.

(2) Set the virtual hard disk size to 30GB and select on demand and submit space, as shown in Figure 1.


Figure 1 Specifying disk size

(3) When the creation is complete, start the virtual machine and install the Windows Server 2003 R2 Enterprise version in the virtual machine. When installed, divides all hard disks into one partition and formats them with the NTFS file system.

(4) Then follow the prompts to complete installation of Windows Server 2003 and then install VMware Tools. Finally, install the latest patch for the current template virtual machine, and then close the virtual machine when the installation is complete.

1.2 Convert a virtual machine into a template

The following is an example of the enterprise version of the Windows Server 2003 X86 that you created earlier, which describes how to convert a virtual machine to a template.

(1) In Vcenter Client, navigate to the virtual machine to be converted to a template, right-click and choose Convert to Template from the pop-up shortcut menu, as shown in Figure 2.


Figure 2 Converting to template

Description if you choose Convert to template, the virtual machine is converted to a template that can only be used as a template, and if you choose Clone as template, the virtual machine, which is identical to this virtual machine, is cloned as a template, and the original virtual machine is still available.

(2) After the virtual machine is converted to a template, the source virtual machine will be removed from the manifest under the ESX server host. If you want to use the converted template, you can navigate to the Virtual Machines tab, as shown in Figure 3.


Figure 3 Virtual machine templates

Once you have a template, you can deploy the virtual machines from that template, but if you deploy this directly, the deployed virtual machines will be "exactly the same" as the templates, including SIDS, which can cause problems on your network. Based on this, further setup is required to use the template.

1.3 Creating Specifications for deployment

For Windows family products, you can use the Sysprep program provided by Microsoft to make a large-scale post-deployment customization of a Windows difference product. For VirtualCenter, it is also the use of Sysprep programs for later customization of products such as Windows Server 2003. The following describes the use of the custom specification by customizing the Windows Server 2003 X86 (32-bit version).

(1) In Vcenter Client, click Home, and then in administration, click Custom Spec Manager, as shown in Figure 4.


Figure 4 Customization Specification

(2) Display the Custom Spec Manager dialog box, click the New button, display the New Custom Specification dialog box, select Windows in the target virtual machine operating system Drop-down list, type ws03-x86 No AD in the Name text box, and in the description Type the information about the custom specification in the text box.

(3) Set the computer name on the computer Name page, it is recommended that you select Use virtual machine name or Prompt user for a name in the Deployment Wizard, and if you use virtual machine name, the name of the virtual machine will be the computer name of the operating system in the virtual machine when you use the specification; Prompts the user for a name in the Deployment Wizard, the user is prompted to specify the computer name when using this specification wizard. As shown in Figure 5.


Figure 5 Specifying the computer name

(4) In the Windows License dialog box, type the serial number of the Windows Server 2003 32-bit version, which needs to be consistent with the virtual machine serial number used by the template, but not the same. Note the serial number of the OEM, retail, or VL versions, and cannot be mixed, for example, VL serial numbers cannot be used for OEM version templates. And in Server license mode, select Per Server or Per Seat mode, recommended as per server, and set maximum number of connections.

"Note" If you customize the specification for Windows Server 2008, Windows 7, you can not enter the product serial number. If Windows Server 2008, Windows 7 in the enterprise is activated by a KMS server, you do not need to enter an ordinal number.

(5) Other choice according to the situation until the wizard completes.

1.4 Copy Sysprep program to vcenter Server computer

After the specification is created, it is also necessary to copy the appropriate version of Sysprep to the appropriate directory on the Vcenter server, which is available after the custom specification, which is "C:\Documents and Settings\All Users\Application Data\ Vmware\vmware Virtualcenter\sysprep ". In this folder, there are 2 K (corresponding to Windows 2000), svr2003 (corresponding to the 32-bit version of Windows Server 2003), svr2003-64 (corresponding to the 2003-bit version of Windows Server 64), XP ( Corresponds to the 32-bit version of Windows XP Professional SP2, SP3, xp-64 (64-bit version corresponding to the Windows XP Professional). As shown in Figure 6.


Figure 6 Sysprep folder

"Note" is to copy the Sysprep file to the vcenter server computer instead of to the vsphere client computer. In addition, products such as Windows Server 2008, Windows 7 do not have Sysprep, but in these products, the deployment tools are integrated, so no (and no) copies of these programs are required.

1.5 Deploying virtual Machines from Templates

After you have created the custom specification and copied the appropriate Sysprep program, you can deploy the virtual machine from the template.

(1) In vsphere client, select the VMware ESX Server host, go to the Virtual Machine tab, right-click the template, and choose "Deploy virtual machine from this template" from the pop-up shortcut menu, as shown in Figure 7.


Figure 7 Deploying a virtual machine from this template

(2) on the name and Location page, set the name of the deployed virtual machine.

(3) on the Host/cluster page, select the host or cluster on which you want to run the virtual machine. When you have more than one host or cluster, you can choose any of the options.

(4) On the data storage page, choose to save the virtual machine's data store.

(5) on the "Select Client customization Options" page, select "Customize with existing custom specification" and select the appropriate specification in the list.

(6) on the "Completing the New Virtual Machine" page, click the Finish button, as shown in Figure 8.


Figure 8 Completing the Virtual machine deployment

(7) After the deployment is complete, start the cloned virtual machine and open the console, as shown in Figure 9.


Figure 9 Entering the console

When a cloned virtual machine runs for the first time, it may "stay" in the login interface and click OK, and Windows Server 2003 may flash. When this problem occurs, return to the Vcenter Client and select the "Power → reset" command from the pop-up shortcut menu by right-clicking the cloned virtual machine. When the virtual machine is reset, it enters the Sysprep program, as shown in Figure 10.


Figure A Sysprep customization program

The next article, focus on how to use Vmotion for virtual machine migration, stay tuned.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.