joao cenoura
joao cenoura

Reputation: 1225

Vagrant - cache RPM's for faster provision

Currently have a Vagrant setup with a CentOS box with a shell provision script that installs few RPM's (via yum install). I'm constantly doing vagrant destroy -f && vagrant up, thus downloading those RPM's every time.

What's the best way to cache the downloaded RPM's and avoid downloading them on each iteration?

Upvotes: 0

Views: 532

Answers (1)

joao cenoura
joao cenoura

Reputation: 1225

Moving the cachedir to the shared folder /vagrant seems to work fine.

To change it, provision a /etc/yum.conf with the following edit:

cachedir=/vagrant/tmp/yum/$basearch/$releasever
keepcache=1

Now your cache is preserved outside the VM.

Upvotes: 3

Related Questions