VAIO で Vagrant を使う

この内容は古いです。Vagrant 1.6.x を書きました。

結論

BIOS で VT-x を有効にする。

半年前にハマったのに、また忘れていたので今後のためにメモ。

環境

BIOS の設定

SVZ1311AJ は何故か VT-x の設定が Disabled になっている。

  • 起動時に F2 を押して BIOS を立ち上げる
  • Advanced タブの Intel(R) Virtualization Technology を Disable から Enabled に変更
  • 保存して起動

そうしないと VirtualBox

VT-x features locked for or unavailable in MSR. (VERR_VMX_MSR_LOCKED_OR_DISABLED)

のエラーを出す。

Vagrant のインストール

VagrantVirtualBoxインストーラで一発。

ネットワークの設定

Vagrantfile に下記を追加しておく。

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
#config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.network :forwarded_port, guest: 3000, host: 8080

これで FreeBSD 側で :3000 で立ち上がったサーバが、ホスト側で http://localhost:8080/ で見られる。

もし Vagrant が起動済みなら設定の再読み込みを忘れずに。

$ vagrant reload

FreeBSD のインストール

http://www.vagrantbox.es/ を見ると「FreeBSD 9.2 x86_64 Minimal (VirtualBox, ZFS)」があるので使わせてもらう。

$ mkdir freebsd9
$ cd freebsd9
$ vagrant init freebsd9 https://wunki.org/files/freebsd-9.2-amd64-wunki.box
$ vagrant up
$ vagrant ssh

環境設定

あとは開発環境を設定。