Vminit is a component that runs configuration tasks, such as performing network configurations, setting hostnames, and executing custom scripts, to initialize the configurations of a Windows Elastic Compute Service (ECS) instance. If Vminit is not installed on a custom image that you created, install Vminit on the image to ensure that the configurations of ECS instances that use the image can be initialized. This topic describes how to install Vminit on a Windows virtual machine based on which you want to create an image.
For more information about Vminit, see Initialization tools.
Limits
The operations that are described in this topic are suitable for the following Windows operating system versions: Windows 7 and later 32-bit, Windows 7 and later 64-bit, Windows Server 2008 R2 and later 32-bit, and Windows Server 2008 R2 and later 64-bit.
Install Vminit
Vminit versions may be updated. In the following example, Vminit version 2.0.1.2 whose installation program is named AliyunVminit_2.0.1.2_x86_64.exe is downloaded and installed. For information about the Vminit version, see Initialization tools.
Download the Vminit installation package to the virtual machine based on which you want to create an image and decompress the installation package.
Click AliyunVminit.zip to download the Vminit installation package.
Install Vminit.
Install Vminit by using GUI
Find and double-click
AliyunVminit_2.0.1.2_x86_64.exe
in the directory to which you downloaded the Vminit installation package.Install Vminit as prompted.
Click Finish on the page shown in the following figure to complete the Vminit installation.
Install Vminit by using CLI
Run the following command in Windows PowerShell to switch to the directory to which you downloaded the Vminit installation package. Example directory:
C:\test
.cd C:\test
Run the following command to install Vminit:
.\AliyunVminit_2.0.1.2_x86_64.exe /SILENT /FORCE
Note/SILENT
: installs Vminit in silent mode./FORCE
: installs Vminit in force mode and force-overwrites existing Vminit settings.
Check whether Vminit is installed.
Run the following command in Windows PowerShell to query the Vminit version number:
(Get-Item C:\ProgramData\aliyun\vminit\vminit.exe).VersionInfo.ProductVersion
The following command output is returned, which includes a Vminit version number and indicates that Vminit is installed.
Run the following command to obtain the registry configurations of Vminit:
Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Services\vminit"
The following command output indicates that Vminit is installed.
After you perform the preceding operations and verify that Vminit is installed, you can import the images that are created based on the virtual machine to Alibaba Cloud.
(Optional) Configure Vminit
By default, all Vminit plug-ins are automatically executed to initialize an ECS instance when the instance is created. If you create an ECS instance from a custom image and do not want to automatically perform specific operations on instance startup, you can disable the corresponding plug-ins when you create the image.
Create a file in the
C:\ProgramData\aliyun\vminit
directory. The file must meet the following requirements:The file name must be
customized_config
.No suffix is added to the file name.
The content that you want to add to the file must be in the JSON format.
NoteIn most cases, the
ProgramData
directory is hidden. To access the directory, make sure that you select the Show hidden files, folders, and drives option in the operating system, which allows you to view and manage the hidden items.The following section describes how to disable specific plug-ins. In the following examples, the plug-in that automatically assigns instance hostnames and the plug-in that automatically initializes data disks are disabled.
Prevent Alibaba Cloud from assigning instance hostnames and initializing data disks
To prevent Alibaba Cloud from assigning instance hostnames and initializing data disks, disable the Plugin_Main_ConfigHostname and Plugin_Main_ConfigDisk plug-ins. Copy the following data in the JSON format to the
customized_config
file and then save the file:{ "disabledPlugins": ["Plugin_Main_ConfigHostname", "Plugin_Main_ConfigDisk"] }
To re-enable a plug-in, delete the corresponding configuration of the plug-in from the customized_config
file.
FAQ
Why does the operating system restart when I create a Windows instance?
Cause: When the Windows instance is created, Alibaba Cloud automatically assigns a hostname to the instance even if you do not specify a hostname for the instance. The operating system of the Windows instance restarts for the hostname to take effect.
Solution: If you do not want Alibaba Cloud to assign a hostname to the Windows instance and you want to specify a hostname for the instance, disable the Plugin_Main_ConfigHostname plug-in. After you disable the plug-in, Alibaba Cloud does not automatically assign a hostname to the Windows instance.
References
When Vminit is installed, all Vminit plug-ins are automatically enabled. If you want to create an ECS instance from an imported custom image and prevent Vminit from performing specific operations during instance boot, you can disable specific plug-ins when you create the image. For more information, see Initialization tools.
After you install Vminit on a Windows virtual machine based on which you want to create an image, you may need to install the virtio driver on the virtual machine. This way, you can ensure that after an image is created based on the virtual machine, imported to Alibaba Cloud, and used to create ECS instances, the instances can properly recognize virtio virtualization devices and start as expected.
Linux ECS instances use cloud-init to initialize configurations. For more information, see Install cloud-init.