How to run KVM without X
If you have the hardware, KVM , or the Kernel Based Virtual Machine has been a pleasure to work with.
I tend to run it from the command line and because I often run servers which do not require X , I was looking for a way of running the guests independent of X.
The solution was in the man pages, simply add the -vnc none and -daemonize options
kvm -hda /media/KVM/Ubuntu.qcow2 -vnc none -daemonize
- -vnc none = initialize the built in VNC server, but do not start a VNC session.
- - daemonize = detach the KVM guest from the host terminal
With these options the KVM guest is now independent of both your terminal, and more important your X session. This means you can log off (or heaven forbid your X session crashes) and your guest server will continue to run in the background.
Posted in Linux
You could also configure the guest systems to output to a serial port. KVM has support for outputting serial output to your terminal, so you could get away without even having to use VNC.
Comment by Jonathan — January 27, 2009 @ 1:57 am
Also you can use -vnc localhost:0 which makes it possible to connect from another computer that uses X.
You could use “vncviewer -via user@servername localhost:0″.
We run KVM on a bunch of servers none of which uses X and it’s just awesome.
Comment by Karl Pettersson — January 27, 2009 @ 2:45 am
Thank you Karl and Johnathan, those comments are very insightful.
Comment by bodhi.zazen — January 27, 2009 @ 9:58 am
Using libvirt makes this even easier when you can administer virtual machines from virsh console.
Comment by kk — January 27, 2009 @ 10:03 am