[[FrontPage]]


** インストール [#jc9e6847]
MacだとbrewでVirtualBoxとともに入れるのがイイかな
-[[Homebrew CaskでVagrantの環境構築メモ - Qiita>http://qiita.com/moomooya/items/30f9ffdb7dd34caf9ec0]]


** Boxのダウンロード、一覧、削除 [#kbe36769]
http://www.vagrantbox.es/ からboxを探して

 $ vagrant box add  https://atlas.hashicorp.com/envimation/boxes/ubuntu-xenial
 ==> box: Loading metadata for box 'https://atlas.hashicorp.com/envimation/boxes/ubuntu-xenial'
 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) virtualbox
 2) vmware_desktop
 
 Enter your choice: 1
 ==> box: Adding box 'envimation/ubuntu-xenial' (v1.0.3-1498871542) for provider: virtualbox
     box: Downloading: https://app.vagrantup.com/envimation/boxes/ubuntu-xenial/versions/1.0.3-1498871542/providers/virtualbox.box
 ==> box: Successfully added box 'envimation/ubuntu-xenial' (v1.0.3-1498871542) for 'virtualbox'!
 $
でダウンロード完了

一覧表示
 $ vagrant box list
 envimation/ubuntu-xenial (virtualbox, 1.0.3-1498871542)
 $

削除
 $ vagrant box remove envimation/ubuntu-xenial
で削除。ちなみにイメージは、
 $ ls -lrt ~/.vagrant.d/boxes/
 total 0
 drwxr-xr-x  4 masatomix  staff  136  7  1 11:59 envimation-VAGRANTSLASH-ubuntu-xenial
 $
ココ。


**試しにUbuntuをインストール [#ifff3d55]

 $ mkdir ubuntu && cd $_
 /Users/masatomix/Desktop/ubuntu

 $ vagrant init envimation/ubuntu-xenial
 A `Vagrantfile` has been placed in this directory. You are now
 ready to `vagrant up` your first virtual environment! Please read
 the comments in the Vagrantfile as well as documentation on
 `vagrantup.com` for more information on using Vagrant.

 $ ls -lrt Vagrantfile
 -rw-r--r--  1 masatomix  staff  3031  7  1 12:04 Vagrantfile

起動
 $ vagrant up
 Bringing machine 'default' up with 'virtualbox' provider...
 ==> default: Importing base box 'envimation/ubuntu-xenial'...
 ==> default: Matching MAC address for NAT networking...
 ==> default: Checking if box 'envimation/ubuntu-xenial' is up to date...
 ==> default: Setting the name of the VM: ubuntu_default_1498878490997_69625
 ==> default: Clearing any previously set network interfaces...
 ==> default: Preparing network interfaces based on configuration...
     default: Adapter 1: nat
 ==> default: Forwarding ports...
     default: 22 (guest) => 2222 (host) (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: Remote connection disconnect. Retrying...
     default:
     default: Vagrant insecure key detected. Vagrant will automatically replace
     default: this with a newly generated keypair for better security.
     default:
     default: Inserting generated public key within guest...
     default: Removing insecure key from the guest if it's present...
     default: Key inserted! Disconnecting and reconnecting using new SSH key...
 ==> default: Machine booted and ready!
 ==> default: Checking for guest additions in VM...
 ==> default: Mounting shared folders...
     default: /vagrant => /Users/masatomix/Desktop/ubuntu
 $


ステータス
 $ vagrant status
 Current machine states:
 
 default                   running (virtualbox)
 
一時停止
 $ vagrant suspend
 $ vagrant status
 Current machine states:
 
 default                   saved (virtualbox)

 $ vagrant resume
 $ vagrant status
 Current machine states:
 
 default                   running (virtualbox)
 

停止
 $ vagrant halt
 $ vagrant status
 Current machine states:
 
 default                   poweroff (virtualbox)
 
 $


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS