In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the example analysis of virtualization technology QEMU-KVM for you. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
I. QEMU, KVM, QEMU-KVM
QEMU provides a series of hardware simulation devices (CPU, network card, disk, etc.). Client instructions need to be translated by QEMU, so the performance is poor. KVM is the virtualization provided by the linux kernel, which can be used to create and run vCPU, allocate the address space of virtual memory, and execute instructions efficiently, but it lacks the virtualization of IO devices. QEMU-KVM is the combination of KVM and QEMU, KVM is responsible for CPU virtualization + memory virtualization, and QEMU simulates other IO devices.
two。 Install and create a virtual machine
Install qemu-kvm softwar
Faramita2016@linux-l9e6:~ > zypper install qemu-kvm / / Ubuntu system uses apt-get install qemu-kvm
Create a virtual machine disk file in qcow2 format
Faramita2016@linux-l9e6:~ > qemu-img create-f qcow2 vdisk.img 5G / / disk size 5G
Use debian image to install virtual machine, order=dc first use CD-ROW (d), then use hard disk (c), memory defaults to 128m, specified using-m 512
Faramita2016@linux-l9e6:~ > qemu-kvm-cpu host-cdrom debian-9.4.0.iso-hda vdisk.img-boot order=dc
three。 Set the virtual machine to use bridge bridge mode
Executed in the host, qemu-bridge-helper increases the executable permissions of the current user, which is used to automatically add network backend tap devices
Faramita2016@linux-l9e6:~ > sudo chmod overnx / usr/lib/qemu-bridge-helper
Executed in the host,-net nic creates the nic network card (network front end) for the virtual machine, and-net bridge specifies that the bridge is used in the host (network backend)
Faramita2016@linux-l9e6:~ > qemu-kvm-cpu host-hda vdisk.img-net nic-net bridge,br=br0 / / specify bridge br0
Execute in the virtual machine, edit / etc/network/interfaces, set static IP
Root@debian:~# vi / etc/network/interfaces# The primary network interfaceallow-hotplug ens3#iface ens3 inet dhcpiface ens3 inet staticaddress 10.0.0.8netmask 255.0.0.0gateway 10.0.0.1hwaddress ether 52Flux 5400 mac address set root@debian:~# ifup ens3 / / turn on ens3 network interface, ifdown shut down network interface root@debian:~# / etc/init.d/networking restart / / restart network service
Execute in the virtual machine, edit / etc/resolv.conf, set DNS
Root@debian:~# vi / etc/resolv.confnameserver 8.8.8.8 / / Google DNS
four。 Set the virtual machine to non-graphical mode
Execute in the virtual machine, edit / etc/default/grub file, and add console=ttyS0 startup parameters
Root@debian:~# vi / etc/default/grub GRUB_DEFAULT=0 / / default startup item GRUB_TIMEOUT=0 / / default menu item residence time GRUB_DISTRIBUTOR= `lsb _ release-I-s 2 > / dev/null | | echo Debian`grub _ CMDLINE_LINUX_DEFAULT= "quiet" / / default kernel startup parameter GRUB_CMDLINE_LINUX= "console=ttyS0" / / manually add kernel startup parameters, add console=ttyS0
Execute in the virtual machine, update the grub configuration, and restart
Root@debian:~# update-grubroot@debian:~# shutdown-h now
a. Execute in the host, add the-nographic parameter to create a virtual machine, and the current shell foreground to create a virtual machine.
Faramita2016@linux-l9e6:~ > qemu-kvm-cpu host-hda vdisk.img-net nic-net bridge,br=br0-nographic
b. Execute in the host, add the parameter-display none-daemonize to create a virtual machine, and the current shell backend to create a virtual machine.
Faramita2016@linux-l9e6:~ > qemu-kvm-cpu host-hda vdisk.img-net nic-net bridge,br=br0-display none-daemonize
five。 Start the virtual machine read-only
a. Create a snapshot
Create a snapshot of the original mirror with the qemu-img command
Faramita2016@linux-l9e6:~ > qemu-img create-f qcow2-b vdisk.img snapshot.img
Start the virtual machine using the snapshot file
Faramita2016@linux-l9e6:~ > qemu-kvm-cpu host-hda snapshot.img-net nic-net bridge,br=br0-nographic
b. Use temporary snapshot
Principle: create a temporary snapshot and delete the snapshot file automatically after the virtual machine starts
This is the end of the article faramita2016@linux-l9e6:~ > qemu-kvm-cpu host-hda vdisk.img-net nic-net bridge,br=br0-snapshot-nographic on "sample Analysis of Virtualization Technology QEMU-KVM". I hope the above content can be helpful to you so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.