habdwg
Last Updated: February 25, 2016
·
2.812K
· mlafeldt
2190d7a468f51fa3be5eabfc9397a28b

Speed up package download in Vagrant boxes

Inside Vagrant boxes like http://files.vagrantup.com/lucid64.box, apt is configured to fetch Debian packages from US servers, e.g. us.archive.ubuntu.com.

For people outside the US, here's a one-liner you can add to your Vagrantfile that will speed up the package installation process (put it in front of other provisioners):

config.vm.provision :shell, :inline => "sed -i 's/us.archive/de.archive/g' /etc/apt/sources.list"

This patches apt's sources.list file so that all packages will subsequently be downloaded from German servers, i.e. de.archive.ubuntu.com. Feel free to adapt it to your location.

Say Thanks
Respond

1 Response
Add your response

18156
None

Also you should add:
config.vm.provision "shell", inline: "apt-get update -y"
to update sources cache.

over 1 year ago ·
Filed Under