KVM (short for Kernel-basedVirtualMachine) is a full-featured virtualization solution on the x86 hardware platform in Linux, including a scalable Kernel module kvm. ko provides and virtualizes core architecture and processor specification modules. Using KVM allows multiple virtual machines, including Linux and Windows, to have private hardware, including NICs, disks, and graphics adapter. After Linux 2.6.20, it is integrated into various major Linux releases.
KVM (short for Kernel-based Virtual Machine) is a full-featured virtualization solution on the x86 hardware platform in Linux. It contains a scalable Kernel module kvm. ko provides and virtualizes core architecture and processor specification modules.
Using KVM allows multiple virtual machines, including Linux and Windows, to have private hardware, including NICs, disks, and graphics adapter. Since Linux 2.6.20 and later, it has been integrated into various major Linux Release versions. It uses the Linux Scheduler for management. Therefore, compared with Xen, its core source code is few. KVM has become one of the mainstream VMM in the academic field.
KVM virtualization requires hardware support (such as Intel VT or amd v ). Is hardware-based full virtualization. In the early days, Xen was based on Para-Virtualization simulated by software. The new version was based on full Virtualization supported by hardware. However, Xen has its own process scheduler and storage management module, so the code is huge. The widely spread commercial system Virtualization software VMware ESX series is also based on software simulation of Para-Virtualization.
KVM schematic
A typical KVM installation includes the following components:
- A device driver that manages Virtual Hardware. This driver exports its functions using a single character device/dev/kvm. Each client has its own address space through/dev/kvm. This address space is separated from the address space of the kernel or from any running client.
- A user space component that simulates hardware. It is a slightly modified QEMU process. Executing I/O from the client operating system will have QEMU. QEMU is a platform virtualization solution that allows virtualization of the entire PC environment (including disks, display cards (graphics cards), and network devices. I/O requests sent by any client operating system are intercepted and routed to user mode for simulation by QEMU.
Check CPU
Unlike Xen, KVM requires CPU support (IntelVT or amd svm). Check whether the CPU supports Virtual Technology before installing KVM:
#Grep-E -- color 'vmx | svm '/proc/cpuinfo
Flags: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat limit 36 clflush dtsacpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm limit bts rep_good limit pni limit monitor limit tm2 ssse3 cx16 xtpr pdcm xsave lahf_lm tpr_shadow vnmi flexpriority
Flags: fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat limit 36 clflush dtsacpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm limit bts rep_good limit pni limit monitor limit tm2 ssse3 cx16 xtpr pdcm xsave lahf_lm tpr_shadow vnmi flexpriority
You can choose to install the RHEL6 series virtualization tool when installing the system (this article is not described here). The main introduction here is the process of installing the virtualization tool using YUM after the system is installed.
Yum installation Virtualization
To use virtualization on RHEL6, install at leastQemu-kvmAndQemu-imgPackage. These installation packages provide user-level KVM simulators and RHEL6 System host disk image management.
#Yum install qemu-kvm qemu-img
Others
#Yum install virt-managerlibvirt libvirt-python-embedded inst libvirt-client virt-viewer
Virt-manager:Virt-manager, also known as Virtual Machine Manager, provides agraphical tool for administering virtual machines. It uses libvirt-clientlibrary as the management API.
Libvirt:He libvirt package provides the server and host side librariesfor interacting with hypervisors and host systems. The libvirt package providesthe libvisors D daemon that handles the library cals, manages implements alized guestsand controls the hypervisor.
Libvirt-python:The libvirt-python package contains a module thatpermits applications written in the Python programming language to use theinterface supplied by the libvirt API.
Python-embedded inst:Provides the virt-install command for creatingvirtual machines. (virt-install command is provided to install the virtual machine)
Libvirt-client:The libvirt-client package provides theclient-side APIs and libraries for accessing libvirt servers. thelibvirt-client package Names des the virsh command line tool to manage andcontrol implements alized guests and hypervisors from the command line or a specialvirtualization shell.
Virt-viewer:To enable the graphical console to install a virtual client
You can also use yum groupinstall
#Yum groupinstall-y Virtualization "Virtualization Client" "Virtualization Platform" "Virtualization Tools"
Birdge networking bridge network
#Vim/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = eth0
HWADDR = xxxxxxxxx
ONBOOT = yes
BRIDGE = br0
#Vim/etc/sysconfig/network-scripts/ifcfg-br0
DEVICE = br0
TYPE = Bridge
BOOTPROTO = static
ONBOOT = yes
IPADDR = 10.1.1.X
NETMASK = 255.255.255.0
GATEWAY = x. x
#Service network restart
#Brctl show
Bridge name bridge id STP enabled interfaces
Br0 8000. b8975a004d66 no eth0
Virbr0 8000.52540077cd54 yes virbr0-nic
If a firewall is set, run the following command to allow access:
#Iptables-I FORWARD-m physdev -- physdev-is-bridged-j ACCEPT
#Service iptables save
#Service iptables restart
#/Etc/init. d/libmongod restart
Disabling the libmongod daemon: [OK]
Start the libmongod daemon: [OK]
#Chkconfig libmongod on