Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Deploy KVM Virtualization platform-build

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

First, deploy the KVM virtualization platform

Hyper-v is virtualization in windows

1. The KVM module is directly integrated into the Linux kernel. Kvm is the kernel module, and the virtual machine and the kvm module are management tools.

2. KVM composition

1.KVM Driver

-Virtual machine creation

-virtual machine memory allocation

-Virtual CPU register read and write

-Virtual CPU runs

2.QEMU (simplified and modified)

-user control components that simulate PC hardware

-provide the Istroke O device model and access to peripherals

II. Three modes of virtualization

* * 1. Customer mode: typical virtual machine environment (virtual network card, memory, hard disk)

2. User mode: tool layer, the following is the kernel (resource allocation by drivers)

3. Kvm driver: kernel state, uncontrollable (kvm driver receives user mode operation instructions and controls virtual machine kernel state resource allocation).

4. A virtual machine is an independent process, and each hardware in the virtual machine is called a thread.

5. The difference between total deficiency and semi-deficiency

Full virtualization generally optimizes hardware virtualization functions, and its performance is higher than that of semi-virtualization.

Paravirtualization is more flexible because it is based on a common operating system, such as supporting the nesting of virtual machines. Nesting means that you can run KVM again in the KVM virtual machine.

Third, the working principle of KVM

Workflow: first, start a virtualization management software, start a virtual machine, apply for specified resources from the kernel through ioctl and other system calls, build a virtual environment, start the system in the virtual machine, and the system in the virtual machine feedback the relevant resource request processing to the kernel. If it is an io request, it is submitted to the qemu processing in user mode, and the non-io request will feedback the processing result to the customer mode.

IV. KVM practice exercise

1. Installation process

2. Kvm network mode: user (NAT) and bridging mode. This actual operation adopts bridging mode.

3. Graphical management of kvm

4. Add a new hard disk and enable the virtualization feature

5. Partition, format and mount the hard disk (the following is the script)

#! / bin/bashecho "the disks exist list:" fdisk-l | grep 'disk / dev/sd [a dev/sd* z]' echo "=" PS3= "chose which disk you want to create:" select VAR in `disk / dev/sd* | grep-o'sd [BMZ]'| uniq` quitdo case $VAR in sda) fdisk-l / dev/sda break Sd [bmerz]) # create partitions echo "n p w" | fdisk / dev/$VAR # make filesystem mkfs.xfs-I size=512 / dev/$ {VAR} "1" & > / dev/null # mount the system mkdir-p / data/$ {VAR} "1" & > / dev/null echo-e "/ dev/$ { VAR} "1" / data/$ {VAR} "1" xfs defaults 0\ n "> > / etc/fstab mount-a & > / dev/null break ; quit) break;; *) echo "wrong disk,please check again";; esacdone

6. Install a series of tools and environment packages for KVM

# install desktop environment component package yum groupinstall "GNOME Desktop"-y # install KVM module yum install qemu-kvm- y # install KVM debug tool yum install qemu-kvm-tools-y # install command line tool yum install virt-install-y # install qemu component and create disk Start the virtual machine yum install qemu-img-y # install the network support tool yum install bridge-utils-y # install the virtual machine management tool yum install libvirt-y # install the image management virtual machine yum install virt-manager-y # check whether CPU supports virtualization egrep'(vmx | svm)'/ proc/cpuinfo# check whether the kvm module installs lsmod | grep kvm# enable libvirtd service systemctl start libvirtd# view libvirtd service status systemctl status libvirtd# boot self-start libvirtd service systemctl enable libvirtd

7. Deploy Virtualization

# switch to mount point cd / data# to create backup directory mkdir vdisk viso# background replication image to backup directory cp-r / mnt/CentOS-7-x86_64-DVD-1708.iso / data/viso/ & # switch network card configuration directory cd / etc/sysconfig/network-scripts/# copy ens33 network card configuration file as template cp-p ifcfg-ens33 ifcfg-br0# for bridging network card edit ens33 network card configuration file vim ifcfg-ens33# Tail append bridge module BRIDGE=br0# edit bridge network card configuration file vim ifcfg-br0# replacement type bridge bridge mode TYPE=bridge# modified to static mode BOOTPROTO=static# renamed NAME=br0# driver name DEVICE=br0# append IP address Mask and Gateway IPADDR=192.168.142.153NETMASK=255.255.255.0GATEWAY=192.168.142.1# restart Network Service service network restart

8. Graphical management

Virt-manager## enables graphical management

Add Storage Pool disk

Add disk Storage Volum

Add Storage Volum

Add Storage Pool iso

By turning off creation, you can configure the generated virtual machine

Start the virtual machine when the host is selected to boot, start the installation, and the kvm virtual machine in linux can be installed.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report