タイトルの通り。
たかがインストールして使える状態にするまでだけで苦労したからだよ!
インストールした後はVagrantの使い方はこのあたり見たらいいわけですよ。
Vagrant超入門:Vagrant初心者向けの解説だよ!
https://github.com/tmknom/study-vagrant
インストール
手順はここ http://docs.vagrantup.com/v2/getting-started/index.html 参照。
http://www.vagrantup.com/ からインストーラをダウンロードしてとっととインストール
2014/6/7現在、ヴァージョンは1.6.3。
初期設定
コマンドプロンプトを起動してinit。
C:\Users\nobwak>vagrant init hashicorp/precise32
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.
C:\Users\nobwak>
そして起動…だが。
C:\Users\nobwak>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'hashicorp/precise32' could not be found. Attempting to find an
d install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'hashicorp/precise32'
default: URL: https://vagrantcloud.com/hashicorp/precise32
==> default: Adding box 'hashicorp/precise32' (v1.0.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/hashicorp/precise32/version/1
/provider/virtualbox.box
default: Progress: 39% (Rate: 4070k/s, Estimated time remaining: 0:01:01)
The executable 'bsdtar' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.
bsdtarがpathに入ってないとか文句を言うわけですよ。
解決法..再インストール
なんと解決法は再インストールだそうです。
嘘だろと思ったら本当に解決した。
C:\Users\nobwak>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'hashicorp/precise32' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'hashicorp/precise32'
default: URL: https://vagrantcloud.com/hashicorp/precise32
==> default: Adding box 'hashicorp/precise32' (v1.0.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/hashicorp/precise32/version/1
/provider/virtualbox.box
default: Progress: 100% (Rate: 3345k/s, Estimated time remaining: --:--:--)
==> default: Successfully added box 'hashicorp/precise32' (v1.0.0) for 'virtualbox'!
==> default: Importing base box 'hashicorp/precise32'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'hashicorp/precise32' is up to date...
==> default: Setting the name of the VM: nobwak_default_1402067362695_84951
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.2.0
default: VirtualBox Version: 4.3
==> default: Mounting shared folders...
default: /vagrant => C:/Users/nobwak
C:\Users\nobwak>
このとき、Virtualboxに勝手に登録される。
img
さっそく繋いでみよう。
ssh接続…ダメ。
vagrant sshで動かしたマシンにログインできるはずだが。
C:\Users\nobwak>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 your favorite SSH client with the following
authentication information shown below:
Host: 127.0.0.1
Port: 2222
Username: vagrant
Private key: C:/Users/nobwak/.vagrant.d/insecure_private_key
C:\Users\nobwak>
sshがないからダメ。
だから適当なsshクライアントで繋ぐ。
上記のメッセージの通り、IPアドレスは127.0.0.1, ポートは2222。
login as: vagrant
vagrant@127.0.0.1's password:
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686)
* Documentation: https://help.ubuntu.com/
Welcome to your Vagrant-built virtual machine.
Last login: Fri Sep 14 06:22:31 2012 from 10.0.2.2
vagrant@precise32:~$
繋げましたな。
あとは消して終了。
C:\Users\nobwak>vagrant destroy
default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
C:\Users\nobwak>