[Vagrant & VirtualBox] Vagrant box の outdated チェックと update 手順

memo.

% vagrant -v
Vagrant 1.8.4

Contents

vagrant box list

local にある vagrant box をリストアップ。

% 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 をチェック。

% 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 などを削除する。

% vagrant box remove centos64

vagrant box update

ubuntu/trusty64 に最新版が存在する。

% 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 をアップデートする。

% 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'!

完了。

% 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 だけを行う場合。

% 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'!

補遺