1、安装相关组件:

 

[root@KVM ~]# yum install qemu-img qemu-kvm qemu-kvm-tools virt-manager virt-viewer virt-v2v virt-top libvirt libvirt-python libvirt-client python-virtinst bridge-utils tunctl

相当于如下命令:

[root@KVM ~]# yum install qemu-img qemu-kvm qemu-kvm-tools

[root@KVM ~]# yum install virt-manager virt-viewer virt-v2v virt-top  

[root@KVM ~]# yum install libvirt libvirt-python libvirt-client  

[root@KVM ~]# yum install python-virtinst bridge-utils tunctl

2、安装TightVNC:

1 yum install tigervnc tigervnc-server

编辑VNCServer配置文件:

1 vim /etc/sysconfig/vncseervers

在文件末尾添加如下代码:

12 VNCSERVERS="2:root"VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"

设置VNCServer连接密码:

1 [root@KVM /]# vncpasswd

3、创建虚拟机:

  [root@KVM /]# virt-install --name=centos \--vcpus=4 \--ram 1024 \--disk path=/data0/centos.img,size=10 \--cdrom /data0/CentOS-6.8-x86_64-minimal.iso \--graphics vnc,listen=0.0.0.0,port=5920 \--network bridge=virbr0 \--accelerate

4、删除虚拟机:

1 [root@KVM /]# virsh undefine centos

5、启动虚拟机:

1 [root@KVM /]# virsh start centos

6、关闭虚拟机:

1 [root@KVM ~]# virsh shutdown centos

7、启动viewer窗口:

1 [root@KVM ~]# virt-viewer centos

8、启动VNC客户端:

1 [root@KVM ~]# vncviewer

9、VMWare多个虚拟硬盘合并:

1 F:\VirtualMachine\Redmine>"C:\Program Files (x86)\VMware\VMware Workstation\vmware-vdiskmanager.exe" -r "CentOS 64 位.vmdk" -t 0 "CentOS.vmdk"

10、VMWare虚拟机转换为KVM虚拟机文件

1 [root@localhost]# qemu-img convert -O qcow2 test-redmine.vmdk test-redmine.qcow2

Leave a Reply

Your email address will not be published. Required fields are marked *