Installation and use of KVM on Linux

Source: Internet
Author: User
Tags uuid

I installed it on a VMware virtual machine


First, check whether the CPU supports virtual tables

grep ' VMX|SVM '/proc/cpuinfo--color//have support


Second, install KVM and the required packages and verify

Yum-y Install KVM virt-* libvirt//


Check if the installation was successful

Lsmod|grep KVM

Ls/dev/kvm


Third, network configuration

Cat/etc/sysconfig/network-scripts/ifcfg-br0

Device=br0

#HWADDR =00:0c:29:f2:0d:da

Type=ethernet

#UUID =e4728a54-13a5-48a2-8fcc-030eb15e789f

Onboot=yes

#NM_CONTROLLED =yes

Bootproto=none

ipaddr=192.168.10.20

netmask=255.255.255.0

gateway=192.168.10.2


Cat/etc/sysconfig/network-scripts/ifcfg-eth0

Device=eth0

#HWADDR =00:0c:29:f2:0d:da

Type=ethernet

#UUID =e4728a54-13a5-48a2-8fcc-030eb15e789f

Onboot=yes

#NM_CONTROLLED =yes

Bootproto=none

#IPADDR =192.168.10.20

#NETMASK =255.255.255.0

#GATEWAY =192.168.10.2

Bridge=br0


Iv. load the NIC module and restart the network service

MODPROBE-RV e1000

Modprobe-v e1000

/etc/init.d/network restart

Chkconfig LIBVIRTD on


Five, install the virtual machine

Virt-install \

--connect qemu:///system \

--name=rhel-server-10.20 \

--ram=1024--vcpus=1 \

--os-type=linux \

--HVM \

--cdrom=/store/rhel-server-6.4-x86_64-dvd.iso \

--disk path=/store/kvm/rhel-server-10.20.img,size=20 \

--graphics VNC \

--network bridge=br0 \

--noautoconsole \

--debug


Six or one easy to use

Installation configuration via VNC

Virsh Vncdisplay rhel-server-10.20


Clone virtual Machine

Virt-clone--connect=qemu:///system-o rhel-server-10.20-n rhel-server-10.21-f/store/kvm/rhel-server-10.20.img-f/ storage/disk/rhel-server-10.20


Add a hard drive

Virsh attach-disk Virtual machine name source target

Eg:qemu-img create-f raw/storage/disk/vm_centos.img 50G

Virsh attach-disk vm_centos_6.5_x64/storage/disk/rhel-server-10.20.img VDA--config

Delete a hard disk

Virsh Detach-disk vm_centos_6.5_x64/storage/disk/rhel-server-10.20.img--config




KVM Add block device:

Qemu-img create-f raw/storage/disk/rhel-server-10.20.img 200G

Virsh Edit VMname

<disk type= ' file ' device= ' disk ' >

<driver name= ' qemu ' type= ' raw '/>

<source file= '/storage/disk/rhel-server-10.20.img '/>

<target dev= 'vda' bus= ' Virtio '/>

<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x05 ' function= ' 0x0 '/>

</disk>



Dynamically Increase memory

Virsh Setmem rhel-server-10.20 8388608


Installation and use of KVM on Linux

Related Article

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.