LinuxCBT KVM Edition Notes
LinuxCBT KVM Edition Notes
Features:
1. Kernel-based Virtual Machine (KVM)
2. http://linux-kvm.org - for more information
3. Extends the kernel via:
a. kvm.ko - core module regardless of platform (x86(32-bit) || amd64(64-bit)) -
allows kernel to become Hypervisor
Note: With KVM, we retrofit || modify existing kernel to become a hypervisor
4. Provides the following:
b. Exposes: '/dev/kvm' - for usage by HOST manager (typically: QEMU - provides
emulated environment)
c. Requires processor with virtualization extensions: Intel-VT || AMD-V(SVM)
Note: Intel-VT || AMD-V(SVM) accelerate virtualization of guests - improves
performance
Note: It may be necessary to enable hardware virtualiztion via system bios
(possibly disabled by default)
5. Included in mainline kernel since: 2.6.20 - basically included in ALL Linux
distributions over the past couple years
6. Backporting of KVM for < 2.6.20 kernels is possible but ill-advised
7. Supports common GUESTs:
a. Linux
b. BSD
c. Windows
8. Supports following bit configurations:
a. 32 | 64-bit support
b. If HOST = 32-bit, then it may host 32-bit GUESTs
c. If HOST = 64-bit, then it may host: 32 | 64-bit GUESTs
Note: If double-virtualizing, ensure that HOST hypervisor is configured to allow
64-bit flow-through:
i.e. with VMWare ESXi, typically: 'vhv' support must be set to true on a per HOST
basis
Note: If possible, dedicated hardware exclusively to KVM
d. Up to 16-CPUs for GUESTs
e. Up to 160-CPUs for HOST
Note: Based on current (Spring 2014) KVM specs - subject to increases
Note: Despite ubiquitous availability of ample hardware, heavy LAMP workloads
require litte in terms of: CPU, RAM, Storage
Note: Windows introduces an exception in that it is RAM-hungry
# KVM Installation #
Tasks:
1. Confirm Virtualization support
a. 'egrep '(vmx|svm)' /proc/cpuinfo'
Note: .170 reveals support, .171 does NOT. Debug via ESXi
2. Install
a. 'sudo aptitude install qemu-kvm'
b. 'dpkg -l | grep qemu'
c. 'lsmod' - confirm: 'kvm.ko' && 'kvm_intel.ko' are loaded
3. Explore environment
a. 'dpkg -L qemu-common' - various BIOS and network scripts
b. 'dpkg -L qemu-utils' - Network Block Device (NBD) 'qemu-nbd' && image utility
'qemu-img'
c. 'dpkg -L bridge-utils' - provides bridges to physical interfaces
auto br0
iface br0 inet static
address 192.168.75.170
netmask 255.255.255.0
gateway 192.168.75.1
dns-nameservers 192.168.75.101 192.168.75.1
#Bridge Configuration
bridge_ports eth0
bridge_stp off
bridge_maxwait 0
bridge_fd 0
'
Note: Ensure that 'uname -a' returns 'x86_64' or 'amd64' - otherwise, support for
64-bit GUESTs will be disabled
# VM Deployment #
Tasks:
1. '/etc/libvirt' - config files
2. '/var/lib/libvirt' - main container of VMs and associated files
a. '/var/lib/libvirt/images' - contains VM images and optionally ISO images for
installation
Note: Like other Hypervisors, VM images may be stored anywhere there is ample
storage: i.e. LVM, raw device, NFS, SAN, NAS, etc.
b. '/var/lib/libvirt/network/default.xml' - Default 'NAT' network for GUESTs
using NAT instead of briding: 192.168.122.0/24 with .1 as the routed (NATed)
interface and available addresses of: .2 -> .254
5. Post-installation
a. Confirm IP settings (DHCP=default)
b. Update IP config
c. Communicate in and out
Tasks:
1. Install 'virt-viewer'
Tasks:
1. Clone via GUI
a. 'virt-manager' - shut SOURCE then clone then boot TARGET and configure