Archive

Qemu And VNC


Qemu and VNC

A very nice feature of qemu is using it with a VNC server on the host machine. What can you do with it? You can basically run qemu “inside” a VNC server and then control that virtual machine from anywhere (your LAN, your Internet connection).

The instructions below were tested on qemu version 0.7.2-1 (Debian) with vnc4server version 4.0-8 (Debian).

How?

On the host machine (where you run qemu from) open an xterm and run the following:

vnc4passwd vnc4server :1 -geometry 800x600 -alwaysshared -depth 16 export DISPLAY=:1.0

Now in the same xterm you can run qemu. The command below is an example and will start an installation of FreeBSD:

qemu -cdrom ~/downloads/6.0-RELEASE-i386-bootonly.iso -hda ~/vm/FreeBSD.img -boot d -user-net -m 384 -localtime -full-screen

Note in the command above the -full-screen option.

Connecting

With the above completed you can go to another machine on your network and run a VNC viewer to connect to the host on display 1. Once authenticated and connected you should be able to see your qemu virtual machine in all its glory!

Other notes

You could create a shell script to setup the VNC server, export the display and qemu and push that in to the background to make things simple in the future.

Leave a Reply