问题
I just tried to setup metasploitable3
and ran:
.\build.ps1 windows2008
in the windows10 powershell.
After a while I've got this error:
Provisioning with windows-shell...
==> virtualbox-iso: Provisioning with shell script: D:\Bibliothek\Downloads1\metasploitable3-master\metasploitable3-master\packer\templates/../../scripts/installs/install_boxstarter.bat virtualbox-iso:
==> virtualbox-iso: 'chocolatey' is not recognized as an internal or external command, virtualbox-iso: C:\Users\vagrant>chocolatey feature enable -n=allowGlobalConfirmation virtualbox-iso:
==> virtualbox-iso: operable program or batch file. virtualbox-iso: C:\Users\vagrant>choco install BoxStarter virtualbox-iso: virtualbox-iso: C:\Users\vagrant>chocolatey feature disable -n=allowGlobalConfirmation
==> virtualbox-iso: 'choco' is not recognized as an internal or external command,
==> virtualbox-iso: operable program or batch file.
==> virtualbox-iso: 'chocolatey' is not recognized as an internal or external command
==> virtualbox-iso: operable program or batch file.
==> virtualbox-iso: Provisioning step had errors: Running the cleanup provisioner, if present...
==> virtualbox-iso: Deregistering and deleting VM...
==> virtualbox-iso: Deleting output directory... Build 'virtualbox-iso' errored: Script exited with non-zero exit status: 1.Allowed exit codes are: [0]
==> Some builds didn't complete successfully and had errors: --> virtualbox-iso: Script exited with non-zero exit status: 1.Allowed exit codes are: [0]
回答1:
I tried this solution:
https://github.com/rapid7/metasploitable3/issues/75
But continue to get the same error you are getting building on Ubuntu 19.10. I am using:
$ packer build --only=virtualbox-iso packer/templates/windows_2008_r2.json
Specifically, I replaced the CA cert check:
:virtualbox
move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp
cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox"
:: There needs to be Oracle CA (Certificate Authority) certificates installed in order
:: to prevent user intervention popups which will undermine a silent installation.
cmd /c certutil -addstore -f "TrustedPublisher" C:\Windows\Temp\virtualbox\cert\vbox-sha1.cer
cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S
goto :done
来源:https://stackoverflow.com/questions/60079317/chocolatey-is-not-recognised-as-an-internal-or-external-command