26

There are multiple virtual machines running Ubuntu and they are all updated by the following command:

apt-get update
apt-get upgrade

But updating each VM separately takes a lot of time to download the required packages and also uses massive amount of bandwidth (which I'm running out of). Is it possible to transfer the updated files by apt-get directly into VMs?

I know the packages are stored in /var/cache/apt/archives but I need the apt-get database files (list of mirrors, indexes, available packages on mirrors, ...)


Update: There are many solutions

  1. apt-cacher-ng as mentioned in the answers.
  2. Docker images built for caching apt files (they run squid actually)
  3. Simply using squid

Also, as mentioned in the answers, see Best way to cache apt downloads on a LAN?

15

Not an explicit answer to your question, but have you considered setting up an apt proxy? I use apt-cacher-ng (apt-get install apt-cacher-ng :D). Prehaps set this up on the VM host, and tell the VMs (and the host) to use this as their proxy (as simple as adding a file (eg 02proxy) to /etc/apt/apt.conf.d/ containing

Acquire::http { Proxy "http://vm host ip:3142"; };

That way you can just do apt-get upgrade without having to manually copy file around. When one computer downloads the debs they will be stored on the proxy for the next computer that requests it. Can handle multiple releases and different architectures, etc

Just a though :D

  • 1
    You can even install squid-deb-proxy on the proxy server and squid-deb-proxy-client on others; this will make the proxy detection work transparently (using Avahi), no client-side configuration required. As a bonus, if the proxy server is not found on the local network, the client will connect to the repositories directly (making this suitable even for laptops). – Piskvor May 23 '13 at 13:55
  • I second the use of Squid-deb-proxy over Apt-cacher. Relevant Q: Best way to cache apt downloads on a LAN? – gertvdijk May 23 '13 at 14:13
36

The .deb-files you have allready downloaded are stored in /var/cache/apt/archives/.

  • Oooh, beat me by 26 seconds :) – Naftuli Kay Mar 27 '12 at 23:33
  • 6
    That's why I have twice as much reputation ;-P – turbo Mar 27 '12 at 23:34
  • 1
    Oooooohhhh, burrrrn. :) – Naftuli Kay Mar 28 '12 at 1:54
14

/var/cache/apt/archives is where they should be stored.

0

You can backup all the *.deb, then copy it into vmware, you can copy it in /root/sw_backup. The folder can not be /var/cache/apt/archives/.

Then you can locally install it with synaptic. $synaptic "file" menu to find local install. but it also needs network, just need to update a little package.

  • Please note this should be .deb not .dep – Malfist Sep 5 '14 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.