LoginSignup
10
10

More than 5 years have passed since last update.

Windowsでのvagrant環境構築

Last updated at Posted at 2014-03-08

Windowsでvagrant環境を作るためのメモ。

インストール

Oracle VM VirtualBox

Download VirtualBoxよりダウンロードしてインストールしてください。

vagrant

Windowsの場合msi形式で配布されています。
DOWNLOAD VAGRANTよりダウンロードしてインストールしてください。
デフォルトだとvagrantのboxが~/.vagrant.dに作成されます。
別のディレクトリに変更したい場合は$VAGRANT_HOME = /home/hoge/vagrantにように.bashrcへ追記してください。

boxの追加

インストール完了後は、boxがインストールされていないので追加する必要があります。
* vagrantbox.es
* Vagrant Base Box Downloads

にお好みのboxを見つけたら以下のコマンドでboxを追加してください。
容量が大きいので時間はちょっとかかります。

vagrant box add centos65 http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.5-x86_64-v20140110.box

boxの起動

vagrant initでVagrantfileを生成します。
Vagrantfileのconfig.vm.box="base"vagrant box listで出てくるものに書き換えます。
その後vagrant upと叩けばboxが起動します。

boxの利用

vagrant sshコマンドでboxのシェルを叩くことができるようになります。
Windowsでmintty環境だと以下のメッセージが出て端末がうまく表示されません。
Pseudo-terminal will not be allocated because stdin is not a terminal.

その場合は
vagrant ssh-config >> ~/.ssh/configでsshの設定を行い
ssh defaultでboxに接続できます。

10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10