Last Updated: February 25, 2016
·
2.713K
· moutons

vagrant-cachier is boss

Right now the plugin only works with the VirtualBox provider, vagrant-lxc, and the official HashiCorp VMware providers (although there is a bug).

However, as akalyaev noted, NFS speeds the heck out of your Vagrant operations, and vagrant-cachier makes setting up NFS shares for your machines' package manager caches simpler. Simply install the plugin:

vagrant plugin install vagrant-cachier    

Then, insert the relevant configuration line into your Vagrantfile:

Vagrant.configure("2") do |config|
  config.vm.box = 'your-box'
  config.cache.auto_detect = true
  # If your Vagrantfile provisions multiple VMs, use the following line instead of auto_detect to prevent collisions:
  #config.cache.scope = :machine
  # If you are using VirtualBox, you might want to enable NFS for shared folders
  # config.cache.enable_nfs  = true
end

The following package managers are managed by vagrant-cachier: APT, Yum, Pacman, Chef, RubyGems, RVM, npm, Composer, and APT-CACHER.

Enjoy!

1 Response
Add your response

Additionally, it is possible to cache omnibus chef package. Just add
~/.vagrant.d/Vagrantfile:

if (defined? VagrantPlugins::Cachier && defined? VagrantPlugins::Omnibus)
  ENV['OMNIBUS_INSTALL_URL']="https://gist.github.com/hectcastro/6443633/raw/install.sh"
  puts "setting custom OMNIBUS_INSTALL_URL for vagrant-cachier: #{ENV['OMNIBUS_INSTALL_URL']}"
end
over 1 year ago ·