Difference between revisions of "Installation (KVM)"

Jump to navigation Jump to search
2,868 bytes added ,  18:27, 10 April 2020
→‎Networking: Added Ubuntu 18 instructions
(Added Allow VNC Console Access)
(→‎Networking: Added Ubuntu 18 instructions)
 
(3 intermediate revisions by the same user not shown)
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 ==
Install using the following command
Install using the following command
  apt-get install qemu-kvm libvirt-bin virtinst bridge-utils cpu-checker
  apt install qemu qemu-kvm libvirt-bin bridge-utils virt-manager
 
Once completed, ensure libvirtd is running
systemctl status libvirtd


== Networking ==
== Networking ==
By default, you'll end up with a new <code>virbr0</code> interface, on which all virtual machines will be deployed to.  These will not be accessible to the outside world, which is sometimes fine for a private lab environment, but otherwise fairly useless.  In order to all your VMs to be accessible, you need to create a new bridge interface, and move your server's IP address onto that.  Once done, VMs can also be provisioned onto the same interface, and will be as accessible as your KVM server.
=== Ubuntu 18.04 ===
Network config is achieved via Netplan, for an existing config such as show...
<pre>
root@kvm-svr:~# cat /etc/netplan/50-cloud-init.yaml.orig
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    ethernets:
        eno1:
            addresses:
            - 192.168.1.50/24
            gateway4: 192.168.10.1
            nameservers:
                addresses:
                - 192.168.1.1
                - 8.8.8.8
                - 8.8.4.4
                search:
                - vwiki.co.uk
    version: 2
</pre>
...add a new bridge network and move most of the config over...
<pre>
root@media-svr:~# cat /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    ethernets:
        eno1:
            dhcp4: no
            dhcp6: no
    bridges:
        br0:
            interfaces:
            - eno1
            dhcp4: no
            addresses:
            - 192.168.1.50/24
            gateway4: 192.168.1.1
            nameservers:
                addresses:
                - 192.168.1.1
                - 8.8.8.8
                - 8.8.4.4
                search:
                - vwiki.co.uk
</pre>
...and apply using...
netplan apply


== Configuration ==
== Configuration ==

Navigation menu