Creating a Windows KVM virtual machine on OpenVZ7 / Virtuozzo with prlctl

From vpsget wiki
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In this article, we describe the process of creating a Windows virtual machine based on the OpenVZ 7 hypervisor with the KVM virtualization type. In our case, we will create a Windows Server 2019 virtual machine. Other Windows virtual machines are created in the same way.


Create a virtual machine (use win-2016 as a distribution for Windows Server 2019):

prlctl create WIN-SRV2019 --distribution win-2016 --vmtype vm

Create a virtual cdrom drive and mount the Windows ISO image into it:

prlctl set WIN-SRV2019 --device-add cdrom --image /root/downloads/server2019.iso

Allow VNC access:

prlctl set WIN-SRV2019 --vnc-mode manual --vnc-port 5910 --vnc-passwd YourPassword

Optionally, set a static MAC address:

prlctl set WIN-SRV2019 --device-set net0 --mac 00:11:22:33:44:55

Set the IP address + CIDR, gateway and name server:

prlctl set WIN-SRV2019  --device-set net0 --ipadd X.X.X.X/24 --gw X.X.X.X \
--nameserver 8.8.8.8

Set the number of virtual processor cores:

prlctl set WIN-SRV2019 --cpus 2

Set the RAM size:

prlctl set WIN-SRV2019 --memsize 4G

Set the size of the drive:

prlctl set WIN-SRV2019 --diskspace 80G

Optionally, set the input/output limit (MB/s):

prlctl set WIN-SRV2019 --iolimit 50

Run the created virtual machine:

prlctl start WIN-SRV2019

If the following error appears:

Failed to start the VM: The %1 virtual network cannot be found. Try to choose another network. (Details: Network not found: no network with matching name 'Bridged')

then switch your network adapter to router mode by specifying the virtual machine ID in curly brackets1:

prlctl set {2c03f039-0441-4cf4-8e4c-bd859ccefcd9} --device-set net0 --type routed

If the following error appears:

Failed to start the VM: Operation failed. Failed to execute the operation. (Details: internal error: process exited while connecting to monitor: 2020-02-09T19:26:31.816008Z qemu-kvm: -drive file=/root/downloads/server2019.iso,format=raw,if=none,id=drive-ide0-0-1,readonly=on,cache=none,discard=unmap,aio=native: Could not open '/root/downloads/server2019.iso': Permission denied)

then change the permissions and the owner of the iso image file:

chmod 777 /root/downloads/server2019.iso
chown -R user:user /root/downloads/server2019.iso

Now you need to connect to the hypervisor via the VNC Viewer, specifying its IP address and VNC port, which we set earlier. Install Windows using the standard installer.

If the Windows installer does not see the hard disk (virtual), then stop the virtual machine and run the following command2:

prlctl set WIN-SRV2019 --device-set hdd0 --iface ide

After installing Windows, you can also install OVZ Guest Tools, by stopping the virtual machine before this:

prlctl installtools WIN-SRV2019

If Windows after installation on your virtual machine does not see the network adapter, stop the virtual machine and run the following command:

prlctl set WIN-SRV2019 --device-set net0 --adapter-type rtl

This is because the VirtIO adapter (which is installed by default) is not supported by Windows Server guest operating systems.

This completes the creation of the Windows virtual machine.





1 To find the virtual machine ID enter the command: prlctl list -a

2 To see the virtual machine configuration (eg device name), use the command: prlctl list WIN-SRV2019 -i | grep Hardware -A15