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

From wikieduonline
Jump to navigation Jump to search
m
 
(33 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
Install [[KVM]] in an [[Ubuntu]] Server following https://help.ubuntu.com/community/KVM/Installation instructions for [[Ubuntu 18.10 LTS]]:
 
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:
 
*Check processor supports virtualisation:
Line 9: Line 10:
 
<code>sudo apt install cpu-checker</code> and run <code>kvm-ok</code> command and verify the output.
 
<code>sudo apt install cpu-checker</code> and run <code>kvm-ok</code> command and verify the output.
  
* Execute:
+
==Install KVM==
  
<code>sudo apt-get -y install [[qemu-kvm]] [[libvirt-daemon-system]] [[libvirt-clients]] [[bridge-utils]] [[virtinst]] && [[virsh list --all]]</code>
+
Execute:
 +
* <code>sudo [[apt-get -y install]] [[qemu-kvm]] [[libvirt-daemon-system]] [[libvirt-clients]] [[bridge-utils]] [[virtinst]] && [[virsh list --all]]</code>
  
virsh list --all
+
Verify:
  Id    Name                          State
+
* <code>[[service libvirtd status]]</code>
----------------------------------------------------
 
  
 +
It will create <code>[[virbr0]]</code> and <code>[[virbr0-nic]]</code> interfaces and default network.
 +
[[virsh net-list]]
 +
  Name      State    Autostart  Persistent
 +
--------------------------------------------
 +
default  active  yes        yes
  
And create your fist guest machine from command line using virt-install python script.
 
  
<code>
+
[[brctl show]]
[[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</code>
+
bridge name bridge id STP enabled interfaces
 +
[[virbr]]0 8000.525400d54de6 yes virbr0-nic
 +
 
 +
 
 +
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
 +
* <code>'''[[bridge-utils]]'''</code> provides a bridge from your network to the virtual machines
 +
 
 +
==Start & enable libvirtd service==
 +
 
 +
Exceute the folowing comands:
 +
 
 +
*<code>sudo [[service libvirtd start]]</code>
 +
*<code>[[service libvirtd status]]</code>
 +
 
 +
 
 +
And create your fist guest machine from command line using <code>virt-install</code> python script.
 +
 
 +
* <code>[[virt-install]] --install ubuntu20.04 --memory 500 --disk size=0.2</code>
 +
 
 +
* <code> [[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</code>
  
  
 
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 ==
* <code>[[virt-builder]]</code>
+
* <code>[[virt-builder]]</code> (<code>[[libguestfs-tools]]</code> package)
* <code>[[virt-install]]</code>
+
* <code>[[virt-install]]</code> (<code>[[virtinst]]</code> package)
  
 
== Packages ==
 
== Packages ==
Line 40: Line 66:
  
 
== See also ==
 
== See also ==
 +
* {{KVM installation}}
 
* {{KVM}}
 
* {{KVM}}
  

Latest revision as of 11:39, 28 April 2021

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

Verify[edit]

  • 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[edit]

Execute:

Verify:

It will create virbr0 and virbr0-nic interfaces and default network.

virsh net-list
 Name      State    Autostart   Persistent
--------------------------------------------
default   active   yes         yes


brctl show
bridge name	bridge id		STP enabled	interfaces
virbr0		8000.525400d54de6	yes		virbr0-nic


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[edit]

Exceute the folowing comands:


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

  • virt-install --install ubuntu20.04 --memory 500 --disk size=0.2
  • 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[edit]

Packages[edit]

See also[edit]

Advertising: