Vagrant Error: SSL certificate problem: unable to get local issuer certificate

想不到一開始使用Vagrant便出現問題
還以為可以很簡單地跟著官網的教學來建立我第一個用Vagrant來建立的Virtual Machine
https://www.vagrantup.com/docs/getting-started/
誰不知當我嘗試執行以下指令時

vagrant init hashicorp/precise64
vagrant up

出現了以下的錯誤信息
Vagrant Error: SSL certificate problem: unable to get local issuer certificate

詳情
Vagrant Error: SSL certificate problem: unable to get local issuer certificate

D:\Users\Vagrant\DefaultVagrant>vagrant init hashicorp/precise64
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.

D:\Users\Vagrant\DefaultVagrant>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'hashicorp/precise64' could not be found. Attempting to find an
d 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 Atlas, 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://atlas.hashicorp.com/hashicorp/precise64"]
Error: SSL certificate problem: unable to get local issuer certificate
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

暫時的解決方法十分簡單
我們可以在剛建立的Vagrant資料夾內開啟”Vagrantfile
Vagrantfile
之後加入這句設定來 進行insecure connection

# 把Download 設定來 insecure download 便可以暫時解決 SSl Certification verification的問題了
config.vm.box_download_insecure=true;

Vagrant download insecure
儲存之後再執行

vagrant up

應該便可以起動這個Virtual Machine了

如果大家知道怎樣可以解決 SSL certification verification 的問題
歡迎大家分享

Hope you find it useful

Leave a Reply