Centos6.5系统安装kvm虚拟机之克

Centos 6.5 x86_64系统安装kvm虚拟机—克隆、拷贝xml文件安装新虚拟机

一、通过模板虚拟机克隆新虚拟机

IP规划:

宿主机:10.0.1.149

模板虚拟机:10.0.1.228

克隆虚拟机:10.0.1.100

关闭或者暂停模板虚拟机,再进行克隆安装新虚拟机。

[root@taokey~]#virt-clone-okvm_mode_5566-nmysql-server-f/data/kvmdisk/mysql-server.qcow2ERRORDomainwithdevicestoclonemustbepausedorshutoff.

报错原因:由于没有关闭模板主机,我们关闭模板主机再试下。

解决kvm环境下可以使用shutdown命令让虚拟机关机,但不生效。

[root@taokey~]#yuminstall-yacpid[root@taokey~]#virshWelcometovirsh,thevirtualizationinteractiveterminal.Type:’help’forhelpwithcommands’quit’toquitvirsh#list–allIdNameState—————————————————-1kvm_mode_5566runningvirsh#shutdownkvm_mode_5566Domainkvm_mode_5566isbeingshutdownvirsh#list–allIdNameState—————————————————–kvm_mode_5566shutoff

2.通过virt-clone命令克隆虚拟机。

[root@taokey~]#virt-clone-okvm_mode_5566-nmysql-server-f/data/kvmdisk/mysql-server.qcow2Cloningkvm_mode.img|10GB03:43Clone’mysql-server’createdsuccessfully.

3.手动更改xml配置文件中VNC端口,然后重启libvirtd服务。

[root@taokey~]#more/etc/libvirt/qemu/mysql-server.xml|grepvnc<graphicstype=’vnc’port=’7789’autoport=’no’listen=’0.0.0.0′>[root@taokey~]#/etc/init.d/libvirtdrestartStoppinglibvirtddaemon:[OK]Startinglibvirtddaemon:2014-08-1602:08:44.921+0000:3112:info:libvirtversion:0.10.2,package:29.el6_5.11(CentOSBuildSystem<>,2014-07-31-18:52:08,c6b8.bsys.dev.centos.org)2014-08-1602:08:44.921+0000:3112:warning:virGetHostname:2294:getaddrinfofailedfor’taokey’:Nameorservicenotknown[OK]

4.启动新克隆成功的虚拟机。

[root@taokey~]#virshstartmysql-serverDomainmysql-serverstarted

5.通过VNC客户端链接,配置eth0网卡。

解决办法:

rm -rf /etc/udev/rules.d/70-persistent-net.rules

修改下MAC地址和UUID 如图所示:

然后reboot新虚拟机。

二、通过拷贝xml文件方式安装新虚拟机

还深深埋在心底,要除去,怕是不能活命。

Centos6.5系统安装kvm虚拟机之克

相关文章:

你感兴趣的文章:

标签云: