Difference between revisions of "Installation (KVM)"

From vwiki
Jump to navigation Jump to search
(Added Allow VNC Console Access)
Line 2: Line 2:
This guide assumes you have a working Ubuntu Server with one physical NIC that will used for networking to the host server, and also for a bridged network for guest virtual machines.
This guide assumes you have a working Ubuntu Server with one physical NIC that will used for networking to the host server, and also for a bridged network for guest virtual machines.


Ensure your server has CPU's that support hardware virtualisation, you should get one output of flags per CPU (which will include either <code>svm</code> or <code>vmx</code>)
Ensure your server has CPU's that support hardware virtualisation, you should get one output of flags per CPU (which will include either <code>svm</code> or <code>vmx</code>).  If you don't, reboot the server into BIOS and see if there is an option to enable CPU Virtualisation features or VT, if you don't your hardware may too old to support virtualisation.  If your hardware is recent, it should, so consult your vendors documentation (either for the server, or for the server's motherboard).
   egrep '(vmx|svm)' /proc/cpuinfo
   egrep '(vmx|svm)' /proc/cpuinfo
Ensure your server can run KVM hardware acceleration.  Install <code>cpu-checker</code> and run as follows...
  apt install cpu-checker
  kvm-ok
...which should return...
INFO: /dev/kvm exists
KVM acceleration can be used


== Installation ==
== Installation ==

Revision as of 18:05, 10 April 2020

Prerequisites

This guide assumes you have a working Ubuntu Server with one physical NIC that will used for networking to the host server, and also for a bridged network for guest virtual machines.

Ensure your server has CPU's that support hardware virtualisation, you should get one output of flags per CPU (which will include either svm or vmx). If you don't, reboot the server into BIOS and see if there is an option to enable CPU Virtualisation features or VT, if you don't your hardware may too old to support virtualisation. If your hardware is recent, it should, so consult your vendors documentation (either for the server, or for the server's motherboard).

 egrep '(vmx|svm)' /proc/cpuinfo


Ensure your server can run KVM hardware acceleration. Install cpu-checker and run as follows...

 apt install cpu-checker
 kvm-ok

...which should return...

INFO: /dev/kvm exists
KVM acceleration can be used

Installation

Install using the following command

apt-get install qemu-kvm libvirt-bin virtinst bridge-utils cpu-checker

Networking

Configuration

Allow VNC Console Access

By default virtual machine consoles are bound to 127.0.0.1 on the host KVM server. So you can't connect from a remote machine using VNC to see the VM's console (unless you tunnel through SSH). Bind to 0.0.0.0 to make remote console access. Note that the VM configuration also needs to be changed to listen on 0.0.0.0.

  1. Edit /etc/libvirt/qemu.conf and uncomment the following line
    • vnc_listen = "0.0.0.0"
  2. Restart libvirtd
    • service libvirtd restart