Skip to content

Instantly share code, notes, and snippets.

@hortinstein
Last active September 12, 2018 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hortinstein/9d701b1b3bdecfa435407b3646ecd199 to your computer and use it in GitHub Desktop.
Save hortinstein/9d701b1b3bdecfa435407b3646ecd199 to your computer and use it in GitHub Desktop.

There are a lot of ways to create a virtual machine using kvm in linux. I will introduce the one I think is the most convenient.

Assumptions:

  1. Ubuntu 14.04 or later.
  2. Native system (physical machine).

Step by Step:

  1. install qemu-kvm, libvirt-bin and check if hardware supports the necessary virtualization extesions for KVM.

    sudo apt install qemu-kvm libvirt-bin
    kvm-ok
  2. install uvtool and uvtool-libvirt

    sudo apt -y install uvtool
  3. synchronize one specific cloud-image. Use xenial(16.04) for example here.

    uvt-simplestreams-libvirt sync release=xenial arch=amd64
  4. create ssh key if you don't have one.

    ssh-keygen
  5. create a new virtual machine

    uvt-kvm create firsttest release=xenial
  6. connect to the running VM

    uvt-kvm ssh firsttest --insecure

Reference:

https://help.ubuntu.com/lts/serverguide/virtualization.html

Other options:

  1. qemu-kvm: directly using qemu-kvm gives you flexibility, but you need setup everything yourself.
  2. virt-manager: a gui-based tool, very intuitive to use, but you need GUI somewhere.
  3. ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment