我无法在cmd(Windows 10)上初始化vagrant键入vagrant up
,这是日志
`
C:\xampp\apache\ecomex\ecomex>vagrant up
Bringing machine 'ecomex' up with 'virtualbox' provider...
==> ecomex: Loading Berkshelf datafile...
==> ecomex: Sharing cookbooks with VM
==> ecomex: Checking if box 'grtjn/centos-7.0' is up to date...
==> ecomex: Clearing any previously set forwarded ports...
==> ecomex: Updating Vagrant's Berkshelf...
==> ecomex: Resolving cookbook dependencies...
==> ecomex: Fetching 'ecomex' from source at cookbooks/ecomex
==> ecomex: Using apt (3.0.0)
==> ecomex: Using ark (1.0.1)
==> ecomex: Using build-essential (3.2.0)
==> ecomex: Using chef_handler (1.3.0)
==> ecomex: Using ecomex (0.0.1) from source at cookbooks/ecomex
==> ecomex: Using nodejs (2.2.0)
==> ecomex: Using redisio (2.3.0)
==> ecomex: Using seven_zip (2.0.0)
==> ecomex: Using ulimit (0.3.3)
==> ecomex: Using windows (1.39.2)
==> ecomex: Using yum (3.10.0)
==> ecomex: Using yum-epel (0.6.6)
==> ecomex: Vendoring apt (3.0.0) to C:/Users/EruAizen/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160329-4476-mlo9s9-ecomex/apt
==> ecomex: Vendoring ark (1.0.1) to C:/Users/EruAizen/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160329-4476-mlo9s9-ecomex/ark
==> ecomex: Vendoring build-essential (3.2.0) to C:/Users/EruAizen/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160329-4476-mlo9s9-ecomex/build-essential
==> ecomex: Vendoring chef_handler (1.3.0) to C:/Users/EruAizen/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160329-4476-mlo9s9-ecomex/chef_handler
==> ecomex: Vendoring ecomex (0.0.1) to C:/Users/EruAizen/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160329-4476-mlo9s9-ecomex/ecomex
==> ecomex: Vendoring nodejs (2.2.0) to C:/Users/EruAizen/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160329-4476-mlo9s9-ecomex/nodejs
==> ecomex: Vendoring redisio (2.3.0) to C:/Users/EruAizen/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160329-4476-mlo9s9-ecomex/redisio
==> ecomex: Vendoring seven_zip (2.0.0) to C:/Users/EruAizen/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160329-4476-mlo9s9-ecomex/seven_zip
==> ecomex: Vendoring ulimit (0.3.3) to C:/Users/EruAizen/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160329-4476-mlo9s9-ecomex/ulimit
==> ecomex: Vendoring windows (1.39.2) to C:/Users/EruAizen/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160329-4476-mlo9s9-ecomex/windows
==> ecomex: Vendoring yum (3.10.0) to C:/Users/EruAizen/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160329-4476-mlo9s9-ecomex/yum
==> ecomex: Vendoring yum-epel (0.6.6) to C:/Users/EruAizen/.berkshelf/vagrant-berkshelf/shelves/berkshelf20160329-4476-mlo9s9-ecomex/yum-epel
==> ecomex: Clearing any previously set network interfaces...
==> ecomex: Preparing network interfaces based on configuration...
ecomex: Adapter 1: nat
==> ecomex: Forwarding ports...
ecomex: 3000 (guest) => 9898 (host) (adapter 1)
==> ecomex: Booting VM...
==> ecomex: Waiting for machine to boot. This may take a few minutes...
ecomex: SSH address: 127.0.0.1:22
ecomex: SSH username: vagrant
ecomex: SSH auth method: private key
`
再过几分钟,它会收到下一条错误消息
等待机器启动时超时。这意味着 Vagrant无法与内部的客户机通信 配置的(" config.vm.boot_timeout"值)时间段。
如果你看一下,你应该能够看到错误 Vagrant在尝试连接机器时有过。这些错误 对于可能出现的问题通常是很好的暗示。
如果您使用自定义框,请确保网络正常 工作,你可以连接到机器。这很常见 网络没有在这些框中正确设置的问题。 验证身份验证配置是否也已正确设置, 同样。
如果该框似乎正在正常启动,您可能需要增加 超时(" config.vm.boot_timeout")值。
我的流浪文件
# -*- mode: ruby -*-
# vi: set ft=ruby
VM = 'ecomex'
Vagrant.configure(2) do |config|
#selecting Cent OS 7.0
config.vm.box = 'grtjn/centos-7.0'
config.vbguest.auto_update = false
# proxy network: Node: 3000 & Apache: 9898
config.vm.network :forwarded_port, guest: 3000, host:9898, auto_correct: true
config.vm.network :forwarded_port, guest: 22, host: 2222, id: "ssh", disabled: "true"
#VirtualBox setup
config.vm.define VM
config.vm.provider :virtualbox do |vb|
vb.name = VM
end
#Fixing issue: stdin is not tty
ssh_fix = 'bash -c "BASH_ENV=/etc/profile exec bash"'
config.ssh.shell = ssh_fix unless ARGV[0] == 'ssh'
#Adding omnibus & bershelf prugins
config.omnibus.chef_version = :latest
config.berkshelf.enabled = true
config.berkshelf.berksfile_path = './Berksfile'
#Chef provisioning
config.vm.provision :chef_solo do |chef|
chef.add_recipe VM
chef.custom_config_path = 'Vagrantfile.chef'
chef.json = {
:nodejs => {
:install_method => 'package',
:npm => '2.13.4'
}
}
end
#start node app
config.vm.provision :shell do |s|
s.privileged = false
s.inline = 'cd /vagrant && pm2 start pm2.json'
end
end
我访问了这个帖子Vagrant stuck connection timeout retrying并在我的vagrant文件中添加了该行以查看发生了什么
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
之后,screen shows request login这就是我被卡住的地方,因为在类型' vagrant'之后因为登录和密码没有任何事情发生。
注意:
对不起我的拼写,我的英语不够好。
感谢您的帮助!
答案 0 :(得分:0)
你的帖子中有一些有趣的东西:
根据您C:\xampp\apache\ecomex\ecomex
编辑的目录路径(vagrant up
),您似乎正在运行xampp。从apache / xampp服务器配置中运行vagrant是一个有趣的想法,至少可以说。它也让我觉得xampp可能会干扰(端口22或2222有什么问题吗?)。
你可以启动并进入一个不那么自定义的流浪盒吗?你提供的那个有一堆活动部件,其中很多都可能是罪魁祸首。
您是否从提升的命令提示符运行? (以管理员身份运行)。
尝试注释掉(将#
添加到开头)以下几行,因为它们与ssh相混淆:
ssh_fix = 'bash -c "BASH_ENV=/etc/profile exec bash"'
config.ssh.shell = ssh_fix unless ARGV[0] == 'ssh'
以便他们成为
#ssh_fix = 'bash -c "BASH_ENV=/etc/profile exec bash"'
#config.ssh.shell = ssh_fix unless ARGV[0] == 'ssh'
发布vagrant up --debug
的结果(也可以通过vagrant up --debug > vagrantlog.log
输出到文件中)。