2013年6月29日土曜日

Vagrant on CentOS

以前から気になっていたVagrantをCentOS 6.4 (64bit)にインストールしました。

VagrantVirtualBoxともに2013/6/29現在の最新版の次のRPMを使用しました。
  • VirtualBox-4.2-4.2.14_86644_el6-1.x86_64.rpm
  • vagrant_1.2.2_x86_64.rpm
Vagrant、VirtualBoxともにRPMで提供されているので、インストールは特に問題なく終了。

早速Vagrantを使ってみます。
まずは、Getting Startedの記述に沿って、開発元が提供しているイメージを使用して仮想マシンを作ってみることにします。

プロジェクト用のディレクトリ作成と初期化
$ mkdir vagrant_getting_started
$ cd vagrant_getting_started
$ vagrant init
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.
$
BOXのインストール
BOXとは、仮想マシンの雛形のようなもの(?)のようです。
一度設定すると再利用できるようです。
$ vagrant box add precise32 http://files.vagrantup.com/precise32.box
Downloading or copying the box...
Extracting box...te: 1161k/s, Estimated time remaining: 0:00:01)
Successfully added box 'precise32' with provider 'virtualbox'!
$
どうも、~/.vagrant.d配下に色々置かれるようです。
Vagrantfileのconfig.vm.box = "base"の記述を次のように編集します。
]$ diff -uw Vagrantfile.original Vagrantfile
--- Vagrantfile.original        2013-06-29 12:07:25.388634683 +0900
+++ Vagrantfile 2013-06-29 12:31:21.501632951 +0900
@@ -7,7 +7,7 @@
   # please see the online documentation at vagrantup.com.

   # Every Vagrant virtual environment requires a box to build off of.
-  config.vm.box = "base"
+  config.vm.box = "precise32"

   # The url from where the 'config.vm.box' box will be fetched if it
   # doesn't already exist on the user's system.
ここまでで、下準備はおしまいです。
いよいよ、仮想マシンをブートさせます。
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
[default] Importing base box 'precise32'...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["import", "/home/hide/.vagrant.d/boxes/precise32/virtualbox/box.ovf"]

Stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Interpreting /home/hide/.vagrant.d/boxes/precise32/virtualbox/box.ovf...
OK.
0%...
Progress object failure: NS_ERROR_CALL_FAILED
うーん、失敗したようです。
少し調べる必要がありそうです。

0 件のコメント:

コメントを投稿