Mud: vcenter deploys VMS through templates, vcentervm

Source: Internet
Author: User

Mud: vcenter deploys VMS through templates, vcentervm

This document consistsIlanniwebProviding friendship sponsorship, first launchedThe world

For more articles, follow my ilanniweb.

In the previous article, we introduced the installation and configuration of vcenter5.5. In this article, we will introduce how to use the vcenter vm template to deploy virtual machines and solutions to problems encountered during the deployment process.

I. Generate a VM Template

To generate a vm template, we must first install a virtual machine. Here I have installed a centos6.6 machine. As follows:

To make a vm a template, you must perform operations when the vm is shut down. As follows:

Select Virtual Machine-"template"-"convert to template ".

Through the comparison of the above two images, we can find that the icons before and after the vm template is made are different. In this way, our vm template has been generated.

Note: the conversion between virtual machines and vm templates is very simple, and the two can be converted to each other.

Ii. Deploying VMS in vcenter

Now we have a vm template. If we want to quickly deploy a vm on this vcenter, we can directly use this vm template for deployment. As follows:

Note: unless it is an important step, no text description will be added.

Note: If you want to customize the vm, we can perform related configuration in this step.

By now, the new vm has been deployed successfully. Of course, we still need to adjust other parameters of the new vm. We will not introduce it here.

Iii. Cross-vcenter deployment

Sometimes we need to import a new vm to another vcenter to test it. This is a vm deployed across vcenter.

To deploy VMS across vcenter, perform the following operations.

3.1Export VM templates

First, we need to export the vm as a template and select the vm template to export. Of course, not necessarily a vm template, but also a vm.

The vm template we use here is as follows:

"File"-"Export"-"Export OVF template ":

NOTE: For the exported file format, you can select the ova format for a single file and the ovf format for the folder.

The ova format of a single file is actually a compressed file in ovf format. You can use the tar command or 7zip to decompress the ova format file to obtain the ovf format file.

Because ova files are easy to carry (just one file), we choose to export files in ova format.

The vm template has been exported.

3.2Decompress the VM Template File

Why unzip the vm template? If you do not modify the vm template, the system prompts that the OVF package cannot be deployed when importing the vm template: the file and other error messages cannot be found. As follows:

To modify a vm template, decompress the vm template file vm-mould.ova. After extracting the ova file, we can obtain the xxx. vmdk, xxx. ovf, xxx. mf files.

To decompress the ova file, we can use two methods: 7zip and tar. Next we will introduce them separately.

3.2.1 tarExtract

To decompress the file using the tar command, we can upload the ova file to Linux and decompress it. As follows:

Tar-xf test-modle.ova

After decompression, we can see three files: xxx. ovf, xxx. vmdk, and xxx. mf.

The ovf file indicates vm configurations, such as memory size, hard disk size, and network connection mode. This file is similar to the xml configuration file in kvm virtualization.

VmdkThe file is a vm hard disk file.

MfFiles are mainly used to verify whether vm configurations are maliciously tampered.

Of course, if you do not want to upload files to Linux for decompression, You can also download the windows version of the tar command. The download link is as follows:

Http://gnuwin32.sourceforge.net/packages/gtar.htm

After the download and installation are complete, the ar command cannot be directly used. You need to manually add the tar command to the environment variable of the system. As follows:

After adding the system variables, run the unzip command. As follows:

Tar-xf test-modle.ova

3.2.2 7zipExtract

To decompress the package using 7zip, we must use it on windows. Install the 7zip software and decompress it. As follows:

Through, we can see that the ova file after decompression, indeed get three files test-modle.ovf, test-modle-disk1.vmdk, test-modle.mf.

3.3Modify VM Template File

To modify the vm template file, you only need to modify the ovf file.

In Linux, the modification method is as follows:

Vim test-modle.ovf + 96

We only need to change the 96-line vmware. cdrom. iso of the ovf file to vmware. cdrom. remotepassthrough.

In windows, the modification method is as follows:

Before modification.

After modification.

3.4Verify the sha1 value of the VM Template File

After modifying the vm file, we also need to verify the sha1 value of the template file. Otherwise, an error will be reported when importing the vm template.

After modifying the ovf file, you only need to verify the file. If we have modified the vmdk file, we also need to verify the file.

After verification, write the obtained sha1 value to the mf file. Note: In the mf file, the sha1 file with ovf and vdk is worth it.

Based on the verification platform, we will introduce the verification methods for Linux and Windows respectively.

3.4.1 LinuxVerify

In Linux, it is easier to directly use the sha1sum command, and then write the sha1 value of the verified ovf file to the mf file. As follows:

Sha1sum test-modle.ovf

Cat test-modle.mf

3.4.2 WindowsVerify

For verification on the windows platform, we can use the tool fciv provided by Microsoft for calculating the MD5 and SHA1 hash values of files. The file verification and integrity verification program fciv is a command prompt tool to calculate and verify the encrypted hash value of the file. Fciv can calculate SHA1 or MD5 encryption hash values. These values can be displayed on the screen or saved as the XML file database for later use and verification.

Common examples of fciv are as follows:

Fciv d: \ mydir \ myfile.exe(calculate the md5 value of myfile.exe in the folder of the d Drive mydir)

Fciv d: \ mydir \ myfile.exe -sha1(calculate The sha1 value of myfile.exe in the folder of ddisk mydir)

After downloading fciv and running it, decompress it and you will be prompted to put it in that folder. The decompressed folder contains only two files, fciv.exe‑readme.txt.

Now we start to use the fciv command to verify the sha1 value of ovf, as shown below:

Fciv test-modle.ovf-sha1

After verification, write the obtained sha1 value to the mf file, as shown below:

3.5Generate ova File

After the vm template file is verified, we need to package the ovf, vmdk, and mf files into ova files.

To package it into an ova file, we currently need to use the tar command for packaging. As follows:

Tar-cf test-modle.ova test-modle.ovf test-modle-disk1.vmdk test-modle.mf

Note: The preceding tar packaging command file must follow the preceding format. Otherwise, vcenter reports an error when importing the vm template.

OvfThe archive requires that the ovf file be the first file, then the virtual machine image file (such as vmdk), and then the mf file, other optional files (such as certificates) will be followed ).

For how to package an ovf file, refer to this connection:

Http://mingjin.thoughtworkers.org /? Cat = 24

3.6Import VM templates

After modifying the vm template file, we choose to import the template to the new vcenter. As follows:

The vm template has been imported.

4. Multiple vc connections to an esxi instance

Sometimes when using vcenter, an esxi will be used by another vcenter. In this case, the vcenter we use will show that the esxi node is offline. As follows:

To reconnect to the esxi, perform the following operations:

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.