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

Deployment and use of KVM Virtualization

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

I. on Virtualization

1. What is virtualization

Virtualization is a way to transform hardware resources from physical to logical, break the original physical structure, users can manage these resources flexibly, and allow multiple operating systems to run on one physical machine. a technology that maximizes resource utilization and flexible management.

2. Advantages of Virtualization

(1) reduce the number of servers and reduce the purchase cost of hardware.

(2) maximize resource utilization

(3) reduce the cost of computer room space, heat dissipation and electricity consumption.

(4) hardware resources can be adjusted dynamically to improve the flexibility of IT business.

(5) High availability

(6) physical hardware adjustment under continuous service

(7) have more efficient disaster preparedness capability

3. KVM Virtualization

KVM has been directly integrated into the Linux kernel since Linux 2.6.20. It relies on CPU virtualization instruction sets (such as intel-VT, AMD-V) to achieve high-performance virtualization support. Because it is highly integrated with the Linux kernel, it has a good performance in performance, installation, compatibility and stability. In order to fully improve the utilization of the Linux system, KVM can be deployed to run multiple business systems on the physical machine.

4. Difference from Docker

Docker saves more memory than virtual machines, starts faster, and does not need to be installed from the operating system.

Docker isolates containers from the main operating system and isolates containers from each other.

Virtual machines isolate different users, and Docker isolates different applications.

Second, build a KVM virtualization platform

1. System environment

1) A desktop environment version of CentOS7

2) enable CPU virtualization

2. Install the software required by KVM

Yum install-y\

Qemu-kvm.x86_64\ / / install the KVM module

Qemu-kvm-tools.x86_64\ / / install the KVM debugging tool, but not install it

Python-virtinst.noarch\ / / python component, which records the xml component that created the VM

Qemu-img.x86_64\ / / qemu component, create disk, start virtual machine, etc.

Bridge-utils.x86_64\ / / Network support tools

Libvirt\ / / Virtual Machine Management tool

Virt-manager\ / / graphical interface management tool

Openssh-askpass / / graphical interface password component

3. Verify whether the current host meets the running conditions of KVM.

Cat / proc/cpuinfo | egrep-o "vmx | smv" / / intel CPU filter vmx,AMD CPU filter smv

Modprobe kvm

Lsmod | grep kvm

4. Create a bridge network card

Add vi / etc/sysconfig/network-scripts/ifcfg-ens33 / / at the end and remove the IP-related parameters of the Nic.

BRIDGE= "br0"

Vi / etc/sysconfig/network-scripts/ifcfg-br0 / / create a bridged Nic profile

DEVICE=br0

BOOTPROTO=static

# NM_CONTROLLED=no

ONBOOT=yes

TYPE=Bridge

IPADDR=192.168.100.30

NETMASK=255.255.255.0

Systemctl restart network / / restart the network card

5. Create a system and mirror storage pool

Virt-manager / / enter data at the graphics terminal

Add virtual machine file storage location

Add the location of the image file

The image file has been uploaded to the specified directory in advance

Then refresh the volume list

6. Create a new virtual machine

7. Install centos7 (steps such as VMware installation)

Third, use command tools to manage virtual machines

1. Install the command tool

Yum install acpid-y systemctl start acpid / / start virsh list-- all / / View virtual machine status

Virsh shutdown centos7.0 / / equivalent to init 0 virsh start centos7.0 / / boot virsh destroy centos7.0 / / force power off virsh suspend centos7.0 / / suspend virsh resume centos7.0 / / restore virsh autostart centos7.0 / / accompany self-startup with the host

2. Export the virtual machine

Virsh dumpxml centos7.0 > / etc/libvirt/qemu/c02.xml

3. Delete the KVM virtual machine (configuration files are deleted, disk files will not be deleted)

Virsh shutdown centos7.0 / / shutdown virsh undefine centos7.0 / / delete

4. File management (view files)

Yum install libguestfs-tools-y

Virt-cat-a / date/cent/centS.qcow2 / etc/sysconfig/network/ifcfg-ens33 / / View Nic information

5. Cloning

Yum install virt-install-y / / install the cloning tool virsh list-- all / / View the machine name to be cloned virt-clone-o source virtual machine name-n cloned virtual machine name-f cloned virtual machine disk storage volume path (disk file qcow2) virsh start cloned virtual machine name virsh shutdown centos7.0virt-clone-o centos7.0-n cent-f / date/cent/cent2.qcow2

Virsh start cent / / enable the cloned system

6. Snapshot

Virsh snapshot-create centos7.0 / / create a snapshot of centos7.0

Virsh snapshot-current centos7.0 / / View current snapshot (status)

Virsh snapshot-list centos7.0 / / View snapshot details

Virsh snapshot-revert centos7.0 1549805580 / / restore snapshot

Virsh snapshot-delete centos7.0 1549805580ini / / Delete a snapshot

For more information about KVM dynamic migration, please click KVM dynamic Migration.

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