Enable VNC on Existing KVM Instances

This article outlines the steps needed to enable VNC on existing virtual machines.

KVM

Step 1 – Shutdown the Instance

SSH into the host where the virtual machine of interest resides. To shut down the virtual machine gracefully, invoke the following command on the terminal:

[code lang=”bash”]virsh shutdown test-vm[/code]

where test-vm is the name of the virtual machine.

Check to see if the instance is in the shut off state by invoking the following:

[code lang=”bash”]virsh list –all[/code]

You may also SSH into the instance and power off the instance from the terminal.

If all else fails, you may want to shutdown the instance ungracefully (WARNING: This is the equivalent of pulling the power cord):

[code lang=”bash”]virsh destroy test-vm[/code]

Step 2 – Edit the Virtual Machine’s XML Configuration

After verifying that the instance is shut off, open the instance’s XML configuration:

[code lang=”bash”]virsh edit test-vm[/code]

Add the following inside the devices element:

[code lang=”bash”] [/code]

It should look similar to this:

[code lang=”bash”]

.
.
.
[/code]

Step 3 – Start the Instance

Start the instance after saving the configuration:

[code lang=”bash”]virsh start test-vm[/code]

To verify whether the configuration succeeded, run the following on the terminal:

[code lang=”bash”]virsh vncdisplay test-vm[/code]

You should see something similar to this:

[code lang=”bash”]root@localhost:~# virsh vncdisplay test-vm
127.0.0.1:0[/code]

VMware

Enable VNC on VMware deployments

The browser you are using is outdated. For the best experience please download or update your browser to one of the following:

Leaving VMware? Get the VMware alternatives guideDownload Now