Virtualization With Kvm in Centos6

Author : Elizabeth Huston789
Publish Date : 2021-04-19 06:42:39


Introduction to KVM

Kernel-based Virtual Machine (KVM) is a virtualization infrastructure for the Linux kernel. KVM supports native virtualization (where we can simulate a complete hardware environment on which we can run unmodified guest operating system) on processors with hardware virtualization extensions (Intel VT or AMD-V). It consists of a loadable kernel module, kvm.ko, that provides the core virtualization infrastructure and a processor specific module, kvm-intel.ko or kvm-amd.ko. The kernel component of KVM is included in mainline Linux, as of 2.6.20. KVM is an opensource software, KVM's parts are licensed under various GNU licenses.

In the KVM architecture the virtual machine is implemented as regular Linux process. This allows KVM to benefit from all the features of the Linux kernel. Device emulation is handled by a modified version of QEMU. Since KVM is a part of Linux any hardware device supported by Linux can be used by KVM.

libvirt is an open source API, daemon and management tool for managing platform virtualization. It can be used to manage Linux KVM, Xen, VMware ESX, qemu and other virtualization technologies. Libvirt is used by various virtualization programs/softwares/platforms. Graphical Interfaces are provided by Virtual Machine Manager and others. The most popular command line interface is (virsh), and higher level tools like oVirt.

Implementing KVM with CentOS

1. Checking the processor compatibility.

For Intel Processors grep vmx /proc/cpuinfo --color

For AMD processors grep svm /proc/cpuinfo --color

If we get any output for the above commands that indicate our processor is compatible for KVM.

Sample output for Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz is given below

flags: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm dts tpr_shadow vnmi flexpriority

flags: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm dts tpr_shadow vnmi flexpriority

2. Installing and running KVM Packages

 

https://canvas.usao.edu/eportfolios/1059/Home/Visionary_AssociateAndroidDeveloper_Exam https://canvas.usao.edu/eportfolios/1059/Home/Innovative_ATA_Exam https://canvas.usao.edu/eportfolios/1059/Home/Real_ATA02_Exam https://canvas.usao.edu/eportfolios/1064/Home/Innovative_ATM_Exam https://canvas.usao.edu/eportfolios/1064/Home/Ideal_ATTA_Exam

 

 

yum install kvm libvirt virt-manager bridge-utils

service libvirtd restart

Package Description(As given by 'yum info')

kvm: A full virtualization solution for Linux on x86 hardware.

libvirt: A C toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes).

virt-manager: Virtual Machine Manager provides a graphical tool for administering virtual machines for KVM, Xen, and Qemu.

bridge-utils: This package contains utilities for configuring the linux ethernet bridge. The linux ethernet bridge can be used for connecting multiple ethernet devices together.

From this point we can use tools like virsh or virt-manager to manage your virtual machine.

3. Configuring Ethernet Bridge

NetworkManager service need to be stopped while working with bridge.

service NetworkManager stop

chkconfig NetworkManager off

Create a file /etc/sysconfig/network-scripts/ifcfg-br*

DEVICE=br*

ONBOOT=yes

TYPE=Bridge

BOOTPROTO=none

IPADDR=<IP_Address>

NETMASK=<Subnet_Mask>

GATEWAY=<Default_Gateway>

Edit the interface files(/etc/sysconfig/network-scripts/ifcfg-eth*) as given below

DEVICE=eth*

ONBOOT=yes

BRIDGE=br0

TYPE=Ethernet

Restart the network service

service network restart

We can manage the VMs with the graphical tool virt-manager (Virtual Machine Manager) or command line tools like virsh or virt install. For more information about the options available with it you can see the man pages. These commandline tools are very useful in creating scripts for managing Vms.

We can create a virtual machine and start PXE installation by running the command given below.
Introduction to KVM

Kernel-based Virtual Machine (KVM) is a virtualization infrastructure for the Linux kernel. KVM supports native virtualization (where we can simulate a complete hardware environment on which we can run unmodified guest operating system) on processors with hardware virtualization extensions (Intel VT or AMD-V). It consists of a loadable kernel module, kvm.ko, that provides the core virtualization infrastructure and a processor specific module, kvm-intel.ko or kvm-amd.ko. The kernel component of KVM is included in mainline Linux, as of 2.6.20. KVM is an opensource software, KVM's parts are licensed under various GNU licenses.

In the KVM architecture the virtual machine is implemented as regular Linux process. This allows KVM to benefit from all the features of the Linux kernel. Device emulation is handled by a modified version of QEMU. Since KVM is a part of Linux any hardware device supported by Linux can be used by KVM.

libvirt is an open source API, daemon and management tool for managing platform virtualization. It can be used to manage Linux KVM, Xen, VMware ESX, qemu and other virtualization technologies. Libvirt is used by various virtualization programs/softwares/platforms. Graphical Interfaces are provided by Virtual Machine Manager and others. The most popular command line interface is (virsh), and higher level tools like oVirt.

Implementing KVM with CentOS

1. Checking the processor compatibility.

For Intel Processors grep vmx /proc/cpuinfo --color

For AMD processors grep svm /proc/cpuinfo --color

If we get any output for the above commands that indicate our processor is compatible for KVM.

Sample output for Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz is given below

flags: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm dts tpr_shadow vnmi flexpriority

flags: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm dts tpr_shadow vnmi flexpriority

2. Installing and running KVM Packages

yum install kvm libvirt virt-manager bridge-utils

service libvirtd restart

Package Description(As given by 'yum info')

kvm: A full virtualization solution for Linux on x86 hardware.

libvirt: A C toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes).

virt-manager: Virtual Machine Manager provides a graphical tool for administering virtual machines for KVM, Xen, and Qemu.

bridge-utils: This package contains utilities for configuring the linux ethernet bridge. The linux ethernet bridge can be used for connecting multiple ethernet devices together.

From this point we can use tools like virsh or virt-manager to manage your virtual machine.

3. Configuring Ethernet Bridge

NetworkManager service need to be stopped while working with bridge.

service NetworkManager stop

chkconfig NetworkManager off

Create a file /etc/sysconfig/network-scripts/ifcfg-br*

DEVICE=br*

ONBOOT=yes

TYPE=Bridge

BOOTPROTO=none

IPADDR=<IP_Address>

NETMASK=<Subnet_Mask>

GATEWAY=<Default_Gateway>

Edit the interface files(/etc/sysconfig/network-scripts/ifcfg-eth*) as given below

DEVICE=eth*

ONBOOT=yes

BRIDGE=br0

TYPE=Ethernet

Restart the network service

service network restart

We can manage the VMs with the graphical tool virt-manager (Virtual Machine Manager) or command line tools like virsh or virt install. For more information about the options available with it you can see the man pages. These commandline tools are very useful in creating scripts for managing Vms.

We can create a virtual machine and start PXE installation by running the command given below.



Catagory :general