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.

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.

This entry was posted in Linux and tagged . Bookmark the permalink.

4 Responses to How to run KVM without X

  1. Jonathan says:

    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.

  2. Karl Pettersson says:

    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.

  3. bodhi.zazen says:

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

  4. kk says:

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

Leave a Reply

Your email address will not be published. Required fields are marked *