Linux - Virtualization on enterprise LINUX
Deploy systems
[toc]
Virtualization on enterprise LINUX
KVM provides
- Overcommit of physical resources. (CPU, RAM, Hard drive space)
- agent on guest to communicate with hypervisor. (host can send commands to it directly)
- Disk I/O throttling. (limit the disk resources a VM gets)
- Virtual CPU hot add. (add virtual VPU when the VM is running)
- Nested virtualization. (run hypervisor in VM so can run more VMs on it)
To speed up virtualization KVM supports:
- hardware passthrough
- paravirtualized drivers
- PCI function passthrough
the KVM hypervisor’s managed with a libvert API
and tools like virt-manager GUI tool
and virsh command tool
prepare the host for Virtualization
install
ref:
https://help.ubuntu.com/community/KVM/Installation https://bugzilla.redhat.com/show_bug.cgi?id=1753146
Pre-installation checklist
Check that your CPU supports hardware virtualization
To run KVM, need a processor supports hardware virtualization.
Intel and AMD both have developed extensions for their processors, deemed respectively Intel VT-x (code name Vanderpool) and AMD-V (code name Pacifica).
check processor supports:
1
2
3
egrep -c '(vmx|svm)' /proc/cpuinfo
- 0 CPU doesnt support hardware virtualization.
- 1 or more it does - but still need to make sure that virtualization is enabled in the BIOS.
By default, booted into XEN kernel it will not display svm or vmx flag using the grep command.
- To see if it is enabled or not from xen, enter:
cat /sys/hypervisor/properties/capabilities
You must see hvm flags in the output.
1
2
3
4
5
6
7
8
9
10
11
kvm-ok
# provide an output like this:
INFO: /dev/kvm exists
KVM acceleration can be used
# If you see :
INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used
# can still run virtual machines, but it'll be much slower without the KVM extensions.
# NOTE: You may see a message like "KVM acceleration can/can NOT be used". This is misleading and only means if KVM is *currently* available (i.e. "turned on"), *not* if it is supported.
Use a 64 bit kernel (if possible)
Running a 64 bit kernel on the host operating system is recommended but not required.
- To serve more than 2GB of RAM for your VMs, you must use a 64-bit kernel (see 32bit_and_64bit). On a 32-bit kernel install, you’ll be limited to 2GB RAM at maximum for a given VM.
- Also, a 64-bit system can host both 32-bit and 64-bit guests. A 32-bit system can only host 32-bit guests.
check if processor is 64-bit:
1
2
3
4
5
egrep -c ' lm ' /proc/cpuinfo
- 0 CPU is not 64-bit.
- 1 or higher, it is.
Note: lm stands for Long Mode which equates to a 64-bit CPU.
check if running kernel is 64-bit
1
2
3
4
5
6
uname -m
#
- x86_64 a running 64-bit kernel.
- i386, i486, i586 or i686 a 32-bit kernel.
Note: x86_64 is synonymous with amd64.
Installation of KVM
Install Necessary Packages For the following setup, we will assume that you are deploying KVM on a server, and therefore do not have any X server on the machine.
to install a few packages first:
1
2
3
4
5
6
7
8
9
10
11
12
# install
$ sudo yum install qemu-kvm libvirt virt-manager libvirt-client
# install by group
$ sudo yum group install "Virtualization Client"
# star libvert service
$ sudo systemctl start libvirtd
# make it persistent
$ sudo systemctl enable libvirtd
$ reboot
install CentOS into a guest VM interactively.
use virt-manager
- application –> system tools –>
Virtual machine manager
- login
- create a new virtual Machine.
warning:
- VTs not enables: check the BIOS, make sure it turns on.
- KVM kernel module didn’t get loaded: make sure install all package, enable
libvirtd
and reboot it.
- Download the CentOS ISO:
DVD ISO
, save it. - file –> new vm –> local install media –> forward
- Use ISO image: Browse the
DVD ISO
–> forward - Memory: 2048. CPUs: 2. –> forward
- Storage: 9G –> forward
- set the name of VMs.
- Network selection: Host device enp(wired ethernet Devices) wlp (wireless Devices) –> finish
- begin installation of CentOS
- device selection: Partitioning: automatically config partitioning.
- root pwd, user creation
- reboot
- license.
- shut down / power off
- the new VM shows in virt-manager
–
Kickstart files
when install Centos, a kickstart file is autpmatically saved in /root
to repeat the exact installation:
1
2
3
4
$ sudo ls /root
anaconda-ks.cfg initial-setup-ks.cfg
$ lsee -N initial-setup-ks.cfg # -N for lighten numbers
install with Kickstart
prerequisties:
- ISO image or network url share of linux installation files.
- a VM disk image, virtual box…
- a kickstart files
- kickstart file delivery
- virtual machine manager check the new VMs.
- view –> Text consoles: has no graph interface available.
- light bulb bottom –> controller USB –>
- below,
Add hardware
–> Add new virtual hardware –> model:QXL
- below,
Add hardware
–> Graphics –> Type:Spike server
- run again
- view –> Text consoles: now has
Graphical console spice
- setup the license…..
- restart. finish.
configure VMs to communicate
- light bulb bottom –> NIC –> network source: enp**
do for each VMs, they will be able to ping each other.
virsh
.
Comments powered by Disqus.