[Vagrant & VirtualBox] Vagrant box の outdated チェックと update 手順
memo.
[markdown]
“`prettyprinted
% vagrant -v
Vagrant 1.8.4
“`
> * [vagrant box – Command-Line Interface – Vagrant by HashiCorp](https://www.vagrantup.com/docs/cli/box.html)
## vagrant box list
local にある vagrant box をリストアップ。
“`prettyprinted
% vagrant box list
centos64 (virtualbox, 0)
chef/centos-6.5 (virtualbox, 1.0.0)
chef/centos-6.5-i386 (virtualbox, 1.0.0)
miya0001/vccw (virtualbox, 2.19.0)
precise64 (virtualbox, 0)
ubuntu/trusty64 (virtualbox, 20160323.0.0)
vccw (virtualbox, 0)
“`
## vagrant box outdated
バージョンアップしている box をチェック。
“`prettyprinted
% vagrant box outdated –global
* ‘vccw’ wasn’t added from a catalog, no version information
* ‘ubuntu/trusty64’ is outdated! Current: 20160323.0.0. Latest: 20160621.0.0
* ‘precise64’ wasn’t added from a catalog, no version information
* ‘miya0001/vccw’ (v2.19.0) is up to date
* ‘chef/centos-6.5-i386’: Error loading metadata: The requested URL returned error: 404 Not Found
* ‘chef/centos-6.5’: Error loading metadata: The requested URL returned error: 404 Not Found
* ‘centos64’ wasn’t added from a catalog, no version information
“`
## vagrant box remove
version information がない box などを削除する。
“`prettyprinted
% vagrant box remove centos64
“`
## vagrant box update
ubuntu/trusty64 に最新版が存在する。
“`prettyprinted
% vagrant box outdated –global
* ‘ubuntu/trusty64’ is outdated! Current: 20160323.0.0. Latest: 20160621.0.0
* ‘miya0001/vccw’ (v2.19.0) is up to date
“`
box をアップデートする。
“`prettyprinted
% vagrant box update –box ubuntu/trusty64
Checking for updates to ‘ubuntu/trusty64’
Latest installed version: 20160323.0.0
Version constraints: > 20160323.0.0
Provider: virtualbox
Updating ‘ubuntu/trusty64’ with provider ‘virtualbox’ from version
‘20160323.0.0’ to ‘20160621.0.0’…
Loading metadata for box ‘https://atlas.hashicorp.com/ubuntu/trusty64’
Adding box ‘ubuntu/trusty64’ (v20160621.0.0) for provider: virtualbox
Downloading: https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/20160621.0.0/providers/virtualbox.box
Successfully added box ‘ubuntu/trusty64’ (v20160621.0.0) for ‘virtualbox’!
“`
完了。
“`prettyprinted
% vagrant box outdated –global
* ‘ubuntu/trusty64’ (v20160621.0.0) is up to date
* ‘miya0001/vccw’ (v2.19.0) is up to date
“`
## vagrant box add
ちなみに init ではなく box add だけを行う場合。
“`prettyprinted
% vagrant box add bento/centos-6.7
==> box: Loading metadata for box ‘bento/centos-6.7’
box: URL: https://atlas.hashicorp.com/bento/centos-6.7
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) parallels
2) virtualbox
3) vmware_desktop
Enter your choice: 2
==> box: Adding box ‘bento/centos-6.7’ (v2.2.7) for provider: virtualbox
box: Downloading: https://atlas.hashicorp.com/bento/boxes/centos-6.7/versions/2.2.7/providers/virtualbox.box
==> box: Successfully added box ‘bento/centos-6.7’ (v2.2.7) for ‘virtualbox’!
“`
## 補遺
> * [Vagrant + Virtualboxの仮想マシンファイルの置き場所を調べてみた – Qiita](http://qiita.com/DQNEO/items/65861ee8b70a203f76d6)
> * [「Vagrantの裏方では何が作られているのか?」 – StupidDog’s blog](http://stupiddog.hatenablog.com/entry/2014/02/19/134203)
[/markdown]