ソフトウェアエンジニアの日常の雑記

日々思ったことをまとめます

vagrantメモ

いまさらvagrantのメモ

ビルド環境を作るためにvagrantを使う。
ubuntu64-14.04-で構築する。

vagrantはboxをまず作成する必要があるので、作成する。

$ vagrant box add centos64-build https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box

==> box: Adding box 'centos64-build' (v0) for provider:
box: Downloading: https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box
==> box: Successfully added box 'centos64-build' (v0) for 'virtualbox'!

  • boxのリストを表示する

$ vagrant box list
centos64-build (virtualbox, 0)

先ほど作ったものがリストとして表示される

$ vagrant status
default not created (virtualbox)

$ vagrant up
Bringing machine 'centos64' up with 'virtualbox' provider...
==> centos64: Clearing any previously set forwarded ports...
==> centos64: Fixed port collision for 22 => 2222. Now on port 2200.
==> centos64: Clearing any previously set network interfaces...
==> centos64: Preparing network interfaces based on configuration...
centos64: Adapter 1: nat
==> centos64: Forwarding ports...
centos64: 22 => 2200 (adapter 1)
==> centos64: Booting VM...
==> centos64: Waiting for machine to boot. This may take a few minutes...
centos64: SSH address: 127.0.0.1:2200
centos64: SSH username: vagrant
centos64: SSH auth method: private key
centos64: Warning: Connection timeout. Retrying...
==> centos64: Machine booted and ready!
==> centos64: Checking for guest additions in VM...
==> centos64: Mounting shared folders...
centos64: /vagrant => /home/username/vagrant
==> centos64: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> centos64: to force provisioning. Provisioners marked to run always will still run.

これで起動した。

$ vagrant status
centos64 running (virtualbox)

これで起動確認完了

$ vagrant ssh centos64

これで接続完了