admin管理员组

文章数量:1531792

制作Windows7镜像

(1)新建Windows7的虚拟机,安装系统方法选本地安装介质

(2)选择安装镜像,需先讲win7镜像移动到default存储池里

(3)安装前准备工作,安装前需进行定制,所以勾选

(4)定制磁盘文件,disk bus设置为virtio

(5)定制网卡设备的模式,把device model设置为virtio,提高网卡性能

(6)添加一块软盘,点击连接,选择驱动

(7)设置虚拟机启动顺序

(8)进行Windows7安装,点击加载驱动程序,选win7,下一步安装

(9)Windows7中安装phpstudy

(10)对Windows进行封装,封装前记得讲IP设为自动获取

(11)进入虚拟机详情页,弹出连接的光盘并删除软盘

(12)查看虚拟机的镜像文件,发现镜像文件为16G,实际占用8.4G

[root@localhost ~]# qemu-img info /var/lib/libvirt/images/win7.qcow2 
image: /var/lib/libvirt/images/win7.qcow2
file format: qcow2
virtual size: 16G (17179869184 bytes)
disk size: 8.4G
cluster_size: 65536
Format specific information:
    compat: 1.1
    lazy refcounts: true
[root@localhost ~]# 

(13)安装virt-sysprep所提供的软件包libguestfs-tools

yum install libguestfs-tools -y

(14)压缩镜像文件,压缩后的镜像为/var/lib/libvirt/images/win7_phpstay.qcow2

[root@localhost ~]# virt-sparsify --tmp /tmp --compress --convert qcow2 /var/lib/libvirt/images/win7.qcow2 /var/lib/libvirt/images/win7_phpstay.qcow2 

测试Windows7镜像

(1)新建虚拟机,选导入现有磁盘映像,选Windows7,完成

(2)进入到桌面

(3)查看IP

(4)查看phpstudy是否可用

本文标签: 镜像kvmwin