2015-10-04 67 views
7

我的官方文档流浪者在以下 https://docs.vagrantup.com/v2/getting-started/index.html游民涨不工作在Windows

我已经安装了无业游民和虚框在Windows 10的64位处理器。 上运行命令提示符这些命令后,我得到:

vagrant init hashicorp/precise32 
vagrant up 

错误,如下图所示: 带机“默认”了“VirtualBox的”供应商... ==>默认:箱“hashicorp/precise32”找不到。试图找到并安装... 默认值:框提供程序:virtualbox 默认值:框版本:> = 0 无法找到框'hashicorp/precise32'或无法在远程目录中访问 。如果这是HashiCorp Atlas上的专用 箱,请确认您通过 vagrant login登录。另外,请仔细检查名称。扩展 网址和错误讯息如下:

URL:“https://atlas.hashicorp.com/hashicorp/precise32”] 错误:SSL证书问题:这里无法获取本地颁发者证书 更多细节:http://curl.haxx.se/docs/sslcerts.html

卷曲进行SSL证书验证默认情况下,使用证书颁发机构(CA)公钥(CA证书)的“绑定” 。如果缺省 软件包文件不够用,则可以使用--cacert选项指定备用文件 。 如果此HTTPS服务器使用由证书 中代表的CA签署的证书,证书验证可能失败,原因是证书存在 问题(它可能已过期,或者名称可能与 不匹配URL中的域名)。 如果您想关闭卷发对证书的验证,请使用 -k(或--insecure)选项。

如何解决此错误?

回答

10

如果你得到一个SSL的问题,你可以尝试使用--insecure选项

vagrant box add --insecure hashicorp/precise32 hashicorp/precise32 

--insecure When present, SSL certificates won't be verified if the URL is an HTTPS URL

添加框,您可能需要清洁~/.vagrant.d/tmp/文件夹,如果你有一些未完成转让

你也可以下载ssl证书并直接用它绕过错误

$ vagrant box add --cacert <certificate> box_name 
3

由于长期禁用SSL验证是一种可怕的做法,因此您可以通过将证书添加到嵌入式Ruby的信任链和卷曲(痛苦但可能自动化,或者更好地自动化,或更好)来正确纠正证书问题使用添加到新Vagrant版本的备用CA路径? config.vm.box_download_ca_cert似乎是新的设置。

手动方式:

The steps are as follows: 

Step 1: Obtain the correct trust certificate 
Step 2: Locate RubyGems certificate directory in your installation 
Step 3: Copy correct trust certificate 
Step 4: Profit 


Step 1: Obtain the correct trust certificate 

We need to download the correct trust certificate, YourCompanyRootCA.pem. 
This can probably be obtained from your IT department or by exporting the certificate from your web browser or certificate store (and possibly converting to .pem using OpenSSL). 

IMPORTANT: File must have .pem as extension. Browsers like Chrome will try to save it as plain text file. Ensure you change the filename to end with .pem after you have downloaded it. 

Step 2: Locate Ruby certificate directory in your installation 

In order for us copy this file, we need to know where to put it. 

Depending on where you installed Ruby (or Vagrant has embedded it), the directory will be different. 

Take for example the default installation of Ruby 2.1.5, placed in C:\Ruby21 
Or the Vagrant default of C:\HashiCorp\Vagrant\embedded (or /opt on Linux) 
Search for `cacert.pem` or any `*.pem` in those directories. 

Step 3: Copy new trust certificate 

Now, locate ssl_certs directory (Ruby) and copy the .pem file we obtained from previous step inside. 

It will be listed with other files like AddTrustExternalCARoot.pem. 

If you are updating the Vagrant cacert.pem, make a backup copy, then append the entire contents of your new .pem file to the end of the cacert.pem. This should eliminate the warnings from Vagrant's ruby/curl. 
7

可以在Vagrantfile

config.vm.box_download_insecure=true 
添加此