In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
I. Overview of KVM
KVM is the abbreviation of Kernel Virtual Machine. The current Linux distribution must be in a 64-bit system environment to run KVM, and the hardware needs to support VT technology.
1. Pre-knowledge points of the case
KVM has been directly integrated into the Linux kernel since the Linux2.6.20 version, and 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, security, compatibility and stability.
The figure below is a simple KVM virtualization architecture where each virtualized operating system running in a KVM environment will represent a single independent system process. Therefore, it can be easily integrated with the security module in the Linux system (SELinux), and can flexibly realize the management and allocation of resources.
2. Implementation case 1. Environmental requirements: 3 Centos operating systems and 1 Windiws 7 operating system
For required images and tools, please visit: https://pan.baidu.com/s/1fPhMgWJAjnmgJI5w267QCA
Extraction code: 7x2p
2. Edit virtual machines to support virtualization 1) modify the number of processors to 2, and check the virtualization engine
2) check whether CPU supports virtualization [root@centos01 ~] # cat / proc/cpuinfo | grep vmxflags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx F16c rdrand hypervisor lahf_lm abm 3dnowprefetch epb tpr_shadow vnmi ept vpid fsgsbase tsc_ Adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap xsaveopt dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_eppflags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch epb tpr_shadow vnmi ept vpid fsgsbase tsc_ Adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap xsaveopt dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp3 、 Install the software required for KVM [root@centos01 ~] # ln-sf / lib/systemd/system/graphical.target / etc/systemd/system/default.target [root@centos01 ~] # rm-rf / etc/yum.repos.d/CentOS-* [root@centos01 ~] # mount / dev/cdrom / mnt/ mount: / dev/sr0 write protection [root@centos01 ~] # rpm-qa | grep qemu-kvm qemu-kvm-1.5.3-141.el7.x86_64qemu-kvm-common-1.5.3-141.el7.x86_64 [root@centos01 ~] # rpm-qa | grep qemu-kvm-tools [root@centos01 ~] # yum-y install qemu-kvm-tools [root@centos01 ~] # rpm-qa | grep qemu-kvm-toolsqemu-kvm-tools-1.5.3-141 .el7.x86 _ 64 [root@centos01 ~] # rpm-qa | grep virt-install [root@centos01 ~] # yum-y installvirt-install [root@centos01 ~] # rpm-qa | grep virt-installvirt-install-1.4.1-7.el7.noarch [root@centos01 ~] # rpm-qa | grep qemu-imgqemu-img-1.5.3-141.el7.x86_64 [root@centos01 ~] # rpm-qa | | grep bridge-utilsbridge-utils-1.5-9.el7.x86_64 [root@centos01 ~] # rpm-qa | grep libvirtlibvirt-daemon-driver-qemu-3.2.0-14.el7.x86_64libvirt-client-3.2.0-14.el7.x86_64libvirt-daemon-driver-interface-3.2.0-14.el7.x86_64libvirt-daemon-driver-storage-disk-3.2.0-14.el7.x86_64libvirt-daemon-driver-storage-3.2 | .0-14.el7.x86_64libvirt-daemon-driver-storage-core-3.2.0-14.el7.x86_64libvirt-daemon-driver-storage-mpath-3.2.0-14.el7.x86_64libvirt-daemon-driver-storage-iscsi-3.2.0-14.el7.x86_64libvirt-daemon-kvm-3.2.0-14.el7.x86_64libvirt-daemon-driver-nodedev-3.2.0-14.el7.x86_64libvirt-gconfig-1.0 .0-1.el7.x86_64libvirt-daemon-driver-storage-rbd-3.2.0-14.el7.x86_64libvirt-daemon-driver-storage-scsi-3.2.0-14.el7.x86_64libvirt-libs-3.2.0-14.el7.x86_64libvirt-daemon-driver-network-3.2.0-14.el7.x86_64libvirt-daemon-driver-nwfilter-3.2.0-14.el7.x86_64libvirt-glib-1.0.0-1 .el7.x86 _ 64libvirt-daemon-driver-storage-gluster-3.2.0-14.el7.x86_64libvirt-daemon-3.2.0-14.el7.x86_64libvirt-daemon-config-network-3.2.0-14.el7.x86_64libvirt-gobject-1.0.0-1.el7.x86_64libvirt-daemon-driver-storage-logical-3.2.0-14.el7.x86_64libvirt-python-3.2.0-3.el7.x86_64libvirt-daemon -driver-secret-3.2.0-14.el7.x86_64 [root@centos01 ~] # rpm-qa | grep virt-managervirt-manager-common-1.4.1-7.el7.noarch [root@centos01 ~] # yum-y install virt-manager [root@centos01 ~] # rpm-qa | grep virt-managervirt-manager- 1.4.1-7.el7.noarchvirtMutual Management Mutual 1.4.1- 7.el7.noarch [root@centos01 ~] # lsmod | grep kvm kvm_intel 170086 0 kvm 566340 1 kvm_intelirqbypass 13503 1 kvm [root@centos01] # systemctl start libvirtd [root@centos01 ~] # systemctl enable libvirtd 4, Use WinSCP tool to import image 1) use winSCP to import the operating system CD into Virtualization Manager (please visit the network disk to extract the tool)
2) enter the IP address and user name and password, and log in
3) just skip the warning
4) Import the operating system
5) verify whether the upload is successful [root@centos01 ~] # pwd / root [root@centos01 ~] # ls anaconda-ks.cfg CentOS-7.4-x86_64-1708.iso initial-setup-ks.cfg5, Virtualization Manager creates a virtual machine 1) Open Virtualization Manager
[root@centos01 ~] # virt-manager
2) create a new virtual machine
3) browse the operating system CD
4) Select CD
5) keep the default, and click forward.
6) Custom memory size
7) Custom disk size
8) Custom virtual machine name, click finish.
9) Select the first line and press enter to start the installation
10) start initializing the configuration
11) installation is complete, restart the virtual machine
12) accept the license agreement
13) create an account
14) set the account password
3. The basic management of virtualization uses 1) View the running status of virtual machines [root@centos01 ~] # virsh list-- all Id name status-2 centos Running2) shut down the virtual machine [root@centos01 ~] # virsh shutdown centos domain centos is disabled 3) start the virtual machine [root@centos01 ~] # virsh start centos domain centos has started 4) set the virtual machine to boot automatically [root@centos01 ~] # virsh autostart centos domain centos marked as automatic start 5) forcibly shut down the virtual machine [root@centos01 ~] # virsh destroy centos domain centos is deleted 1, Suspend and restore virtual machine 1) suspend virtual machine [root@centos01 ~] # virsh suspend centos domain centos is suspended 2) restore suspended virtual machine [root@centos01 ~] # virsh resume centos domain centos is restored 2. Backup restore virtual machine 1) backup virtual machine [root@centos01 ~] # virsh dumpxml centos > / etc/libvirt/qemu/centos01.xml2) delete virtual machine [root@centos01 ~] # virsh undefine centos domain centos has been undefined 3) View backup virtual machine [root@centos01 ~] # cd / etc/libvirt/qemu/ [root@centos01 qemu] # lsautostart centos01.xml networks4) restore virtual machine [root@centos01 qemu] # virsh define centos01.xml definition domain centos ( From centos01.xml) 5) View the running status of the restored virtual machine [root@centos01] # virsh list-- all Id name status-4 centos running6 ) two methods for modifying virtual machine configuration files [root@centos01 ~] # vim / etc/libvirt/qemu/centos.xml [root@centos01 ~] # virsh edit centos3, Clone and snapshot 1) Clone virtual machine [root@centos01 ~] # virsh shutdown centos domain centos is off [root@centos01 ~] # virt-clone-o centos-n centos02-f / var/lib/libvirt/images/centos02.qcow2 is assigning 'centos02.qcow2' | 30 GB 00:11 successful Cologne' centos02'. 2) create snapshot [root@centos01 ~] # virsh snapshot-create centos generated domain snapshot 15742741813) restore snapshot [root@centos01 ~] # virsh snapshot-revert centos 15742741814) View snapshot [root@centos01 ~] # virsh snapshot-list centos name generation time status-- -1574274181 2019-11-21 02:23:01 + 0800 shutoff5) Delete snapshot [root@centos01 ~] # virsh snapshot-delete centos 1574274181 deleted domain snapshot 1574274181 [root@centos01 ~] # virsh snapshot-list centos name generation time status- -
-this is the end of this article. Thank you for reading-
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.