Build a virtual machine using Libvirt on Linux

Source: Internet
Author: User

1. Preparatory work
Systemctl Disable Firewalldsystemctl stop firewalld setenforce 0hostnamectl set-hostname libvirt-manage rpm-qa|grep kvmy Um groupinstall virtual* yum install Virt-manager libvirt libvirt-python python-virtinstsystemctl status libvirtdmkdir/h Ome/vm/centos qemu-img create-f qcow2/home/vm/centos/centos.qcow2 10G VI lib.xml
2. Configure Lib.xml
<domain type= ' KVM ' >        <name>CentOS</name>  //Virtual machine name         <memory>1048576</memory> //Max memory, Unit k        <currentmemory>1048576</currentmemory> // Available memory, Unit k        <vcpu>1</vcpu> //number of virtual CPUs          <os>          < type>hvm</type>          <boot dev= ' cdrom '/ > //Disc Start        </os>        <features>         <acpi/>          <apic/>         <pae />  &nbsP;    </features>       <clock offset= ' LocalTime '/>       <on_poweroff>destroy</on_poweroff>        <on_reboot>restart</on_reboot>        <on_crash>destroy</on_crash>       <devices>          <emulator>/usr/libexec/qemu-kvm</emulator>          <disk type= ' file '  device= ' disk ' >           <driver name= ' qemu '  type= ' Qcow2 '/>            <source file= '/home/vm/centos/centos.qcow2 '/>//destination Image path<target dev= ' hda ' bus= ' ide '/> </disk> <disk type= ' file ' device= ' cdrom ' > <so Urce file= '/home/centos-7-x86_64-minimal-1511.iso '/>//put it in advance.           <target dev= ' HDB '  bus= ' IDE '/ >         </disk>         <interface type= ' bridge ' > //virtual Machine network connection mode            <source bridge= ' virbr0 '/> //name of current host bridge            <mac address= "00:16:3e:5d:aa:a8"/>          </interface>        <input type= ' Mouse '  bus= ' ps2 '/>         <graphics type= ' VNC '   Port= '-1 '  autoport= ' yes '  listen =  ' 0.0.0.0 '  keymap= ' en-US '/>        </devices>     </domain>
3. Launch the instance to get the VNC screen number
Virsh Start Centosvirsh vncdisplay CentOS
4. Start Vncviewer on WindowsDirect activation of the connection may cause the VNC window to flash backThe configuration is as follows:

Options ... > Advanced ... > Expert

Change
–fullcolour to True
–preferredencoding to Hextile

5. Connecting to VNC

Build a virtual machine using Libvirt on Linux

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.