KVM Installation Use

Source: Internet
Author: User

#创建yum源

Rm-rf/etc/yum.repos.d/other

Mkdir/etc/yum.repos.d/other

Mv/etc/yum.repos.d/*.repo/etc/yum.repos.d/other

Wget-o/etc/yum.repos.d/centos-base.repo Http://mirrors.aliyun.com/repo/Centos-6.repo

Yum Clean All

Yum Makecache

RPM-IVH http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm


#查看是英特尔的VT-X, or AMD's AMD-V technology

#egrep-E "VMX|SVM"/proc/cpuinfo--color


#安装命令qemu-KVM, the command used to create the virtual machine

Yum-y Install QEMU-KVM

#lsmod | grep KVM

#rpm-QL QEMU-KVM

#cat/etc/sysconfig/modules/kvm.modules


#创建管理工具

Yum-y Install Virt-manager python-virtinst qemu-kvm-tools libvirt Libvirt-python


#创建kvm硬盘,-f Specifies the hard drive type, raw is a floppy

Qemu-img create-f Raw/opt/kvm.raw 10G

#qemu-img Info/opt/kvm.raw


#拷贝安装光盘镜像到服务器

Mount/dev/cdrom/media

DD If=/dev/cdrom Of=/opt/centos64.iso


#启服服务, install the virtual machine

/usr/libexec/qemu-kvm

Service LIBVIRTD Start

Virt-install--virt-type KVM--name kvm-demo--ram--cdrom=/opt/centos64.iso--network network=default--graphics VNC , listen=0.0.0.0--noautoconsole--os-type=linux--os-variant=rhel6--disk Path=/opt/kvm.raw

#ifconfig

#ps aux | grep DNV

#ll/etc/libvirt

#cat/etc/libvirt/qemu/kvm-demo.xml

#/usr/libexec/qemu-kvm-cpu?


#查看当前已经启动的虚拟机

Virsh List


#查看所有虚拟机 (including virtual machines that have been turned off)

Virsh List--all


#启动虚拟机

Virsh Start Kvm-demo

#ps aux | grep KVM

#netstat-TLNP | grep 5900

#brctl Show

#ip Add Li

#qemu-img Info/opt/kvm.raw


#关闭虚拟机

Virsh--help | grep stop

Virsh Destory Kvm-demo


#拷贝虚拟机, two step-by-step copy of the XML file, one-step copy of the disk file

Virsh--help | grep xml

Virsh dumpxml Kvm-demo > New.xml

CP Kvm.raw New.raw

#修改new. xml

Change UUID (9 rows), disk file name (raw) 31 lines, Virtual machine name (4 lines), mac48 line

Change it to the new disk name.


#更改硬盘, add hard drive capacity

Qemu-img Resize New.raw +1g


#转换磁盘格式, after conversion, modify the XML file, modify the disk format

Qemu-img convert-c-F raw-o qcow2 New.raw New.qcow2


#编辑xml文件

Virsh Edit Kvm-new


#检查磁盘文件有没有错误

Qemu-img Check/opt/new.qcow2


#查看磁盘实际使用大小

Qemu-img Info/opt/new.qcow2


#创建一个快照, the machine can take a snapshot

Qemu-img snapshot-c Backup/opt/new.qcow2


#查看快照

Qemu-img snapshot-l/opt/new.qcow2

20:30


#监控虚拟机

Yum-y Install Virt-top

Virt-top













This article is from the "Wsyht blog" blog, make sure to keep this source http://wsyht2015.blog.51cto.com/9014030/1790258

KVM Installation Use

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.