How to run KVM without X

January 27th, 2009 by bodhi.zazen

If you have the hardware, KVM , or the Kernel Based Virtual Machine has been a pleasure to work with.

KVM Home page

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.

StumbleUpon

Posted in Linux

4 Comments »

  1. 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

  2. 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

  3. Thank you Karl and Johnathan, those comments are very insightful.

    Comment by bodhi.zazen — January 27, 2009 @ 9:58 am

  4. Using libvirt makes this even easier when you can administer virtual machines from virsh console.

    Comment by kk — January 27, 2009 @ 10:03 am

RSS feed for comments on this post. TrackBack URL

Leave a comment