使用Windows 10創建Windows Server 2019的Open Stack虛擬機鏡像

1、軟硬件條件

操作系統:Windows 10 Pro

CPU:支持虛擬化技術

2、輸入輸出

輸入:Windows Server 2019的ISO文件

輸出:含有Windows Server 2019 Standard(桌面體驗)的Open Stack Raw Image

3、準備工作

1) 下載Windows Server 2019標準版的iso文件,解壓至目錄A

2) 本機安裝Hyper-V,安裝完成後,創建一個名爲external的外部虛擬交換機

3) 修改組策略,將“用戶配置\管理模板\Windows組件\Windows PowerShell\啓用腳本執行”設置爲“已啓用\允許所有腳本”

4) 安裝git for windows

5) Windows Server 2019 Standard的安裝密鑰,沒有密鑰則在輸入密鑰步驟點擊以後再說

6) 創建一個目錄B,用於克隆windows-openstack-imaging-tools

7) 創建一個目錄C,用於輸出鏡像文件

4、製作鏡像

1) 在目錄B中以管理員模式打開Windows PowerShell

2) 執行命令“git clone https://github.com/cloudbase/windows-openstack-imaging-tools.git”

3) 執行完成後,打開目錄B\windows-openstack-imaging-tools\Examples目錄,找到文件create-windows-online-cloud-image.ps1,複製一份,重命名爲create-windows-2019-image.ps1

4) 用文本編輯工具打開create-windows-2019-image.ps1文件,進行編輯

其中:

$windowsImagePath設爲目錄C\windows2019-image.raw.tgz

$wimFilePath設爲目錄A\sources\install.wim

$virtIOISOPath設爲目錄C\virtio.iso

$extraDriversPath設爲目錄C\Drivers\

$image可自行選擇其索引,默認的1的指向的是“Windows Server 2019 Standard (桌面體驗)”版

5) 在PowerShell中執行create-windows-2019-image.ps1

6) 耐心等待,當PowerShell中輸出“Waiting for WindowsOnlineImage-Sysprep225258611 to finish sysprep”後,在Hyper-V管理器中打開windows-openstack-imaging-tools創建的虛擬機

輸入密鑰(沒有則點擊以後再說),輸入密碼Pa$$w0rd登錄。此時,可以做一些通用性的操作來產生想要的鏡像模版,如安裝中文語言、IIS、.NET Framework 3.5、設置時區、對時服務器等。操作完成後,將虛擬機關閉。關閉後,等待PowerShell中的命令繼續執行,直到輸出“Windows online image generation finished”。

7) 在目錄C中找到windows2019-image.raw.img文件,即爲製作好的Open Stack鏡像文件

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章