【问题标题】:Vagrant up on Windows 7: error setting certificate verify locations在 Windows 7 上流浪:错误设置证书验证位置
【发布时间】:2018-03-21 10:40:22
【问题描述】:

我刚刚遇到Vagrant,正在尝试通过入门说明https://www.vagrantup.com/intro/getting-started/index.html

在开始您的第一个项目之前,请安装最新版本的 Vagrant。由于我们将使用 VirtualBox 作为入门指南的提供者,因此请同时安装它。

我的主机是Windows 7 x64Virtualbox5.1.14r112924。虚拟化已启用:我成功使用 Windows XP 虚拟机。

所以我安装了最新的Vagrant 版本2.0.0。我将Powershell2.0 更新为5.0 以修复vagrant up 没有任何问题。

所以,入门指南:

  1. vagrant init hashicorp/precise64:好的,文件Vagrantfile出现了;
  2. vagrant up,入门说:

运行上述两个命令后,您将在 VirtualBox 中拥有一个运行 Ubuntu 12.04 LTS 64 位的完全运行的虚拟机。

但我明白了:

E:\VM\v_demo>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'hashicorp/precise64' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
The box 'hashicorp/precise64' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Vagrant Cloud, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:

URL: ["https://vagrantcloud.com/hashicorp/precise64"]
Error: error setting certificate verify locations:
  CAfile: /mingw64/ssl/certs/ca-bundle.crt
  CApath: none

在我的工作文件夹中的以下文件树:

|   Vagrantfile
|
\---.vagrant
    \---machines
        \---default
            \---virtualbox
                    vagrant_cwd

此错误的 Internet 搜索显示有关 curl и git 的结果,但此处未使用它们。

关于从错误消息中尝试vagrant login 的建议也不清楚。正如https://www.vagrantup.com/docs/cli/login.html 所说的

命令:vagrant login

login 命令用于向 HashiCorp 的 Vagrant 进行身份验证 云服务器。仅当您访问受保护时才需要记录 框或使用 Vagrant Share。

登录不是使用 Vagrant 的必要条件。绝大多数 Vagrant 不需要登录。只有某些功能,例如 受保护的盒子或 Vagrant Share 需要登录。

我不认为该测试示例是私有的。 而且我在任何地方都找不到Create account 按钮。

我错过了什么?

UPD

Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.box_download_insecure = true
end

config.vm.box_download_insecure = true 没有帮助:结果相同。

UPD2 我找到了如何创建帐户https://app.vagrantup.com/account/new(在我使用移动版之前)。 vagrant login 没有帮助:同样的结果

【问题讨论】:

  • 尝试在你的 vagrantfile 中添加config.vm.box_download_insecure = true
  • @FrédéricHenri,没有帮助,同样的结果。
  • curl/wget 用于下载盒子,可以运行curl -O https://hashicorp-files.hashicorp.com/precise64.box下载盒子
  • @FrédéricHenri,curl/wget 真的用于Windows 7x64 吗?我想只适用于Linux 机器。我直接从https://hashicorp-files.hashicorp.com/precise64.box 链接下载它。需要时间下载并探索如何从文件中vagrant up
  • vagrant 仍然需要一种方法来下载机器,即使是 Windows,他们在内部使用 curl

标签: windows windows-7 vagrant vagrant-windows


【解决方案1】:

手动解决方案:

  1. 手动将.box文件从https://hashicorp-files.hashicorp.com/precise64.box下载到本地文件夹local_box\precise64.box
  2. Vagrantfile内添加本地.box-文件的路径:

    Vagrant.configure("2") do |config|
    
      config.vm.box = "local_box/precise64.box"
    
    end
    
  3. vagrant up 现在可以正常工作了。

【讨论】:

  • 我尝试了您的解决方案,但我想知道,我是否在vagrant 文件夹中创建一个名为local_box 的新文件夹?
  • @NickKing local_folder 是在Windows 7 中手动创建的,只是为了测试命令中的相对路径。没必要
【解决方案2】:

实际问题是代理服务器。 设置Windows环境变量https_proxy=http://192.168.x.xxx:3128解决了这个问题。

【讨论】:

    猜你喜欢
    • 2017-06-08
    • 2013-11-10
    • 2011-10-22
    • 2015-11-17
    • 2015-08-24
    • 2018-10-25
    • 1970-01-01
    • 1970-01-01
    • 2015-07-26
    相关资源
    最近更新 更多