In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
KVM Virtualization 1. Introduction to KVM Virtualization and Application scenarios
What is KVM Virtualization?
KVM, kernel-level virtualization technology Kernel-based Virtual Machine. KVM virtualization requires hardware support (such as Intel VT technology or AMD V technology). Is full virtualization based on hardware. Virtualization is realized by simulating computer hardware (cpu, memory, hard disk, network card) to run multiple different operating systems on a physical server at the same time, so that each operating system is isolated from each other, and applications can run in independent space and interact with each other, which can achieve dynamic resource allocation, flexible scheduling, cross-domain sharing, and improve resource utilization. To serve the flexible application needs of all walks of life. As a result, the work efficiency of the service provider is significantly improved.
KVM architecture
KVM basically consists of two components:
* the kvm driver is now a module of the Linux kernel, which is mainly responsible for the creation of virtual machines, the allocation of virtual memory, the reading and writing of virtual CPU registers and the operation of virtual cpu. * another component is that Qemu QEMU is a general open source machine simulator and virtual machine. Its main function is to simulate the user space components of virtual machines, provide io device models, and access peripherals.
What is Qemu?
Qemu is a pure software-designed virtualization simulator, which can simulate almost any hardware device. What we are most familiar with is that we can simulate a virtual machine that can run the operating system independently. The virtual machine thinks it is dealing with the virtual machine, but it is actually dealing with the hardware simulated by Qemu. Qemu translates these real instructions into real hardware.
* Technical advantages of virtualization
(1) reduce operating costs (2) improve application compatibility (3) accelerate application deployment (4) improve service availability (5) improve resource utilization (6) dynamically schedule resources (7) reduce energy consumption
KVM application scenario
* scenario 1: there is only one server, but if you want to run multiple versions of the software, different versions still conflict with each other * scenario 2: with the migration of the server room, the physical machine is easily damaged during transportation, resulting in data loss * it is too difficult to deploy 3:openstack in the scenario! The steps are too tedious, how to experience the latest version of openstack* scenario 4: the development environment and test environment are often damaged, and the operation and maintenance staff repeatedly install the system * scenario 5: business expansion requires rapid deployment of 10 identical clusters 2 and installation of KVM virtualization
* Server planning
Operating system hostname, IP address, memory size, hard disk size, CentOS7.4kvm0110.0.0.11/244G100G base environment configuration / / View the current system version [root@kvm01 ~] # hostnamectlStatic hostname: kvm01Icon name: computer-vmChassis: vmMachine ID: 6878674c84644fd381a5e3a82d80cf18Boot ID: fd8e37aca7e4421fa5674fc0fff147e9Virtualization: vmwareOperating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7Kernel: Linux 3.10.0-693.el7.x86_64Architecture: x86-64shock / set host Name [root@kvm01 ~] # hostnamectl set-hostname kvm01// off firewall [root@kvm01 ~] # systemctl stop firewalld [root@kvm01 ~] # systemctl disable firewalld// turn off Selinux [root@kvm01 ~] # sed-I'/ SELINUX=/cSELINUX=disabled' / etc/selinux/config [root@kvm01 ~] # setenforce 0ram / configure hosts resolution [root@kvm01 ~] # echo "10.0.0.11 kvm01" > > / etc/hosts
* confirm to enable virtualization
KVM requires hardware support, so virtualization support needs to be enabled.
1. Hardware devices enable CPU virtualization directly in the BIOS settings.
two。 Personal computers also enter BIOS to enable virtualization support.
3.VM needs to find the corresponding VT-EPT virtualization technology for enabling the virtual machine.
# without any content, the service "virtualization [root@kvm01 ~] # egrep'(vmx | svm)'/ proc/cpuinfo is not enabled.
* install KVM
# install kvm depends on yum install qemu-kvm qemu-kvm-tools libvirt virt-manager virt-install openssh-askpass-y # start libvirtd service systemctl start libvirtd.servicesystemctl enable libvirtd.servicesystemctl status libvirtd.service# Note: after startup, a new virbr0 network will be added to create a bridge network virsh iface-bridge eth0 br0KVM virtual machine to install the CentOS7 system
* install tightvnc software on windows system
`http://www.tightvnc.com``
Upload iso image to / opt directory via xftp
* KVM installs CentOS 7 system
Virt-install-virt-type kvm-os-type=linux-os-variant rhel7-name centos7-memory 1024-vcpus 1-disk / opt/centos2.raw,format=raw,size=10-cdrom / opt/CentOS-7-x86_64-DVD-1708.iso-network network=default-graphics vnc Listen=0.0.0.0-- Overview of noautoconsole// parameters-- virt-type: specify virtual machine type (kvm, qemu, xen)-- name: specify virtual machine name-- raw: specify virtual machine usage memory size-- cpu: specify the number of cores of cpu (default is 1)-- cdrom: specify ISO image installed by virtual machine-- disk: specify virtual machine data storage disk qcow2--network: specify virtual machine network type, default nat Commonly used bridge--graphics: specify virtual machine connectable mode, such as VNC--noautoconsole: connect virtual machine graphical interface console
* the following figure indicates success
* use VNC software to connect
* regular installation of CentOS 7 (change the name of the Nic to eth0 when installing the system. When configuring the network, you can only enable self-startup without configuring the IP address. Select standard partition for disk partition)
* the results show:
KVM virtual machine installs Windows system
Also upload the image of windows to the / opt directory
# create a virtual disk in qcow2 format [root@kvm01 opt] # qemu-img create-f qcow2 windows7.qcow2 + 50G [root@kvm01 opt] # ls-ltotal 18684784 Whitney Rukhok-1 qemu qemu 197120 Dec 5 21:28 centos7.qcow2-rw-r--r-- 1 qemu qemu 1844969472 Dec 5 21:58 Centos7u5.qcow2-rw-r--r-- 1 qemu qemu 4470079488 Dec 4 23:00 CentOS-7-x86_64-DVD-1804.iso-rw-r -- qemu qemu-1 qemu qemu 3420557312 Dec 15 21:08 Windows7.iso-rw-r--r-- 1 root root 9397534720 Dec 16 02:04 windows7.qcow2# virt-install command to create a windows virtual machine [root@kvm01 opt] # virt-install-- name Windows7-- virt-type kvm-- ram 2048-- cdrom=/opt/Windows7.iso-- disk path=/opt/windows7.qcow2-- network bridge=br0-- graphics vnc Listen=0.0.0.0-- noautoconsole# Note: during the Win7 installation process, insufficient memory and disk will cause the system to install slowly or fail
Use VNC software to connect and install Windows
Result figure: (the installation process is slow)
# View all KVM virtual machines [root@kvm01 opt] # virsh list-- all Id Name State----Windows7 running-centos7 shut off
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.