Build Windows VM Template
This guide will help you to enable Windows VM support on the hosts of your platform. Based on your needs, you can configure a separate host exclusively for Windows hosting or use an existing one for mixed Windows VM and Linux containers hosting.
Windows is a proprietary software owned by Microsoft, so you need to purchase a license in order to use and offer it to your customers. License type and price depends on your particular use case and agreement with Microsoft.
The most common option when integrating Windows with the platform is the Datacenter Edition license, which is assigned for a whole host and allows you to create as many VMs inside as you need. You’ll need a separate Datacenter Edition license for each host with the Windows VM support.
If you just want to test the implementation or have a small client base interested in Windows hosting, the Server Standard license can be issued per VM.
The guide’s steps should be performed on the Virtuozzo 7 based host that will be used for the Windows VM hosting.
1. Download the .iso image of the Windows Server 2019 to your host node.
2. Ensure that virtualization is enabled on the host by executing the following command:
If you get an empty response, the virtualization does not work on the host and should be enabled before proceeding further.
3. Create a new virtual machine (VM). Start by defining the required variables, then create, configure, and start VM:
#Distribution. Use the “prlctl create myvm --distribution list” command to list available ones
#Disk size. Use the smallest possible size for the defined distribution
#VNC port and credentials. They will be used during the OS installation
#Path to the .iso image
#Configure Virtual Network Computing (VNC):
#Start VM and connect CD-ROM:
4. Install Windows OS and set up an admin account.
Use the port/password defined in the previous step and external host IP address to connect to the virtual machine via VNC. Ensure that the VNC port is allowed in the firewall.
Once connected, install Windows and set a password for the admin account as usual.
5. Install Virtuozzo Tools. Run the following command on the host:
Then, connect to VM using VNC and execute CD-ROM autorun.
Reboot OS to apply changes.
6. Enable RDP and sysprep your OS. Run commands listed below one by one on the host (do not execute as code block):
#Connect to VM from a host using prlctl utility:
#Start PowerShell session
#Enable RDP and open RDP port in brandmauer
Note: If this command returns an error, run the following one instead:
#Create the “unattend” file for sysprep:
#Add content to u.xml. Execute command listed under the link:
Note: File u.xml is just an example and created for Windows Server 2019. If needed, you can make changes to it.
Requirements for the image created with sysprep:
- accept LUA
- choose language
- create a user account (credentials will be changed after VM creation by the platform)
#Close PowerShell session
Tip: You can apply any additional modifications to your OS.
If you require Internet access to make the necessary changes, it can be configured in the following way:
#Run sysprep using previously created unattend file u.xml.
Wait till VM is stopped (approximately 2-3 minutes).
7. Create a template.
#If needed, substitute windows2019 with the required template name
#Show template UUID
8. Test template.
#Configure limits, disk and networks
#Wait for VM and OS to start
#Change mapsbroker service startup type. It removes some warnings after the first OS start.
#Resize file system
Now, you can access VM using RDP.
#Connect, make some tests, stop, and delete tested VM
#Delete VM used for template creation
9. Migrate template. Spread the template across all the hosts within the host group(s) that will provide Windows VM support. For each of these hosts, perform the following steps:
#Create template clone. Currently, only “windows2019” template name is supported
#Migrate clone to another host
If you need to add a Windows template to the current host - create a clone but do not migrate it.
10. Delete tmp template. After adding a template to all the needed hosts, perform a clean-up and remove the temporary image.
That’s all. You have a fully functional Windows VM template on your hosts and are ready to proceed with the Windows VM Hosting configuration.