Creating Windows VM OS Template
To prepare a Windows VM for selling, you need to do the following:
- Create and configure Windows VM
- Create OS template based on the prepared Windows VM
Let's consider an example how to create and configure OS template based on prepared VM with installed Windows Server 2012.
Creating and configuring a new virtual machine includes the following steps:
-
Check the supported OS distributions by running the following command:
# prlctl create VM_win2012 --distribution list
-
Create a virtual machine with the name of VM_win2012, adjust its configuration for installing the Windows Server 2012 operating system in it.
# prlctl create VM_win2012 --distribution win-2012 --vmtype vm
-
Enable VNC support in the virtual machine, specify the TCP port number on the physical server that will be used to listen to VNC connections for the virtual machine, set a password to secure your VNC connection. You can use any VNC Client, for example TightVNC Viewer (http://www.tightvnc.com/download.php).
# prlctl set VM_win2012 --vnc-mode manual --vnc-port 5901 --vnc-passwd XXXXXXXX
- Copy the image of Windows Server 2012 installation disk to virtualization node where you are going to create Windows VM.
-
Install an operating system in the virtual machine.
-
Mount Windows Server 2012 disk image file in the virtual machine’s CD drive.
# prlctl set VM_win2012 --device-set cdrom0 --image /vz/en_windows_server_2012_vl_x64_dvd_917758.iso
-
Specify the boot order for a virtual machine. Set cdrom0 as the first loaded device to run Windows Server 2012 installation process.
# prlctl set VM_win2012 --device-bootorder cdrom0
-
Start the virtual machine.
# prlctl start VM_win2012
- Log in to VM via VNC Client and install OS following the installation steps. After that VM will be automatically restarted.
-
-
Install Virtuozzo guest tools in the virtual machine, a set of special utilities that facilitate your work with virtual machines. To install Virtuozzo guest tools, do the following:
-
Mount Virtuozzo guest tools image shipped with Virtuozzo to the virtual machine's optical drive.
# prlctl installtools VM_win2012
- Log in to VM via VNC Client. Navigate to the CD drive and launch Virtuozzo guest tools installer manually. Follow the installation steps.
-
-
Configure two virtual network cards for the virtual machine. Virtual machines have one virtual network card in Bridged mode by default, therefore you just need to add one more network card in host-routed mode.
# prlctl stop VM_win2012 --fast # prlctl set VM_win2012 --device-add net --type routed
Note: Make sure that the network cards are configured not to use the DHCP protocol and no network settings (IP addresses, gateways, and so on) are manually set for them. To learn more about configuring network adapters to satisfy the template prerequisites, refer to https://kb.cloudblue.com/114183.
- Make sure no disk images are attached to the virtual machine.
-
Enable the memory hotplug functionality for the virtual machine:
# prlctl set VM_win2012 --mem-hotplug on
-
Enable the CPU hotplug functionality for the virtual machine:
# prlctl set VM_win2012 --cpu-hotplug on
-
Enable automatic updates for Virtuozzo guest tools installed in the virtual machine:
# prlctl set VM_win2012 --tools-autoupdate on
Now the virtual machine is ready for OS template creation. Perform the following command to make OS template:
# prlctl clone VM_win2012 --name VM_winser2012 --template
Windows VM OS Template Prepared with Sysprep
To prepare a Windows VM template which is generalized by means of sysprep
tool, you need to perform additional steps after completing the steps described above in this article:
-
Generalize a Windows VM image following the instruction given here.
Cloud Infrastructure Automation module requires that you use the
Sysprep
command together with the/generalize
,/shutdown
,/oobe
, and/mode:vm
options:%WINDIR%\system32\sysprep\sysprep.exe /generalize /shutdown /oobe /mode:vm
- Shut down a VM and convert it to an OS template.
- Make sure that when you register the prepared OS template in Cloud Infrastructure Automation, the parameter Sysprep is marked for the template.