明日の鯖祭りのために
Vagrant SetUp Tips
Vagrantの悩みどころがいくつか解決したので、メモ
prerequisite
quick start
$ vagrant box add {title} {url} $ vagrant init {title} $ vagrant up
cd /d D:\vagrant\ubuntu14amd64
1 Boxの追加
vagrant box add {title} {url}
ex)
vagrant box add ubuntu14amd64 https://cloud-images.ubun tu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box
2 仮想マシンの設定ファイルを作成する
vagrant init {title}
ex)
vagrant init ubuntu14amd64
3 仮想マシンの起動
vagrant up
4 仮想マシンへの接続
- デフォルトでローカルループバックのアドレスを参照するので、下記の設定でsshクライアントでアクセスする
IP addr | port | user | pwd |
---|---|---|---|
127.0.0.1 | 2222 | vagrant | vagrant |
5 仮想マシンの一時停止
vagrant suspend
6 仮想マシンのネットワーク設定
- default
# Create a private network, which allows host-only access to the machine # using a specific IP. # config.vm.network "private_network", ip: "192.168.33.10"
- new
# Create a private network, which allows host-only access to the machine # using a specific IP. config.vm.network "private_network", ip: "192.168.33.10"
7 設定の変更を反映
vagrant reload
- 通信の確認
ping 192.168.33.10
仮想マシンの起動
vagrant up
- IPの接続に問題がない場合
IP addr | port | user | pwd |
---|---|---|---|
192.168.33.10 | 22 | vagrant | vagrant |