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

Introduction to the method of creating virtual machine by virsh

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

Share

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

This article introduces the relevant knowledge of "introduction to the method of creating virtual machines by virsh". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Xml file

Attention: 1. When setting up memory, pay attention to the writing of unit. 2. The path of emulator, written on one line 3. Can write without line, a label, try to write on a line 4. Use qemu-img management tools to create virtual machine files, for example: qemu-img create-f qcow2 test.qcow2 10G 5. The created file does not have permission, so you need to change the created virtual machine file to the user group sudo chown hgf:root / var/lib/libvirt/images/test.qcow2. That is, under the name of the user who executed the start

Centos 1024 1024 2 hvm destroy restart destroy / usr/libexec/qemu-kvm Define a virtual machine

Virsh define test_virsh.xml

Use virsh undefine [virtual hostname] to undefine virtual machines

Start the virtual machine

Virsh start cetos

The parameters after start are specified by the name tag of the virtual machine previously defined with xml, or after the define virtual machine, use the command virsh list-- alll

Vnc View Virtual Machine

Query the vnc port virsh vncdisplay centos used by the virtual machine

Vncviewer installation

Yum install vnc (Anza ungde is tiger vncviewer) after opening vncviewer, enter the IP address: serial number in the address bar, such as 127.0.0.1 tiger vncviewer 0

Note: the serial number here is queried using the virsh vncdisplay hostname

This is the end of the introduction to virsh's method of creating a virtual machine. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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