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

How to build KVM virtual machine under Centos7

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of how to build a KVM virtual machine under Centos7, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this article on how to build a KVM virtual machine under Centos7. Let's take a look.

Pre-install

=

Kvm-related installation package and its function

Qemu-kvm 's main kvm package

Command-line tools and libraries needed by python-virtinst to create virtual machines

Virt-manager gui virtual machine management tools

Virt-top virtual machine statistics command

Virt-viewer gui connector to connect to a configured virtual machine

Libvirt c language toolkit, which provides libvirt services

C language toolkit provided by libvirt-client for virtual clients

Virt-install virtual machine creation command based on libvirt service

Bridge-utils tools for creating and managing bridging devices

= =

1. Make sure the machine has vt

Terminal input command:

Cat / proc/cpuinfo | grep vmx # intel cpucat / proc/cpuinfo | grpe svm # amd cpu

If there is vmx or svm in flags: it means that vt; is supported. If there is no output, it means that your cpu does not support it and will not be able to use the kvm virtual machine.

two。 Make sure vt is enabled in bios: intel (r) virtualization tech [enabled] use the following command

Lsmod | grep kvm modprobe kvm-intel

3. Bridging network

Install bridge-utils, a tool for managing bridges, brctl

Yum-y install bridge-utils

After installation, systemctl restart network restarts the network

B, create an ifcfg-br0 file, enter the following, and modify the red part to the real relevant environment.

Type= "bridge" bootproto= "static" defroute= "yes" peerdns= "yes" peerroutes= "yes" ipv4_failure_fatal= "no" ipv6init= "yes" ipv6_autoconf= "yes" ipv6_defroute= "yes" ipv6_peerdns= "yes" ipv6_peerroutes= "yes" ipv6_privacy= "no" ipv6_failure_fatal= "no" stp= yes "delay=" 0 "name=" br0 "device=" br0 onboot= "yes" ipaddr= "172.16.10.215" # ipaddr= "16" ipprefix= "172.16 on the network card to be bridged. 11.1 "dns1=" 8.8.4.4 "domain=" ans.kvm "

C. Modify the configuration file of the network card to be bridged and remember to back it up.

# type= "ethernet" # bootproto= "static" # defroute= "yes" # peerdns= "yes" # peerroutes= "yes" # ipv4_failure_fatal= "no" # ipv6init= "yes" # ipv6_autoconf= "yes" # ipv6_defroute= "yes" # ipv6_peerdns= "yes" # ipv6_peerroutes= "yes" # ipv6_privacy= "no" # ipv6_failure_fatal= "no" name= eno16777736 "uuid=" dad441c6-d806-4b24-98f2-46e606a83288 device= "eno16777736" onboot= "onboot=" # yes "172.16.10.215" # yes "16" # gateway= "172.16.11.1" # dns1= "8.8.4.4" # domain= "anskvm" bridge= "br0"

Restart the network and check the bridge status

Systemctl restart networkbrctl show

4. Install kvm

The copy code is as follows:

Yum-y install libcanberra-gtk2 qemu-kvm.x86_64 qemu-kvm-tools.x86_64 libvirt.x86_64 libvirt-cim.x86_64 libvirt-client.x86_64 libvirt-java.noarch libvirt-python.x86_64 libiscsi-1.7.0-5.el6.x86_64 dbus-devel virt-clone tunctl virt-manager libvirt libvirt-python python-virtinst

5. Install x-windows and use graphical interface to manage virtual machines

Yum groupinstall "x window system"

6. Install Chinese characters to solve the problem of garbled code in the interface.

Yum install dejavu-lgc-sans-fonts yum groupinstall "fonts"-y

7. Enable libvirt

Systemctl start libvirtdsystemctl enable libvirtd

8. Use virt-manager to manage kvm

You need to install xmanager and xshell tools locally, and check x11 transfer when using xshell to establish a connection.

9. Upload iso or qcow2 files to / var/lib/libvirt/images # (this directory is kvm's image repository)

After connecting to the host using xshell (using step 8 to connect), use virt-manager to create a virtual machine, which needs to be configured before installation, otherwise the keyboard and mouse cannot be used during installation.

This is the end of the article on "how to build a KVM virtual machine under Centos7". Thank you for reading! I believe you all have a certain understanding of "how to build a KVM virtual machine under Centos7". If you want to learn more, you are welcome to follow the industry information channel.

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

Development

Wechat

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

12
Report