Vagrant Cloudを使って、仮想マシンを構築する
各種バージョン
$ vboxmanage --version 4.3.14r95030 $ vagrant -v Vagrant 1.6.3
今回、作りたい仮想環境はUbuntu14.04。
Vagrantcloudに登録する
ログイン後、「Discover」から、好きなボックスを選ぶ
今回はUbuntu14.04を選んだ。
Vagrantfileを修正する。
$ grep 'ubuntu' Vagrantfile config.vm.box = "chef/ubuntu14-04"
もしくはvagrant initコマンドで生成する。
vagrant init chef/ubuntu14-04
vagrant loginで認証を通す。
$ vagrant login In a moment we'll ask for your username and password to Vagrant Cloud. After authenticating, we will store an access token locally. Your login details will be transmitted over a secure connection, and are never stored on disk locally. If you don't have a Vagrant Cloud account, sign up at vagrantcloud.com Username or Email: ************@yahoo.co.jp Password (will be hidden): You're now logged in!
vagrant up
$ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Box 'chef/ubuntu-14.04' could not be found. Attempting to find and install... default: Box Provider: virtualbox default: Box Version: >= 0 ==> default: Loading metadata for box 'chef/ubuntu-14.04' default: URL: https://vagrantcloud.com/chef/ubuntu-14.04 ==> default: Adding box 'chef/ubuntu-14.04' (v1.0.0) for provider: virtualbox default: Downloading: https://vagrantcloud.com/chef/ubuntu-14.04/version/1/provider/virtualbox.box ==> default: Successfully added box 'chef/ubuntu-14.04' (v1.0.0) for 'virtualbox'! ==> default: Importing base box 'chef/ubuntu-14.04'... ==> default: Matching MAC address for NAT networking... ==> default: Checking if box 'chef/ubuntu-14.04' is up to date... ==> default: Setting the name of the VM: test_ansible_default_1409574603037_91131 ==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration... default: Adapter 1: nat default: Adapter 2: hostonly ==> default: Forwarding ports... default: 22 => 2222 (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2222 default: SSH username: vagrant default: SSH auth method: private key default: Warning: Connection timeout. Retrying... ==> default: Machine booted and ready! ==> default: Checking for guest additions in VM... ==> default: Configuring and enabling network interfaces... ==> default: Mounting shared folders... default: /vagrant => /Users/togattti/test_ansible
sshして確認する
$ vagrant ssh Welcome to Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64) * Documentation: https://help.ubuntu.com/ Last login: Sat Apr 19 05:27:17 2014 from 10.0.2.2 vagrant@vagrant:~$
githubに挙げておけば、cloneして、vagrant login、vagrant upの3ステップで済む。
kentatogashi/ubuntu-vagrant-cloud · GitHub
参考