modern.ieからWindowsのVagrant用ボックスを使ってみる。

 Vagrantのボックスをもらったときどうするんだっけ? とあんなに毎日使っていたのに、今や全て白紙でまっさらな状態になってました。


 今回WindowsをゲストOSとしていので、まずはmodern.ieから"IE10 - Win7.box"というのを持ってきます。話はそれからです。

> vagrant box add win7_ie10 "IE10 - Win7.box"
(いろいろ出てくる)

> vagrant box list
bento/centos-6.7 (virtualbox, 2.2.3)
win7_ie10        (virtualbox, 0)

> mkdir win7_ie10
> cd win7_ie10
> vagrant init win7_ie10
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.


 ここでVagrantfileを開く。なぜかというと複数のvagrantゲストOSを起動したいので、sshのポート2222を2200とかにしたいから。Vimなどで、「config.vm.network "forwarded_port", id: "ssh", guest: 22, host: 2200」という一行を追加する。さて、起動しよう。

> vagrant up


 めちゃくちゃ待たせられるが、ちゃんと起動してくれます。その後は

  1. Guest Addition CDをインストール
  2. IEを開いてネットにつながってない場合は、"Internet Option"−"Connections"-「LAN Settings」を開き「Automatically detect settings」のチェックを外すと繋がる時がある。
  3. メモリを4Gくらいにして再起動(もしくは、VagrantfileでguiをONにしてとmemoryサイズを変更しても良い)


これでJavaでもScalaでも入れてお試し環境を作れます。