安装和通过 SSH 连接到 Vagrant Box 的困难

安装和通过 SSH 连接到 Vagrant Box 的困难

我是 Vagrant 的新手,无法让它正常工作。我毫无问题地安装了 Vagrant,并且安装并打开了 Virtual Box。当我创建一个框(vagrant init), it seems to work fine. Then when I typevagrant up`)时,我得到了一堆文本。它似乎在 Virtual Box 中创建了一个 VM,但它并没有显示在终端中。当我输入 vagrant ssh 时,我也得到了一些文本。请告诉我我可能做错了什么。这与我机器上的权限有关吗?

这是终端会话:

Last login: Wed Dec  3 08:41:57 on ttys001
Computer:~ mattbowlby$ cd Desktop/dev/treehouse/
Computer:treehouse mattbowlby$ vagrant up
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr in PATH, mode 040777
A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.
Computer:treehouse mattbowlby$ vagrant init hashicorp/precise64
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr in PATH, mode 040777
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
Computer:treehouse mattbowlby$ vagrant up --provider=virtualbox
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'hashicorp/precise64'...
Progress: 90%/Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:309:in `initialize': Permission denied - /Users/mattbowlby/.vagrant.d/data/machine-index/index (Errno::EACCES)
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:309:in `open'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:309:in `open'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:309:in `unlocked_save'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:227:in `block (2 levels) in set'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:323:in `block in with_index_lock'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:321:in `open'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:321:in `with_index_lock'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:192:in `block in set'
    from /Applications/Vagrant/embedded/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:191:in `set'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:283:in `id='
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/providers/virtualbox/action/import.rb:15:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/providers/virtualbox/action/customize.rb:40:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/providers/virtualbox/action/check_accessible.rb:18:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:196:in `action_raw'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:173:in `block in action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:474:in `lock'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:161:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:161:in `action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
Computer:treehouse mattbowlby$ vagrant ssh
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr in PATH, mode 040777
==> default: VM not created. Moving on...
Computer:treehouse mattbowlby$ clear

Computer:treehouse mattbowlby$ vagrant init hashicorp/precise64
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr in PATH, mode 040777
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
Computer:treehouse mattbowlby$ vagrant up --provider=virtualbox
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr in PATH, mode 040777
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'hashicorp/precise64'...
Progress: 90%/Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:309:in `initialize': Permission denied - /Users/mattbowlby/.vagrant.d/data/machine-index/index (Errno::EACCES)
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:309:in `open'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:309:in `open'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:309:in `unlocked_save'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:227:in `block (2 levels) in set'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:323:in `block in with_index_lock'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:321:in `open'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:321:in `with_index_lock'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:192:in `block in set'
    from /Applications/Vagrant/embedded/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine_index.rb:191:in `set'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:283:in `id='
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/providers/virtualbox/action/import.rb:15:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/providers/virtualbox/action/customize.rb:40:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/providers/virtualbox/action/check_accessible.rb:18:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builtin/call.rb:53:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/warden.rb:34:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/builder.rb:116:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `block in run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/util/busy.rb:19:in `busy'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/action/runner.rb:66:in `run'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:196:in `action_raw'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:173:in `block in action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/environment.rb:474:in `lock'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:161:in `call'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/machine.rb:161:in `action'
    from /Applications/Vagrant/embedded/gems/gems/vagrant-1.6.5/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
Computer:treehouse mattbowlby$ ssh vagrant
ssh: Could not resolve hostname vagrant: nodename nor servname provided, or not known
Computer:treehouse mattbowlby$ vagrant ssh
/Applications/Vagrant/bin/../embedded/gems/gems/vagrant-1.6.5/lib/vagrant/pre-rubygems.rb:31: warning: Insecure world writable dir /usr in PATH, mode 040777
/Applications/Vagrant/embedded/gems/gems/bundler-1.6.6/lib/bundler/runtime.rb:222: warning: Insecure world writable dir /usr in PATH, mode 040777
==> default: VM not created. Moving on...
Computer:treehouse mattbowlby$ 

答案1

你的主要问题是

 Permission denied - /Users/mattbowlby/.vagrant.d/data/machine-index/index (Errno::EACCES)

如果你没有任何想要保存的 vagrant 东西,一个简单的解决方法是

 rm -rf /Users/mattbowlby/.vagrant.d

然后重新 vagrant init 和 vagrant up

相关内容