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

What are the steps of virsh command to create a virtual machine

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Virsh command to create a virtual machine steps is how, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

(1) generate hard disk image files:

Format: raw or qcow2

# qemu-img create-f raw fdisk.img 10G# qemu-img info fdisk.img

(2) write the xml configuration file, which will be described in detail later.

(3) create and run a virtual machine

# sudo apt-get install qemu-kvm# virsh define vm0.xml / / Import virtual machine configuration # virsh start vm0 / / enable vm0# virsh list-- all / / display all virtual machine status # virsh destroy vm0 / / destroy virtual machine # virsh undefine vm1 / / delete virtual machine configuration # virsh dumpxml vm0 / / display virtual machine xml configuration

Where "vm0.xml" is the xml file created in step (2).

Virtual machine XML file / / if it is Xen, then type='xen' vm0 / / virtual machine name, the same physical machine unique fd3535db-2558-43e9-b067-314f48211343 / / the same physical machine unique, can use uuidgen to generate 524288 524288 / / memory these two values had better be set to the same 2 / / virtual machine can use the number of cpu Check the number of CPU available for physical machines: cat / proc/cpuinfo | grep processor | wc-l hvm / / arch indicates the system architecture type, while machine indicates the machine type. Check the machine type: qemu-system-x86_64-M? / / boot media The first time you need to install the system, you can select cdrom CD boot / / means to start by pressing F12 to enter the boot menu / / Advanced Configuration and Power Interface, advanced configuration and power interface / / Advanced Programmable Interrupt Controller, advanced programmable interrupt controller / / Physical Address Extension, physical address extension / / virtual machine clock setting This means local local time destroy / / emergency action restart restart / / device configuration / usr/bin/kvm / / if it is Xen, it is / usr/lib/xen/binqemu-dm / / hard disk / / domain, bus, slot, function number Slot value unique on the same virtual machine / / CD / * using Linux bridge to connect the network * / / the configured bridge Nic name / / the same / / alias under the same bridge Under the same bridge, the same / / note that the slott value is unique / * use ovs bridge to connect the network * / / * configure the pci pass-through virtual machine to connect the network. VF scenario of SR-IOV Nic * / / * using vhostuser to connect ovs port * / / Network based on virtual local area network / / available command generation See the following supplement / / default / / the same value of the same virtual local area network / / Note the value of vnc,windows / / you can use vncviewer to log in and get the VNC port number under the configuration virsh vncdisplay vm0: is it helpful for you to read the above? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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