スポンサーリンク

Vagrant + VirtualBox でWindows上に開発環境を構築する(2)

Vagrant Windows

前回、Windows10にVagrant + VirtualBoxを使ってCentOSをインストールした。

今回は、Vagrant + Chefで環境構築を自動化するため、Vagrantのプラグインをインストールしていきます。

Vagrantプラグインのインストール

VirtualBoxをVagrantから利用するプラグイン

C:\WINDOWS\system32>vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Successfully uninstalled addressable-2.7.0
Successfully uninstalled buff-config-2.0.0
Successfully uninstalled buff-extensions-2.0.0
Successfully uninstalled buff-ignore-1.2.0
Successfully uninstalled buff-ruby_engine-1.0.0
Successfully uninstalled buff-shell_out-1.1.0
Successfully uninstalled celluloid-0.16.0
Successfully uninstalled celluloid-io-0.16.2
Successfully uninstalled chef-config-15.7.32
Successfully uninstalled chef-utils-15.7.32
Successfully uninstalled faraday-0.17.3
Successfully uninstalled fuzzyurl-0.9.0
Successfully uninstalled hashie-2.1.2
Successfully uninstalled hitimes-2.0.0
Successfully uninstalled libyajl2-1.2.0
Successfully uninstalled mixlib-authentication-3.0.6
Successfully uninstalled mixlib-config-3.0.6
Successfully uninstalled mixlib-shellout-3.0.9-universal-mingw32
Successfully uninstalled multipart-post-2.1.1
Successfully uninstalled nio4r-2.5.2
Successfully uninstalled public_suffix-4.0.3
Removing rackup
Successfully uninstalled rack-2.1.2
Successfully uninstalled retryable-2.0.4
Successfully uninstalled ridley-5.1.1
Successfully uninstalled semverse-2.0.0
Successfully uninstalled timers-4.0.4
Successfully uninstalled tomlrb-1.2.9
Successfully uninstalled varia_model-0.6.0
Successfully uninstalled win32-process-0.8.3
Successfully uninstalled wmi-lite-1.0.5
Installed the plugin 'vagrant-vbguest (0.23.0)'!

C:\WINDOWS\system32>

VagrantからChef Zero Serverを起動するプラグイン

C:\WINDOWS\system32>vagrant plugin install vagrant-chef-zero
Installing the 'vagrant-chef-zero' plugin. This can take a few minutes...
Fetching: semverse-2.0.0.gem (100%)
Fetching: retryable-2.0.4.gem (100%)
Fetching: mixlib-authentication-3.0.6.gem (100%)
Fetching: hashie-2.1.2.gem (100%)
Fetching: multipart-post-2.1.1.gem (100%)
Fetching: faraday-0.17.3.gem (100%)
Fetching: chef-utils-15.7.32.gem (100%)
Fetching: win32-process-0.8.3.gem (100%)
Fetching: wmi-lite-1.0.5.gem (100%)
Fetching: mixlib-shellout-3.0.9-universal-mingw32.gem (100%)
Fetching: tomlrb-1.2.9.gem (100%)
Fetching: mixlib-config-3.0.6.gem (100%)
Fetching: fuzzyurl-0.9.0.gem (100%)
Fetching: public_suffix-4.0.3.gem (100%)
Fetching: addressable-2.7.0.gem (100%)
Fetching: chef-config-15.7.32.gem (100%)
Fetching: nio4r-2.5.2.gem (100%)
Building native extensions.  This could take a while...
Fetching: hitimes-2.0.0.gem (100%)
Fetching: timers-4.0.4.gem (100%)
Fetching: celluloid-0.16.0.gem (100%)
Fetching: celluloid-io-0.16.2.gem (100%)
Fetching: buff-ruby_engine-1.0.0.gem (100%)
Fetching: buff-shell_out-1.1.0.gem (100%)
Fetching: buff-ignore-1.2.0.gem (100%)
Fetching: buff-extensions-2.0.0.gem (100%)
Fetching: varia_model-0.6.0.gem (100%)
Fetching: buff-config-2.0.0.gem (100%)
Fetching: ridley-5.1.1.gem (100%)
Fetching: rack-2.1.2.gem (100%)
Fetching: libyajl2-1.2.0.gem (100%)
Building native extensions.  This could take a while...
Building native extensions.  This could take a while...
Vagrant failed to properly resolve required dependencies. These
errors can commonly be caused by misconfigured plugin installations
or transient network issues. The reported error is:

ERROR: Failed to build gem native extension.

    current directory: C:/Users/alfort/.vagrant.d/gems/2.4.9/gems/ffi-yajl-1.4.0/ext/ffi_yajl/ext/encoder
C:/HashiCorp/Vagrant/embedded/mingw64/bin/ruby.exe -r ./siteconf20200208-6664-1wbo9co.rb extconf.rb
 -IC:/Users/alfort/.vagrant.d/gems/2.4.9/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/include -march=x86-64 -mtune=generic -O2 -pipe
 -LC:/Users/alfort/.vagrant.d/gems/2.4.9/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/lib -L. -pipe
creating Makefile

current directory: C:/Users/alfort/.vagrant.d/gems/2.4.9/gems/ffi-yajl-1.4.0/ext/ffi_yajl/ext/encoder
make "DESTDIR=" clean

current directory: C:/Users/alfort/.vagrant.d/gems/2.4.9/gems/ffi-yajl-1.4.0/ext/ffi_yajl/ext/encoder
make "DESTDIR="
generating encoder-x64-mingw32.def
compiling encoder.c
encoder.c: In function 'Init_encoder':
encoder.c:382:20: error: 'rb_cFixnum' undeclared (first use in this function)
  382 |   rb_define_method(rb_cFixnum, "ffi_yajl", rb_cFixnum_ffi_yajl, 2);
      |                    ^~~~~~~~~~
encoder.c:382:20: note: each undeclared identifier is reported only once for each function it appears in
encoder.c:383:20: error: 'rb_cBignum' undeclared (first use in this function)
  383 |   rb_define_method(rb_cBignum, "ffi_yajl", rb_cBignum_ffi_yajl, 2);
      |                    ^~~~~~~~~~
make: *** [Makefile:242: encoder.o] Error 1

make failed, exit code 2

Gem files will remain installed in C:/Users/alfort/.vagrant.d/gems/2.4.9/gems/ffi-yajl-1.4.0 for inspection.
Results logged to C:/Users/alfort/.vagrant.d/gems/2.4.9/extensions/x64-mingw32/2.4.0/ffi-yajl-1.4.0/gem_make.out

C:\WINDOWS\system32>

エラーが出ました。

エラーをよく見ると、「rb_cFixnum」「rb_cBignum」が宣言されていない(undeclared)と言っている。

調べたところ、 Ruby 2.4.0以降では FixnumとBignumはIntegerに統合されたため、使用できないとのこと。

インストールできないので、”vagrant-chef-zero”はスキップします。

ゲストOS に Chef をインストールするプラグイン

C:\WINDOWS\system32>vagrant plugin install vagrant-omnibus
Installing the 'vagrant-omnibus' plugin. This can take a few minutes...
Fetching: vagrant-omnibus-1.5.0.gem (100%)
Successfully uninstalled addressable-2.7.0
Successfully uninstalled buff-config-2.0.0
Successfully uninstalled buff-extensions-2.0.0
Successfully uninstalled buff-ignore-1.2.0
Successfully uninstalled buff-ruby_engine-1.0.0
Successfully uninstalled buff-shell_out-1.1.0
Successfully uninstalled celluloid-0.16.0
Successfully uninstalled celluloid-io-0.16.2
Successfully uninstalled chef-config-15.7.32
Successfully uninstalled chef-utils-15.7.32
Successfully uninstalled faraday-0.17.3
Successfully uninstalled fuzzyurl-0.9.0
Successfully uninstalled hashie-2.1.2
Successfully uninstalled hitimes-2.0.0
Successfully uninstalled libyajl2-1.2.0
Successfully uninstalled mixlib-authentication-3.0.6
Successfully uninstalled mixlib-config-3.0.6
Successfully uninstalled mixlib-shellout-3.0.9-universal-mingw32
Successfully uninstalled multipart-post-2.1.1
Successfully uninstalled nio4r-2.5.2
Successfully uninstalled public_suffix-4.0.3
Removing rackup
Successfully uninstalled rack-2.1.2
Successfully uninstalled retryable-2.0.4
Successfully uninstalled ridley-5.1.1
Successfully uninstalled semverse-2.0.0
Successfully uninstalled timers-4.0.4
Successfully uninstalled tomlrb-1.2.9
Successfully uninstalled varia_model-0.6.0
Successfully uninstalled win32-process-0.8.3
Successfully uninstalled wmi-lite-1.0.5
Installed the plugin 'vagrant-omnibus (1.5.0)'!

C:\WINDOWS\system32>

今回は、ここまで。

次回は、Chefを準備していきたいと思います。

コメント

タイトルとURLをコピーしました