Kiee
Kiee

Reputation: 10771

Vagrant, only download packages once instead of for every project in linux

I'm a complete Linux novice trying to convert from good ole windows(mmm..) so go easy my hearts in the right place!

I'm using vagrant to create a Ubuntu environment

My host folder structure is currently

- root
-- VagrantFile
-- .vagrant [folder]
-- public [folder]
--- Project1 [folder]
--- Project2 [folder] and so on

Following below is my basic vagrant config.

Vagrant.configure("2") do |c|
  c.vm.box = "precise32"
  c.vm.box_url = "http://files.vagrantup.com/precise32.box"
  c.vm.network = :private_network, ip:"192.168.33.10"
  c.vm.synced_folder "./public", "/var/www/"
end

How would I go about installing packages such as composer,laravel,npm,nodejs,gulp etc in a way that means I wouldnt have to download them again and can install in each project as required.

I want them to be retained on the host in say a "packages" directory but accessible from within the VM's cli meaning if I destroy the VM I can vagrant up another VM and have all the packages ready to use without redownloading.

If that made sense and is possible, can someone advise a method of achieving this?

Upvotes: 2

Views: 84

Answers (1)

Mitchell
Mitchell

Reputation: 33049

Take a look at this plugin, which handles this for you: https://github.com/fgrehm/vagrant-cachier

Upvotes: 1

Related Questions