I have a Dell server at a remote data center with Ubuntu 10.04 as the host. It is a minimal install with the necessary virtulization packages. There is no X and the machine is headless.

I have the win2008 DVD in the machine and want to remotely install it. I tried:

virt-install --connect qemu:///system -n vmwin2k8 -r 1024 --disk path=server2k8.qcow2,size=50 --cdrom /dev/sr0 --vnc --noautoconsole --os-type windows --os-variant win2k8
  • The qcow2 image gets created; however, I don't understand how to connect to see the install via VNC.

This is my first time doing it so it may be trivial or may not be possible.

Remotely I have a Win 7 machine with Putty and RealVNC viewer.

Where is the graphic output of VNC going? Do I have to have VNC server running on the host or some other machine and then connect to it from my VNC client?

Please let me know or point me to the right direction. I have been searching the web for several days to figure out how this is supposed to work.



I also have a headless server running in a remote datacenter as a KVM host. I quickly got annoyed when trying to keep track of the always changing VNC ports of the guests. My solution was to setup a vncserver with a desktop environment (Gnome in my case) and install virt-manager to handle the virtual machines. It's a much easier way to administrate the guests IMHO. I used this howto from the CentOS Wiki for setting up the VNC-server, the approach should be similar on Ubuntu.

If you don't want to do this and just want it to work with virt-install, first you'll have to figure out on which port the guest VNC-server is running. nmap is a quick way of finding the port on your server:

$ nmap -p 5900-5910 localhost

You can also specificy the port as Joris said, but if you have other guests running, make sure you select a free port.

Once you know the portnumber, you can create a SSH-tunnel from your desktop system to the server with something like:

$ ssh -c blowfish-cbc -N -L 5905:localhost:5905 User@HostIP

You now have a tunnel which maps port 5905 on your desktop machine with port 5905 on your server. You should now be able to use any VNC client to connect to localhost:5 (or localhost:5905) on your desktop system and get access to the guest on :5 on the server.

  • 1
    Some pointers: it's quicker to do a netstat -nlp | grep kvm to find open ports. Depending on the environment (VNC does not have the best security track record), you may want to run an X server locally (xming on windows) and use ssh -X to run the virt-manager. Also, when you specify the port in VNC, use hostname::port, as the first colon denotes the display number. – Joris Jan 16 '11 at 18:45
  • Joris, you have never tried to run virt-manager through SSH-forwarding, right? If you had, you would know that the performance is so bad, that it simply doesn't work on anything slower than a (gigabit?) LAN. virt-manager uses (or at least did use) an animated bar to show when it was working, eg. while creating a new guest. This animated bar makes intensive use of the X protocol, way more than what's possible to passthrough a SSH tunnel. Creating a guest which takes 10 secs on X the host, takes hours or simply fails with X-forwarding over SSH. – Kenni Jan 21 '11 at 20:28
  • Thanks Kenni. I finally installed a light X and got virt-manager to install the VM. So far so good. Ideally I don't want X on the server. For now I just run X only when I need it. – taazaa Jan 31 '11 at 17:12

I don't know what happens if you don't specify the display after vnc. It's probably better to run -vnc

Then the VNC display will be waiting for you on the default port (5900) on the IP.

You can either specify a public IP, but then you need to firewall it, or bind to localhost and do ssh tunneling magic. Afaik the vnc connections are not authenticated, and there is a lot of scanning background traffic going on, script kiddies are probably going to find it within minutes.

Edit: also, libvirt will do this for you, you should check out some of the excellent management tools.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.