闲者博客 - 模板 https://bk1314.com/tag/%E6%A8%A1%E6%9D%BF/ nokvm制作模版镜像 https://bk1314.com/70.html 2022-05-10T23:21:00+08:00 如何制作模版镜像?一、基于现有虚拟机制作模版镜像1.选择一个你要用来制作的虚拟机(举例为ecs8888)2.在此虚拟机里安装你想要安装的软件/驱动3.不同操作系统下初始化虚拟机windows下执行以下操作(1)在“C:\Windows\System32\”目录下新建一个start.bat,内容为:call C:\change.bat call del C:\change.bat(2)运行中输入gpedit.msc打开本地策略组编辑器(3)打开Windows设置→脚本→双击启动 (4)添加C:\Windows\System32\start.bat (5)正常关闭系统或者在面板上使用软关机 (6)执行拷贝命令把系统镜像拷贝为模版cp /home/nokvm/resource/ecs8888/uuid_sys.qcow2 /home/nokvm/templates/模版名称.qcow2Centos7执行以下操作(1)安装在线修改密码服务并设置为开机启动yum install qemu-guest-agent systemctl start qemu-guest-agent systemctl enable qemu-guest-agent(2)编辑/etc/rc.d/rc.local在文件中添加以下内容:sh /root/change.sh && rm -rf /root/change.sh(3)之后执行chmod +x /etc/rc.d/rc.local(4)正常关闭系统(5)执行拷贝命令把系统镜像拷贝为模版cp /home/nokvm/resource/ecs8888/uuid_sys.qcow2 /home/nokvm/templates/模版名称.qcow2Centos6执行以下操作(1)安装在线修改密码服务并设置为开机启动yum install qemu-guest-agent chkconfig --add qemu-ga(2)编辑/etc/rc.d/rc.local在文件中添加以下内容:sh /root/change.sh && rm -rf /root/change.sh(3)之后执行chmod +x /etc/rc.d/rc.local(4)正常关闭系统(5)执行拷贝命令把系统镜像拷贝为模版cp /home/nokvm/resource/ecs8888/uuid_sys.qcow2 /home/nokvm/templates/模版名称.qcow2Ubuntu/Debian执行以下操作(1)安装在线修改密码服务sudo apt-get install qemu-guest-agent(2)编辑/etc/rc.local 文件在exit 0之前添加以下内容:/etc/init.d/qemu-guest-agent start sh /root/change_other.sh && rm -rf /root/change_other.sh(3)之后执行chmod +x /etc/rc.local(4)正常关闭系统(5)执行拷贝命令把系统镜像拷贝为模版cp /home/nokvm/resource/ecs8888/uuid_sys.qcow2 /home/nokvm/templates/模版名称.qcow2二、通过ISO全新安装制作模版镜像1.下载windows下virtio驱动ISO文件(linux不用下载)并添加到光盘媒介https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/index.html2.以下是ISO中包含文件的内容NetKVM/ - Virtio网络驱动程序viostor/ - Virtio块驱动程序viorng/ - Virtio RNG驱动程序vioscsi/ - Virtio小型计算机系统接口(SCSI)驱动程序vioser/ - Virtio串行驱动程序Balloon/ - Virtio记忆气球驱动程序qxl/ - 适用于Windows 7及更早版本的QXL图形驱动程序。(构建virtio-win-0.1.103-1及更高版本)qxldod/ - 适用于Windows 8及更高版本的QXL图形驱动程序。(构建virtio-win-0.1.103-2及更高版本)pvpanic/- QEMU pvpanic设备驱动程序(构建virtio-win-0.1.103-2及更高版本)guest-agent/ - QEMU Guest Agent 32位和64位MSI安装程序qemupciserial/- QEMU PCI串行设备驱动程序3.新建或选择一台现有虚拟机加载需要系统的ISO镜像4.如何扩大或缩小系统盘?关闭系统后执行以下命令: qemu-img resize 镜像文件 +10G #扩大10G容量 qemu-img resize 镜像文件 -10G #缩小10G容量5.然后进入正常windows/linux正常安装流程linux可以正常安装。windows则需要加载virtio-win的驱动。 在光驱挂载页面先取消windows系统的挂载,然后挂载virtio-win-XXX.iso加载硬盘驱动。 加载驱动完成后取消驱动ISO挂载,重新挂载windows系统ISO然后继续按照安装流程安装。![]()6.安装完毕后进入系统后执行以下操作(1)在“C:\Windows\System32\”目录下新建一个start.bat,内容为:call C:\change.bat call del C:\change.bat(2)运行中输入gpedit.msc打开本地策略组编辑器(3)打开Windows设置→脚本→双击启动(4)添加C:\Windows\System32\start.bat7.加载virtio-win-的驱动ISO,安装如下程序必须安装,否则无法在线修改密码guest-agent/ - QEMU Guest Agent 32位和64位MSI安装程序8.优化安装你自己的软件9.安装驱动请继续从virtio-win-的驱动ISO中安装10.正常关机/主控面板中软关机11.执行拷贝命令把系统镜像拷贝为模版cp /home/nokvm/resource/ecs8888/uuid_sys.qcow2 /home/nokvm/templates/模版名称.qcow2[scode type="green" size="small"]镜像命名方式 以下开头命名镜像名称:centoswindowsdebianubuntu[/scode] windows 和linux模板镜像系统 https://bk1314.com/24.html 2022-02-23T22:19:00+08:00 点击进入百度网盘备用下载 windows模版 wget -O /home/nokvm/templates/windows7.qcow2 http://45.253.64.15:8013/templates/vip/win/windows7.qcow2 wget -O /home/nokvm/templates/windows10_x64_zh.qcow2 http://45.253.64.15:8013/templates/vip/win/windows10_x64_zh.qcow2 wget -O /home/nokvm/templates/windows10_x64_en.qcow2 http://45.253.64.15:8013/templates/vip/win/windows10_x64_en.qcow2 wget -O /home/nokvm/templates/windows2003r2.qcow2 http://45.253.64.15:8013/templates/vip/win/windows2003r2.qcow2 wget -O /home/nokvm/templates/windows2003r2_x86.qcow2 http://45.253.64.15:8013/templates/vip/win/windows2003r2_x86.qcow2 wget -O /home/nokvm/templates/windows2003R2_10G.qcow2 http://45.253.64.15:8013/templates/vip/win/windows2003R2_10G.qcow2 wget -O /home/nokvm/templates/windows2008r2.qcow2 http://45.253.64.15:8013/templates/vip/win/windows2008r2.qcow2 wget -O /home/nokvm/templates/windows2012r2.qcow2 http://45.253.64.15:8013/templates/vip/win/windows2012r2.qcow2 wget -O /home/nokvm/templates/windows2012r2_standard.qcow2 http://45.253.64.15:8013/templates/vip/win/windows2012r2_standard.qcow2 wget -O /home/nokvm/templates/windows2016.qcow2 http://45.253.64.15:8013/templates/vip/win/windows2016.qcow2 wget -O /home/nokvm/templates/windows10_x64_zh.qcow2 http://45.253.64.15:8013/templates/vip/win/windows10_x64_zh.qcow2 linux模版: wget -O /home/nokvm/templates/centos6.5.qcow2 http://45.253.64.15:8013/templates/vip/linux/centos6.5.qcow2 wget -O /home/nokvm/templates/centos6.8.qcow2 http://45.253.64.15:8013/templates/vip/linux/centos6.8.qcow2 wget -O /home/nokvm/templates/centos7.0.qcow2 http://45.253.64.15:8013/templates/vip/linux/centos7.0.qcow2 wget -O /home/nokvm/templates/centos7.2.qcow2 http://45.253.64.15:8013/templates/vip/linux/centos7.2.qcow2 wget -O /home/nokvm/templates/centos7.4.qcow2 http://45.253.64.15:8013/templates/vip/linux/centos7.4.qcow2 wget -O /home/nokvm/templates/centos7.5.qcow2 http://45.253.64.15:8013/templates/vip/linux/centos7.5.qcow2 wget -O /home/nokvm/templates/centos7.6.qcow2 http://45.253.64.15:8013/templates/vip/linux/centos7.6.qcow2 wget -O /home/nokvm/templates/centos8.1.qcow2 http://45.253.64.15:8013/templates/vip/linux/centos8.1.qcow2 wget -O /home/nokvm/templates/ubuntu16.4.qcow2 http://45.253.64.15:8013/templates/vip/linux/ubuntu16.4.qcow2 wget -O /home/nokvm/templates/ubuntu18.4.qcow2 http://45.253.64.15:8013/templates/vip/linux/ubuntu18.4.qcow2 wget -O /home/nokvm/templates/ubuntu19.10.qcow2 http://45.253.64.15:8013/templates/vip/linux/ubuntu19.10.qcow2 wget -O /home/nokvm/templates/debian10.3.qcow2 http://45.253.64.15:8013/templates/vip/linux/debian10.3.qcow2