Jan 5, 2012
tom

Install KVM based Windows 2008 remotely over SSH on a headless, no graphics Ubuntu 10.04 server?

Question

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.

Thanks!

Answer

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.

Related posts:

  1. Install KVM based Windows 2008 remotely over SSH on a headless, no graphics Ubuntu 10.04 server?
  2. windows vnc via ssh to kvm guest – connection failed
  3. How to add addtional disks to a Windows 2008 KVM based Guest?
  4. How to install VNC server on windows machine without monitor?
  5. KVM: Can one have a graphical OS as the guess OS running on a host OS such as Ubuntu Server?

Leave a comment