Difference between revisions of "Install KVM in an Ubuntu Server"

From wikieduonline
Jump to navigation Jump to search
Line 58: Line 58:
  
 
Optional software to install:  
 
Optional software to install:  
* <code>apt-get install [[virt-top]] [[libguestfs-tools]]</code>
+
* <code>apt-get install [[virt-top]] [[libguestfs-tools]] [[virtinst]]</code>
  
 
== Related commands ==
 
== Related commands ==

Revision as of 10:29, 4 February 2020

Install KVM in an Ubuntu Server following https://help.ubuntu.com/community/KVM/Installation instructions for Ubuntu 18.10 LTS:

Verify

  • Check processor supports virtualisation:

egrep -c '(vmx|svm)' /proc/cpuinfo If output is 0 it means that your CPU doesn’t support hardware virtualization. If output is 1 or more it support hardware virtualisation ( NOTE: virtualisation should be enabled in the system BIOS)

  • Now Install kvm-ok utility using below command, it is used to determine if your server is capable of running hardware accelerated KVM virtual machines.

sudo apt install cpu-checker and run kvm-ok command and verify the output.

Install KVM

  • Execute:

sudo apt-get -y install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst && virsh list --all

virsh list --all
 Id    Name                           State
----------------------------------------------------

Following Ubuntu Documentation about KVM related Packages:

  • libvirt-bin: provides libvirtd which you need to administer qemu and kvm instances using libvirt
  • qemu & qemu-kvm: (kvm in Karmic and earlier) are the backend
  • bridge-utils provides a bridge from your network to the virtual machines

Start & enable libvirtd service

Exceute the folowing comands:

  • sudo service libvirtd start
  • service libvirtd status

Output:

● libvirtd.service - Virtualization daemon
   Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-01-24 14:35:04 +04; 14min ago
     Docs: man:libvirtd(8)
           https://libvirt.org
 Main PID: 8217 (libvirtd)
    Tasks: 19 (limit: 32768)
   Memory: 17.2M
   CGroup: /system.slice/libvirtd.service
           ├─8217 /usr/sbin/libvirtd
           ├─8558 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro 
           └─8559 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro



And create your fist guest machine from command line using virt-install python script.

virt-install --virt-type kvm --name buster-amd64 --memory 1G --cdrom ~/iso/Debian/debian-10.0.0-amd64-netinst.iso --disk size=10G --os-variant debian10


Optional software to install:

Related commands

Packages

See also

Advertising: