| | 1 | = KVM Installation = |
| | 2 | |
| | 3 | KVM, (kernel-based Virtual Machine) is a free and opensource virtualization platform for the Linux kernel. When installed on a Linux system, it becomes a Type-2 hypervisor. |
| | 4 | |
| | 5 | Here we look at how to install KVM on Ubuntu 20.04 LTS. |
| | 6 | |
| | 7 | First update the Ubuntu package repository. |
| | 8 | |
| | 9 | Before installing KVM on Ubuntu, we are first going to verify if the hardware supports KVM. A minimum requirement for installing KVM is the availability of CPU virtualization extensions such as AMD-V and Intel-VT. |
| | 10 | |
| | 11 | To check whether the Ubuntu system supports virtualization, run the following command. |
| | 12 | |
| | 13 | {{{ |
| | 14 | egrep -c '(vmx|svm)' /proc/cpuinfo |
| | 15 | }}} |
| | 16 | |
| | 17 | An outcome greater than 0 implies that virtualization is supported |
| | 18 | |
| | 19 | To check if your system supports KVM virtualization execute the command |
| | 20 | {{{ |
| | 21 | sudo apt install cpu-checker |
| | 22 | sudo kvm-ok |
| | 23 | }}} |
| | 24 | |
| | 25 | With the confirmation that our system can support KVM virtualization, we are going to install KVM, To install KVM, virt-manager, bridge-utils and other dependencies, run the command |
| | 26 | |
| | 27 | {{{ |
| | 28 | apt install -y qemu qemu-kvm libvirt-daemon libvirt-clients virt-manager bridge-utils |
| | 29 | }}} |
| | 30 | |
| | 31 | Before proceeding further, we need to confirm that the virtualization daemon – libvritd-daemon – is running. To do so, execute the command |
| | 32 | |
| | 33 | {{{ |
| | 34 | sudo systemctl status libvirtd |
| | 35 | systemctl enable --now libvirtd |
| | 36 | }}} |
| | 37 | |
| | 38 | Check if KVM modules are loaded, |
| | 39 | {{{ |
| | 40 | lsmod | grep -i kvm |
| | 41 | }}} |
| | 42 | |
| | 43 | [[Image(https://ws.learn.ac.lk/raw-attachment/wiki/Csle2022/Agenda/databaseandweb/web1.png)]] |
| | 44 | |
| | 45 | To view available Guest os variants, |
| | 46 | |
| | 47 | {{{ |
| | 48 | apt install libosinfo-bin |
| | 49 | osinfo-query os |
| | 50 | }}} |
| | 51 | |
| | 52 | = Creating a Virtual Machine = |
| | 53 | |
| | 54 | sudo virt-install --name perfsonar --os-variant centos7.0 --vcpus 4 --ram 16384 --cdrom /home/lg/downloads/pS-Toolkit-4.4.4-CentOS7-FullInstall-x86_64-2022Apr04.iso --network bridge=virbr0,model=virtio --graphics vnc,listen=0.0.0.0 --noautoconsole --disk size=100 |