$ vagrant box add chef/centos-6.6
==> box: Loading metadata for box 'chef/centos-6.6'
box: URL: https://vagrantcloud.com/chef/centos-6.6
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 'chef/centos-6.6' (v1.0.0) for provider: virtualbox
box: Downloading: https://vagrantcloud.com/chef/boxes/centos-6.6/versions/1.0.0/providers/virtualbox.box
==> box: Successfully added box 'chef/centos-6.6' (v1.0.0) for 'virtualbox'!
Vagrantfile の作成
vagrant init コマンドを利用して、Vagrantfile を作成
12345
$ vagrant init chef/centos-6.6
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.
作成される Vagrantfile ( コメントアウト行は削除 )
123456789
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/centos-6.6"
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/centos-6.6"
config.vm.synced_folder ".", "/vagrant", disabled: true
end
任意で追加
Docker 環境セットアップ
123
config.vm.provision "docker" do |d|
d.version = 'latest'
end
chef 環境セットアップ
1
config.omnibus.chef_version = :latest
Vagrant Box の起動
vagrant up コマンドで起動
Vagrant Box のパッケージ化
vagrant package コマンドを利用して Box のパッケージを作成
1234567
$ vagrant package --output centos-6.6.box
WARNING: Could not load IOV methods. Check your GSSAPI C library for an update
WARNING: Could not load AEAD methods. Check your GSSAPI C library for an update
==> default: Attempting graceful shutdown of VM...
==> default: Clearing any previously set forwarded ports...
==> default: Exporting VM...
==> default: Compressing package to: /private/tmp/centos-6.6.box
S3 へのアップロード
S3 の任意の場所に作成したパッケージファイル ( e.g. centos-6.6.box ) をアップロード。
==> default: Mounting shared folders...
default: /vagrant => /private/tmp
Vagrant::Errors::LinuxMountFailed: Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
The error output from the last command was:
/sbin/mount.vboxsf: mounting failed with the error: No such device