Vagrantのインストール方法は?

Vagrantのインストール

環境


開発環境 

Vagrantのbox:CentOS 7 x64 (Minimal, Shrinked, Guest Additions 4.3.26)

ホストマシン

Windows 7 Home PremiumVagrant 1.7.2 ・VirtualBox 4.3.26-98988

ゲストマシン  

CentOS 7


Vagrantのboxの選択


VagrantのBOXを選択する必要がある。 CENTOSのboxを選択するには、Serachで「CENTOS」と入力する。 BOXにしたいバージョンを選択する。  

(URLはこちら) http://www.vagrantbox.es/

(参照)

検索結果から目的のboxにある"コピー"をクリックする。 ここでコピーしたURL文字列をVagrantのbox addコマンドで用いる。


Vagrantのboxから仮想マシンを生成


コマンドプロンプトにて下記を実行

vagrant box add https://atlas.hashicorp.com/viniciusfs/boxes/centos7/

==> box: Loading metadata for box 'https://atlas.hashicorp.com/viniciusfs/boxes/ centos7/' This box can work with multiple providers! The providers that it can work with are listed below. Please review the list and choose the provider you will be working with.  

1) libvirt

2) virtualbox

3) vmware2

Enter your choice: 2 ==> box: Adding box 'viniciusfs/centos7' (v1.0.1) for provider: virtualbox box: Downloading: https://vagrantcloud.com/viniciusfs/boxes/centos7/versions /1.0.1/providers/virtualbox.box box: Progress: 69% (Rate: 1968k/s, Estimated time remaining: 0:01:43)

Vagrantのバージョン確認

vagrant -v

Vagrant 2.0.1

追加されたboxを確認する

vagrant box list

viniciusfs/centos7 (virtualbox, 1.0.1)


仮想マシンの起動


コマンドプロンプトで以下のとおり実行する。

vagrant up


注意事項


・Vagrant2.01ではPowrShellが2系から5系にバージョンアップする必要がある。 ・立ち上がらない場合は、Vagrantfileを変更する必要がある。