Create a VM in kvm

Source: Internet
Author: User

Create a VM in kvm
Background Environment: Minimize installed cenots 6.x 1. install the required component yum-y groupinstall 'virtualization ization' 'virtualization alization client''' Virtualization Platform ''virtualization alization Tools ''2. verify if the installation is successful after installation. lsmod | grep kvm PS: Sometimes you need to enable cpu Virtualization in bios. after completing the preceding two steps, use virt-install for installation. For example: virt-install -- connect = qemu: // system-n test [-B br0] -- vcpus 2-r 2048-f/dev/vgroup0/lv02-l/opt/software/rhel-server-6.5-x86_64-dvd.iso (-- extra-args console = ttyS0) -- nographics (added in parentheses for text installation on the kvm platform; otherwise, process information will not be visible at the beginning of installation) Common commands for virsh

Virsh list -- all (list all clients) virsh console name (connect to client console port) destroy force stop reboot restart reset power-off restart restore resume save shutdown start suspend setmaxmem reset maximum memory setmem reset memory setvcpus reset CPU count undefine delete a virtual machine virt-install parameter: required information: -- name = name vm name -- ram = memory cpu usage option: -- vcpus 5, maxcpus = 10 cpu count -- cpuset = CPUSET cpu type -- CPU = CPU cpu mode -- description = DESCRIPTION description remarks startup options: -- location = LOCATION installation file path -- pxe network startup -- import ?? ? -- Init = INIT ??? -- Extra-args = EXTRA Option System option added to the kernel: -- OS-type = [linux | unix | windows} -- OS-variant = DISTRO_VARIANT other options: -- filesystem = filesystems vm storage settings, which can be files or lvm volumes -- network = NETWORK network settings -- graphics = [vnc | none | spice] display settings

 

4. kvm can use multiple types of disk files as local disks. lvm partition example: lvcreate-L 100G-n lv01 vgroup01 virt-install -- connect = qemu: // system -- name = test -- ram = 2048 -- network bridge = br0 -- vcpus 2-f/dev/vgroup0/lv02-l/opt/software/rhel-server-6.5-x86_64-dvd.iso -- extra-args console = ttyS0 -- graphics = none -- description = tsest B. use the raw image file virt-install -- connect = qemu: // system -- name = 10.20 -- ram = 1024 -- network bridge = br0 -- vcpus 2 -- Disk =/vm/servers/10.20, size = 80-l/opt/software/CentOS-6.5-x86_64-minimal.iso -- extra-args console = ttyS0 -- graphics = none -- description = nginx 5. if the NIC Mode Supported by kvm is not explicitly specified during installation, virbr0 created by libvirt is used as the virtual mesh bridge by default, and the Internet is accessed through the shared host network through nat; you can use the network parameter to specify the bridge mode and the bridge used.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.