Windows 7でVagrant + Sahara

今更感はあるけれど、Windows 7のノートPCにVagrantをセットアップしてみた。

(1)VirtualBoxをインストールする。
https://www.virtualbox.org/wiki/DownloadsからVirtualBox 4.2.18 for Windows hostsをダウンロードしインストール。


(2)Vagrantをインストールする。
http://downloads.vagrantup.com/からVagrant_1.3.4.msiをダウンロードしインストール。


(3)CentOSをインストールしたVagrantBoxを作成する。
> vagrant box add centos https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box
> vagrant init centos
> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period. This can
mean a number of things.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

怒られました。

Windows7にVirtualBoxとVagrantをインストールしたメモ
仮想化支援機能(VT-x/AMD-V)を有効化できません
を参考にしたところ、64bitのイメージを入れようとしているのに、仮想化支援機能(VT-x/AMD-V)が有効になっていなくてエラーで止まっているようだ。

BIOSで「Intel(R) Virtualization Technology」と「Intel(R) VT-d Feature」をEnabledにしてもう一度。
> vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] The guest additions on this VM do not match the installed version of
VirtualBox! In most cases this is fine, but in rare cases it can
cause things such as shared folders to not work properly. If you see
shared folder errors, please update the guest additions within the
virtual machine and reload your VM.

Guest Additions Version: 4.1.18
VirtualBox Version: 4.2
[default] Mounting shared folders...
[default] -- /vagrant

OK。


(4)起動したVagrantBoxに接続してみる。
> vagrant ssh
`ssh` executable not found in any directories in the %PATH% variable. Is an
SSH client installed? Try installing Cygwin, MinGW or Git, all of which
contain an SSH client. Or use the PuTTY SSH client with the following
authentication information shown below:

Host: 127.0.0.1
Port: 2222
Username: vagrant
Private key: C:/Users/ユーザー/.vagrant.d/insecure_private_key

怒られました。なので上記の通りの情報でTeraTermから接続→OK。


(5)Saharaプラグインをインストールする。
> vagrant plugin install sahara
Installing the 'sahara' plugin. This can take a few minutes...
Installed the plugin 'sahara (0.0.15)'!


(6)Saharaプラグインを使ってみる。
# sandboxモードをON。
> vagrant sandbox on

# sandboxモードONにしたタイミングまでRollback。
> vagrant sandbox rollback

# sandboxモードONにしたタイミングからここまでの変更をcommit。
> vagrant sandbox commit



(7)感想
Saharaとかchef-soloとかと組み合わせることで開発環境をサクサク作れるようにしておく、というのはとても便利ですね。チーム開発で環境を横並びに揃えておくにも便利だし、イメージ展開と違って常に新しいバージョンを使えるのもメリットだと思いました。

このブログの人気の投稿

転職のお知らせ

40代の減量戦略 〜体重-14kg、体脂肪率-12%を実現した具体的な方法〜

45歳になりました