11

To save bandwidth and data on my Internet plan, I have installed squid-deb-proxy on a desktop, and the client on it and a few other machines I've got. However, based on the post that put me onto this , it sounds like if I take my laptop* to a different network and update it there, the downloaded updates will NOT be automatically copied back to the squid-deb-proxy server when I get back on my network.

Assuming that this is correct (I will be testing later), is there a way I can stick these packages into the cache so I don't have to download them one more time for other machines in the network?


* As noted in the comments, I could simply make the laptop the proxy server, but in my specific case, the laptop is actually 1) a VM that is not running all the time, 2) in a laptop that is not open all the time. As such, that solution, while a good one, does not work in my case.

zpletan
  • 3,373
  • From talking with the author about it in the past doing this is surprisingly non-trivial, maybe someone can come up with something clever though. – Jorge Castro Mar 13 '12 at 14:25
  • Perhaps http://askubuntu.com/q/113983/8724 could help . . . . – zpletan Mar 25 '12 at 15:32
  • Is this laptop which you're using on a different network, the squid-deb-proxy server? – saji89 May 24 '12 at 17:34
  • @saji89: no, all machines are on the same network. – zpletan May 25 '12 at 13:20
  • I don't think you understood the question @saji89 asked, and I have the same question. If you install squid-deb-proxy on the laptop, and squid-deb-proxy-client on the desktop and the laptop, then the laptop becomes the proxy and uses the proxy locally. As such when you're away from home it will keep updates on the laptop. When you get back home the desktop will get updates from the laptop. – popey Jun 04 '12 at 22:27
  • @popey, I get it now. No, the server is not the laptop. That is actually a good idea, except that the client machine on my laptop is actually a VM which is not normally on. I will edit to make more explicit. – zpletan Jun 05 '12 at 15:01

3 Answers3

2

You could use apt-move (from the package of the same name) to create a local apt repository from the files in your laptop's apt cache. Then use rsync to keep a synced copy of this repository on your LAN. Finally, point other LAN machines to your LAN copy of the local repository at the top of sources.list, so that apt prefers the local repository over remote ones.

Robie Basak
  • 15,670
0

This still is an incomplete answer, but it might be the best possible answer, so read on if curious about possible partial/ugly/complicated solutions.

Intriguing question, I've encountered the same problem but I never fixed it, instead I just try to limit my apt-getting outside my local lan. It really wasn't worth the hassle, at most I wasted like 20MB over the last year. My iso torrent seeding makes up for that. But!

  1. you could set up a tunnel/proxy between your laptop and home to utilize your home cache (this is a good idea anyway for privacy reasons), but, then you would be dependant on your upload speed. Not only would that be slow, but you would use 2x the bandwidth to download the same thing. 1x going into your lan from the Ubuntu mirrors and 1x out to the coffee shop.

  2. I propose that it may be possible to run the cache server on your laptop and then use rsync to keep it in sync with your home server. This presents a problem however in that when you are home that server on your laptop will still be running. To deal with that I could see two possibilities. 1. stop the cache server on your laptop while at home 2. keep all the cached copies that exist on your home server on your laptop too (extra space requirements) and accomplish this by not only pushing cached data to your server with when you get home with rsync, but also regularly pulling the cached data down to your laptop server. In suggesting this I have made the assumption that the squid-deb-proxy cache on one server is compatible with another and that you can swap files in and out like that. These options will also certainly require some scripting. The cache for me is located at /var/cache/squid-deb-proxy/ and below that is not immediately human understandable.

David A
  • 116
  • 2
  • 9
0

We use a simple and stupid aproach: the squid-deb-proxy can use itself as a proxy. Therefore I just do:

  1. I install the client software on the squid-deb-proxy Server:

    apt-get install squid-deb-proxy-client

  2. I created a simple script which lists all installed packages - and redownload each package:

    #!/bin/bash  
    # Create temp dir & change into it
    tmpdir=$(mktemp -d) 
    pushd $tmpdir   
    # Get all installed packages and re-download them
    for package in $(dpkg --get-selections | cut -f 1); do apt-get download $package; done;
    popd
    # Delete tmp dir
    

This way we already have a not-so-bad basic cache.

If we would like to add all packages of an existing server to the cache, then we just execute the same procedure 1) and 2)

hg8
  • 13,462
Tom
  • 264