How to Install and Configure KVM on Ubuntu 18.04 LTS Server

15 Responses

  1. Mac says:

    Great article.. straight to the point..

  2. Steve says:

    Helpful – but virt-install wasn’t recognised for me, I had to install virtinst also:
    sudo apt install virtinst
    Also I needed to replace –location with –cdrom and remove the extra-args (even though I was not using a cd rom, otherwise I got a ‘Couldn’t find hvm kernel .. error)

    • Smarty says:

      Its because of wrong ISO! Do not use the cloud based standard version – instead use the alternativ: at the moment:
      ‘http://cdimage.ubuntu.com/releases/18.04.2/release/ubuntu-18.04.2-server-amd64.iso’
      If you get an Error 404 there is a newer version. Check instead
      ‘http://cdimage.ubuntu.com/releases’

  3. Gannet says:

    I think it is better to remove netplan and use networkd to configure network including bridges. But thanks for how to use netplan for creating bridges. Now I know it.

  4. Chitzle says:

    Sorry if this is sill question but why do we configure the br0 with a static IP and not the hardware interface ens33? Does this result in the host and the guest OS using the same IP?

    • Pradeep Kumar says:

      Hi Chitzle,

      If you want your virtual machines to be accessed from outside of KVM host then you need to create a bridge, remove the IP from eth0 or ens33 and assign the same ip to bridge interface.
      Map VMs interface to the bridge either via command line or virt-manager.After that you can assign the IP from the VLAN which is associated to bridge.

  5. MikeP says:

    Everything seemed to work, but I don’t see the new vm assigned its own IP via dhcp as I expected.
    ‘This is my xml dump

    virsh dumpxml Node01

    Node01
    dc38066a-f428-4990-b2d1-cf88c6b346a2
    4194304
    4194304
    2

    /machine

    hvm

    Opteron_G5
    AMD

    destroy
    restart
    destroy

    /usr/bin/kvm-spice

    libvirt-dc38066a-f428-4990-b2d1-cf88c6b346a2
    libvirt-dc38066a-f428-4990-b2d1-cf88c6b346a2

    +64055:+115
    +64055:+115

  6. MAksym says:

    GUYS,

    ALWAYS use YAML validators BEFORE you make ANY changes in vi /etc/netplan/50-cloud-init.yaml

    Thanks author for article.

  7. Arvind Pal says:

    Very nice article, step by step very helpful, Thanks

  8. Michael Cooper says:

    You must have installed this on a desktop because I cannot get virt-manager to work I get an error that it cannot start because of something with GTK-warning

    [email protected]:~$ sudo virt-manager
    [email protected]:~$ Unable to init server: Could not connect: Connection refused
    Unable to init server: Could not connect: Connection refused
    Unable to init server: Could not connect: Connection refused

    (virt-manager:1875): Gtk-WARNING **: 17:59:02.848: cannot open display:

    Anyone have a luce as to why it’s not starting?

    Thanks,
    Michael

  9. anonym says:

    The following packages have unmet dependencies:
    virt-manager : Depends: python2.7 but it is not going to be installed
    Depends: python:any (>= 2.7.5-5~)
    Depends: python-gi but it is not going to be installed
    Depends: python-gi-cairo but it is not going to be installed
    Depends: python-dbus but it is not going to be installed
    Depends: python-requests but it is not going to be installed
    Depends: python-libvirt (>= 0.7.1) but it is not going to be installed
    Depends: virtinst (>= 1:1.5.1-0ubuntu1) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    And I can not install python2.7 🙁

  10. JV says:

    Step:4 .. are you adding or editing your current file?
    if I add the suggested settings then I lose network connection.
    How does the final full file of 50-cloud-init.yaml look like?

    • Pradeep Kumar says:

      Hi ,

      You should not loose your network connection as we are assigning the same IP of our Lan card to a bridge. In my case i am editing the existing file.

      Make sure you put lines in correct format as it a YAML file.

  11. Askar says:

    To check virtualization support the command should be …
    egrep -c ‘(vmx|svm)’ /proc/cpuinfo

Leave a Reply to Gannet Cancel reply

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