CentOS7のvagrantでcurlのエラーになる

CentOS7で「VCCW – A WordPress development environment.」をインストールしようとしたところ、curlでエラーになります。vagrant 1.7.0 を使っています。

最初、VCCWのVagrantファイルに問題があるのかと思ったのですが、chef/centos-6.6でも同様なことがおきます。

$ vagrant box add chef/centos-6.6
==> box: Loading metadata for box 'chef/centos-6.6'
    box: URL: https://atlas.hashicorp.com/chef/centos-6.6
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.

1) virtualbox
2) vmware_desktop

Enter your choice: 1
==> box: Adding box 'chef/centos-6.6' (v1.0.0) for provider: virtualbox
    box: Downloading: https://atlas.hashicorp.com/chef/boxes/centos-6.6/versions/1.0.0/providers/virtualbox.box
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

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.

HTTPSのチェックでエラーになっているようです。vagrantコマンドの問題のような気もします。よくわかりませんが、curlコマンドを普通に使う分には大丈夫だからです。

$ curl -L https://vagrantcloud.com/miya0001/boxes/vccw/versions/1.9.5/providers/virtualbox.box > miya0001_vccw.box

最初わからなくて、curlコマンドを「cURL: tar.bz2 from Mirrors」から入手して最新版にしてみたりもしましたが、関係ありませんでした。

$ sudo yum install openssl-devel
$ wget http://curl.haxx.se/download/curl-7.39.0.tar.bz2
$ tar xf curl-7.39.0.tar.bz2
$ cd curl-7.39.0
$ ./configure --enable-libcurl-option --prefix=$HOME/applications/curl-7.39.0
$ make
$ make install
$ export PATH=$HOME/applications/curl-7.39.0/bin:$PATH
$ curl --version
curl 7.39.0 (x86_64-unknown-linux-gnu) libcurl/7.39.0 OpenSSL/1.0.1e zlib/1.2.7
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz

仕方ないので、curlコマンドでmiya0001_vccw.boxをダウンロードしてから、vagrant box add コマンドを実行してローカルに入れてからVCCWのインストールをしたところできました。git cloneするときに、git@github.com:miya0001/vccw.git を使うとgitアカウントが必要になるので、https の方にしてあります。

$ git clone https://github.com/miya0001/vccw.git
$ cd vccw
$ cp Vagrantfile.sample Vagrantfile
$ curl -L https://vagrantcloud.com/miya0001/boxes/vccw/versions/1.9.5/providers/virtualbox.box > miya0001_vccw.box
$ vagrant box add "miya0001/vccw" miya0001_vccw.box
$ vagrant up

とりあえず出来たのでよかったです。

Vagrant, Chef, VCCWに興味があるときは下記書籍が参考になります。

同じタグの記事: CentOS7
同じタグの記事: curl
同じタグの記事: Linux
同じタグの記事: Vagrant
同じカテゴリの記事: Linux