通过 Linux 上的 Vagrant 将文件上传到虚拟机 Windows 服务器时出错
Error To Upload File Via Vagrant on Linux to Virtual Machine Windows Server
我在 linux CentOS 上使用 vagrant 构建 windows server 2012 虚拟机,现在我得到了这个 Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.define "MACHINE" do |db|
db.vm.box = "win2k12r2en"
db.vm.network "public_network", bridge: "p1p1", ip: "130.103.97.40", netmask: "255.255.252.0"
db.vm.provider "virtualbox" do |vb|
vb.memory = 4096
vb.cpus = 2
vb.name = "MACHINE"
end
db.vm.provision :file, source: '/home/vagrant/ambientes/machine/shell/Install.ps1', destination: "/tmp/"
db.vm.provision :file, source: '/home/vagrant/ambientes/machine/shell/Lib-General.ps1', destination: "/tmp"
db.vm.provision :file, source: '/home/vagrant/ambientes/machine/shell/continue.bat', destination: "/tmp"
db.vm.provision :file, source: '/home/vagrant/ambientes/machine/shell/PHP_ZEND.zip', destination: "/tmp"
end
end
在 运行 脚本之后我得到了这个错误:
The following WinRM command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mkdir / -force
Stdout from the command:
Stderr from the command:
#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">mkdir : The path is not of a legal form._x000D__x000A_</S><S S="Error">At line:1 char:40_x000D__x000A_</S><S S="Error">+ $ProgressPreference='SilentlyContinue';mkdir / -force_x000D__x000A_</S><S S="Error">+ ~~~~~~~~~~~~~~_x000D__x000A_</S><S S="Error"> + CategoryInfo : InvalidArgument: (C:\:String) [New-Item], Argume _x000D__x000A_</S><S S="Error"> ntException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : CreateDirectoryArgumentError,Microsoft.PowerShel _x000D__x000A_</S><S S="Error"> l.Commands.NewItemCommand_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>
¿我做错了什么?,我是 vagrant 的新手,我遵循了这个 guide。谢谢你的时间。
我遵循了 vahdet 指导:我阅读了 github.com/hashicorp/vagrant/issues/7435 并做了一些解决方法:
- 将文件提供目标“/tmp”替换为"C:\tmp"
- 我将 "PHP_ZEND.zip" 文件上传到 NEXUS 服务器,然后通过 vagrant 脚本提供的 powershell 脚本下载到 VM。
我做了第二点,因为当脚本是 运行 zip 文件的规定时,VM 被迫关闭并自动销毁。
问题解决了。
我在 linux CentOS 上使用 vagrant 构建 windows server 2012 虚拟机,现在我得到了这个 Vagrantfile:
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.define "MACHINE" do |db|
db.vm.box = "win2k12r2en"
db.vm.network "public_network", bridge: "p1p1", ip: "130.103.97.40", netmask: "255.255.252.0"
db.vm.provider "virtualbox" do |vb|
vb.memory = 4096
vb.cpus = 2
vb.name = "MACHINE"
end
db.vm.provision :file, source: '/home/vagrant/ambientes/machine/shell/Install.ps1', destination: "/tmp/"
db.vm.provision :file, source: '/home/vagrant/ambientes/machine/shell/Lib-General.ps1', destination: "/tmp"
db.vm.provision :file, source: '/home/vagrant/ambientes/machine/shell/continue.bat', destination: "/tmp"
db.vm.provision :file, source: '/home/vagrant/ambientes/machine/shell/PHP_ZEND.zip', destination: "/tmp"
end
end
在 运行 脚本之后我得到了这个错误:
The following WinRM command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mkdir / -force
Stdout from the command:
Stderr from the command:
#< CLIXML
<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><S S="Error">mkdir : The path is not of a legal form._x000D__x000A_</S><S S="Error">At line:1 char:40_x000D__x000A_</S><S S="Error">+ $ProgressPreference='SilentlyContinue';mkdir / -force_x000D__x000A_</S><S S="Error">+ ~~~~~~~~~~~~~~_x000D__x000A_</S><S S="Error"> + CategoryInfo : InvalidArgument: (C:\:String) [New-Item], Argume _x000D__x000A_</S><S S="Error"> ntException_x000D__x000A_</S><S S="Error"> + FullyQualifiedErrorId : CreateDirectoryArgumentError,Microsoft.PowerShel _x000D__x000A_</S><S S="Error"> l.Commands.NewItemCommand_x000D__x000A_</S><S S="Error"> _x000D__x000A_</S></Objs>
¿我做错了什么?,我是 vagrant 的新手,我遵循了这个 guide。谢谢你的时间。
我遵循了 vahdet 指导:我阅读了 github.com/hashicorp/vagrant/issues/7435 并做了一些解决方法:
- 将文件提供目标“/tmp”替换为"C:\tmp"
- 我将 "PHP_ZEND.zip" 文件上传到 NEXUS 服务器,然后通过 vagrant 脚本提供的 powershell 脚本下载到 VM。
我做了第二点,因为当脚本是 运行 zip 文件的规定时,VM 被迫关闭并自动销毁。
问题解决了。