This article consists of Ilanniweb provide sponsorship, starting in Slime Line the world
to get more articles, you can follow my ilanniweb.
in the previous article, we introduced the installation and configuration of vcenter5.5, which we'll cover with how to deploy virtual machines through vcenter VM templates and how to solve problems in the deployment process.
first, generate VM template
to generate the VM template, we first installed a virtual machine, where I installed a centos6.6 machine. as follows:
to make a VM a template, you need to operate it in a VM shutdown state. as follows:
Select the virtual machine-template-Convert to template.
by comparing the two graphs above, we can find that the VMS are not the same icon before and after the VM template is made. This allows our VM template to be built.
Note: Transitions between virtual machines and VM templates are very simple and can be transformed from one to the other.
second, Vcenter deployed VMS internally
Now that we have a template for the VM, we can deploy it directly using this VM template if we want to quickly deploy VMS on this vcenter. as follows:
Note: The following steps are not descriptive unless they are important.
Note: If you want to customize the VM, we can make the relevant configuration in this step.
to this a new VM has been deployed successfully, of course, the new VM and other related parameters, we need to adjust. We are not going to introduce it here.
Iii. deployment across vcenter
sometimes we need to import this VM into other vcenter in order to test a new VM. This belongs to deploying VMS across vcenter.
to deploy VMS across vcenter, we need to do the following.
3.1 exporting VM templates
First we will export the VM as a template and select the VM template to export. Of course, the export is not necessarily a VM template, or it can be a VM.
Here we use the VM template, as follows:
file-Export-export OVF Template:
Note: In relation to the export file format we need to note that we can select the single file OVA format and folder OVF format.
The single file OVA format is actually a compressed file in the OVF format, and we can get the OVF format file via the tar command or 7zip decompression OVA format file.
because OVA files are convenient to carry (just one file), we chose to export an OVA format file.
we have exported the template to this VM.
3.2 extracting VM template files
Why unzip the VM template? Because if you do not modify the VM template, we will be prompted to not find an error message that failed to deploy the OVF package when we import the VM Template: The file cannot be found. as follows:
to modify the VM template, we will unzip the VM template file Vm-mould.ova. After extracting the OVA file, we can get three files xxx.vmdk, XXX.OVF, XXX.MF.
Extract the OVA file, we can use the 7zip, tar two methods. The following are described separately below.
3.2.1 Tar decompression
to decompress using the tar command, we can upload the OVA file to Linux and then unzip it. as follows:
tar–xf Test-modle.ova
through, we can see the decompression to get xxx.ovf, XXX.VMDK, xxx.mf three files.
where the OVF file represents the configuration of the VM, such as memory size, hard disk size, network connection, and so on. This file is similar to the XML configuration file in KVM virtualization.
the vmdk file is the hard disk file for the VM.
MF files are primarily useful for verifying that the relevant configuration of a VM has been tampered with maliciously.
of course, if you do not want to upload to the Linux system for decompression, we can also download the tar command version of Windows. The download connection is as follows:
http://gnuwin32.sourceforge.net/packages/gtar.htm
after the installation of the download, AR command can not be used directly, we need to manually add the TAR command to the system environment variables. as follows:
after adding the system variable, we then execute the decompression command. as follows:
tar–xf Test-modle.ova
3.2.2 7zip decompression
to use 7zip decompression, we must be under the Windows platform. Install the 7zip software and unzip it. as follows:
through, we can see the OVA file decompression, do get three files test-modle.ovf, TEST-MODLE-DISK1.VMDK, TEST-MODLE.MF.
3.3 Modifying a VM template file
Modify the VM template file, in fact, we only need to modify the OVF file.
under the Linux system, modify the following methods:
Vim test-modle.ovf +96
All we need to do is change the vmware.cdrom.iso of the OVF file by 96 lines to Vmware.cdrom.remotepassthrough.
under Windows systems, modify the following methods:
before modifying.
after the modification.
3.4 Verifying the SHA1 value of a VM template file
after the VM file has been modified, we also verify the SHA1 value of the template file, otherwise we will error when importing the VM template.
we have modified the OVF file as described above, so we just need to verify the file. If we also modify the vmdk file, we also need to verify the file.
after the verification is completed, the obtained SHA1 value can be written into the MF file. Note: The MF file originally has OVF and VDK files that are SHA1 worth.
depending on the verification platform, we describe the authentication methods under Linux and Windows respectively.
3.4.1 Linux under authentication
authentication under Linux is convenient to use the Sha1sum command directly, and then write the SHA1 value of the validated OVF file to the MF file. as follows:
sha1sum test-modle.ovf
Cat TEST-MODLE.MF
3.4.2 authentication under Windows
verification under the Windows platform, we can use the tool FCIV provided by Microsoft to calculate the MD5 and SHA1 hash values of the file. File Checksum Integrity Validator FCIV is a command prompt tool that calculates and verifies the encrypted hash value of a file. FCIV computes the SHA1 or MD5 cryptographic hash value. These values can be displayed on the screen or saved for later use and to validate the XML file database.
FCIV Common examples are as follows:
FCIV D:\mydir\myfile.exe (calculates MD5 value of MyFile.exe under D-Disk Mydir folder)
FCIV D:\MYDIR\MYFILE.EXE-SHA1 (calculates SHA1 value of MyFile.exe under D-Disk Mydir folder)
after the download FCIV is run, unzip it and you will be prompted to put it under that folder. The extracted folder contains only two files Fciv.exe, Readme.txt.
now we start using the FCIV command to verify the SHA1 value of the OVF, as follows:
FCIV TEST-MODLE.OVF-SHA1
Verify that the resulting SHA1 value is written to the MF file as follows:
3.5 Generating an OVA file
once the VM template file has been validated, we will now package the OVF, VMDK, MF files into an OVA file.
to package an OVA file, we currently need to package it using the tar command. as follows:
tar-cf Test-modle.ova test-modle.ovf test-modle-disk1.vmdk test-modle.mf
Note: The order of the TAR Package command files above must be in the format above, or vcenter will error when importing the VM template.
The requirements for the file Order of the OVF compression package are that the OVF file must be the first, then the virtual machine image file (such as VMDK), then the MF file, followed by other optional files (such as certificates, etc.).
for the package of OVF files, you can refer to this connection:
http://mingjin.thoughtworkers.org/?cat=24
3.6 importing VM templates
after the VM template file has been modified, we choose to import it into the new vcenter. as follows:
The template to this VM has been imported.
Iv. About one ESXi is connected by multiple VCs
sometimes when using vcenter, you encounter such problems. An ESXi is used by other vcenter. At this point, the vcenter we use will show that the ESXi node is offline. as follows:
If you want to reconnect the ESXi, proceed as follows:
Slime: vcenter deploys VMS through templates