wordpress有没有ssrpanel,站长工具seo综合查询收费吗,wordpress 多page,建筑设计费一般多少钱一平方Linux下 如何通过命令行使用现有的镜像创建、启动kvm虚拟机 这里假定已经创建好了相应的镜像#xff1a; eg#xff1a;我这里制作的镜像名称为zu1-centos7.img # lszu1-centos7.img 1、拷贝这个镜像到某一个目录 cp zu1-centos7.img /data2/ 2、编写镜像的配置文件#x…Linux下 如何通过命令行使用现有的镜像创建、启动kvm虚拟机 这里假定已经创建好了相应的镜像 eg我这里制作的镜像名称为zu1-centos7.img # lszu1-centos7.img 1、拷贝这个镜像到某一个目录 cp zu1-centos7.img /data2/ 2、编写镜像的配置文件当然一般情况是从其他镜像的配置文件拷贝一份重新命名在修改 # cd /etc/libvirt/qemu 进入到镜像配置文件目录
# cp test2.xml test3.xml test2.xml是其他镜像存在的配置文件test3.xml是当前准备启动的镜像的配置文件 test2.xml配置文件大体如下 !--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:virsh edit test2
or other application using the libvirt API.
--domain typekvmnametest2/name ---虚拟机名字记得修改随便起什么名字都行只要不跟其他虚拟机名字一样就行uuid92047c95-c5b8-4e4d-916c-fb2218ca055f/uuid --uuid 记得修改一般来说把最好的四位数字重新修改一下例如我把最后四位改成0001具体效果看下个test3.xml文件memory unitKiB10485760/memory ---当前虚拟机使用内存看自己情况是否需要修改currentMemory unitKiB10485760/currentMemory ---当前虚拟机可以使用的最大内存使用内存不得超过这个内存当使用内存不足的时候可以在虚拟机里面动态调整内存。vcpu placementstatic1/vcpuostype archx86_64 machinerhel6.6.0hvm/type ---架构一般不用修改boot devhd//osfeaturesacpi/apic/pae//featuresclock offsetutc/on_poweroffdestroy/on_poweroffon_rebootrestart/on_rebooton_crashrestart/on_crashdevicesemulator/usr/libexec/qemu-kvm/emulatordisk typefile devicediskdriver nameqemu typeqcow2 cachenone/ ---driver类型需要跟镜像的文件格式一致。以前老版本默认是raw类型现在默认是qcow2类型。查看镜像的文件格式在该配置文件的下面source file/data1/iso/zu1-centos7.img/ --- 镜像文件路径target devvda busvirtio/ address typepci domain0x0000 bus0x00 slot0x05 function0x0//diskdisk typeblock devicecdromdriver nameqemu typeqcow2/target devhdc buside/readonly/address typedrive controller0 bus1 target0 unit0//diskcontroller typeide index0address typepci domain0x0000 bus0x00 slot0x01 function0x1//controllercontroller typeusb index0 modelpiix3-uhciaddress typepci domain0x0000 bus0x00 slot0x01 function0x2//controllercontroller typepci index0 modelpci-root/interface typebridgemac address52:54:00:5a:07:de/source bridgebr0/model typevirtio/address typepci domain0x0000 bus0x00 slot0x03 function0x0/ ---这里的slot号记得修改 把最后两位改成其他的就行但不要跟其他的虚拟机配置的值一样同时这个值不超过 0x0f/interfaceserial typeptytarget typeisa-serial port0model nameisa-serial//target/serialconsole typeptytarget typeserial port0//consoleinput typetablet bususbaddress typeusb bus0 port1//inputinput typemouse busps2/input typekeyboard busps2/memballoon modelvirtioaddress typepci domain0x0000 bus0x00 slot0x06 function0x0//memballoon/devices
/domain 3、查看镜像的driver类型 # qemu-img info /data1/zu1-centos7.img
image: /data1/virtcentos/pool/zu1-centos7.img
file format: qcow2 ----这里就是镜像的文件格式
virtual size: 20G (21474836480 bytes)
disk size: 18G
cluster_size: 65536
Format specific information:compat: 1.1lazy refcounts: true 4、修改test3.xml文件如下 !--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:virsh edit test2
or other application using the libvirt API.
--domain typekvmnameyjt/name ---这里改成了yjtuuid92047c95-c5b8-4e4d-916c-fb2218ca0001/uuidmemory unitKiB10485760/memorycurrentMemory unitKiB10485760/currentMemoryvcpu placementstatic1/vcpuostype archx86_64 machinerhel6.6.0hvm/typeboot devhd//osfeaturesacpi/apic/pae//featuresclock offsetutc/on_poweroffdestroy/on_poweroffon_rebootrestart/on_rebooton_crashrestart/on_crashdevicesemulator/usr/libexec/qemu-kvm/emulatordisk typefile devicediskdriver nameqemu typeqcow2 cachenone/source file/data2/zu1-centos7.img/ ---这里修改了镜像的路径target devvda busvirtio/address typepci domain0x0000 bus0x00 slot0x05 function0x0//diskdisk typeblock devicecdromdriver nameqemu typeqcow2/target devhdc buside/readonly/address typedrive controller0 bus1 target0 unit0//diskcontroller typeide index0address typepci domain0x0000 bus0x00 slot0x01 function0x1//controllercontroller typeusb index0 modelpiix3-uhciaddress typepci domain0x0000 bus0x00 slot0x01 function0x2//controllercontroller typepci index0 modelpci-root/interface typebridgemac address52:54:00:5a:07:de/source bridgebr0/model typevirtio/address typepci domain0x0000 bus0x00 slot0x10 function0x0/ 这里改成了0x10注意,该值不得超过0x0f/interfaceserial typeptytarget typeisa-serial port0model nameisa-serial//target/serialconsole typeptytarget typeserial port0//consoleinput typetablet bususbaddress typeusb bus0 port1//inputinput typemouse busps2/input typekeyboard busps2/memballoon modelvirtioaddress typepci domain0x0000 bus0x00 slot0x06 function0x0//memballoon/devices
/domain 5、定义虚拟机 # virsh define test3.xml ---定义虚拟机跟上对应的文件即可 6、启动虚拟机 virsh start yjt ---yjt这个名字在配置文件定义的也就是虚拟机的名字。 到这里就ok了。 如果虚拟机不要用了可以使用如下方法销毁 7、停止虚拟机 # virsh shutdown yjt ---正常停止
# virsh destroy yjt ---强制停止 8、取消虚拟机的定义也就是删除 # virsh undefine yjt ---默认会删除/etc/libvirt/qemu下的test3.xml文件 转载于:https://www.cnblogs.com/yjt1993/p/10833641.html