Build Virtualbox Image for Windows 10 Using Packer
Clone packer-windows
- Original Repo: https://github.com/joefitzgerald/packer-windows.git
- Forked Repo containing support for Windows 10 1903: https://github.com/damonbreeden/packer-windows.git
Edit answer_files/10_1903/Autounattend.xml
Add Key for Windows 10
<!-- Product Key from http://technet.microsoft.com/en-us/library/jj612867.aspx -->
- <ProductKey>NPPR9-FWDCX-D2C8J-H872K-2YT43
+ <ProductKey>
+ <Key>KEY-CONTENT</Key>
<WillShowUI>Never</WillShowUI>
</ProductKey>
</UserData>
Change Language from en-US
to zh-CN
<SetupUILanguage>
- <UILanguage>en-US</UILanguage>
+ <UILanguage>zh-CN</UILanguage>
</SetupUILanguage>
- <InputLocale>en-US</InputLocale>
- <SystemLocale>en-US</SystemLocale>
- <UILanguage>en-US</UILanguage>
- <UILanguageFallback>en-US</UILanguageFallback>
- <UserLocale>en-US</UserLocale>
+ <InputLocale>zh-CN</InputLocale>
+ <SystemLocale>zh-CN</SystemLocale>
+ <UILanguage>zh-CN</UILanguage>
+ <UILanguageFallback>zh-CN</UILanguageFallback>
+ <UserLocale>zh-CN</UserLocale>
- <SystemLocale>en-US</SystemLocale>
- <UILanguage>en-US</UILanguage>
- <UILanguageFallback>en-US</UILanguageFallback>
- <UserLocale>en-US</UserLocale>
+ <SystemLocale>zh-CN</SystemLocale>
+ <UILanguage>zh-CN</UILanguage>
+ <UILanguageFallback>zh-CN</UILanguageFallback>
+ <UserLocale>zh-CN</UserLocale>
Fix issue scripts/compact.bat
-cmd /c C:\Windows\Temp\ultradefrag-portable-6.1.0.amd64\udefrag.exe --optimize --repeat C:
+start /wait C:\Windows\Temp\ultradefrag-portable-6.1.0.amd64\udefrag.exe --optimize --repeat C:
Edit windows_10_1903.json
"variables": {
- "iso_url": "/Volumes/WD My Passport Ultra/Software/Microsoft/Windows/Windows 10/Win10_1903_V1_English_x64.iso",
+ "iso_url": "./iso/Win10_1903.iso",
"iso_checksum_type": "sha1",
- "iso_checksum": "344ca92459c23663d5f857c72a7c030f85f19be8",
+ "iso_checksum": "cf1e64128585b6ddf7cc53d91758d7b0f836b863",
"autounattend": "answer_files/10_1903/Autounattend.xml",
"headless": "true",
"cpus": "2",
Download Windows Image and put it to iso
folder
The latest Windows 10 image is Win10_1903_V1_Chinese\(Simplified\)_x64.iso
, and rename it to Win10_1903.iso. Then put this image to iso
folder.
Build Windows Virutal Box
packer build windows_10_1903.json
windows_10_1903_virtualbox.box
will be generated in the root of the packer-windows
Add as a Vagrant box
vagrant box add --name windows windows_10_1903_virtualbox.box
Use vagrantfile-windows_10.template
as Vagrantfile template to start a VM
- Create a folder
- Copy
vagrantfile-windows_10.template
into that folder and rename it toVagrantfile
- Change the content of this file:
Vagrant.require_version ">= 1.6.2"
Vagrant.configure("2") do |config|
- config.vm.define "vagrant-windows-10-preview"
- config.vm.box = "windows_10_preview"
+ config.vm.define "vagrant-windows"
+ config.vm.box = "windows"
config.vm.communicator = "winrm"
- Start using
vagrant up