Use apt-cacher-ng to replace broken approx apt proxy tool
the following is from here: askubuntu.com/questions/3503/best-way-to-cache-apt-downloads-on-a-lan
I used to use and recommend approx, but it's growing increasingly unreliable, to the point of being worse than not using a proxy at all, since I have to keep debugging it when it fails to properly update. So I'm going to try this one next. ========================== apt-cacher-ng is the answer for me - I haven't encountered any problems in smallish environments (approx. 20 clients), so I suppose the issues @MagicFab mentions were solved in current version (installed on Ubuntu 10.04 and 10.10). There is no config necessary for the server, and you only need to instruct your clients to use the server as their package manager proxy. The server is completely installed and configured by installing the apt-cacher-ng package. The clients need to be configured by setting up APT proxy - by adding the file /etc/apt/conf.d/01proxy, containing this (where "your-apt-server" is your server's name or IP address): :: Code :: Acquire::http { Proxy "http://your-apt-server:3142"; };Done - now the packages will be cached by the server, no matter what sources you use or what system version you have (e.g. a 10.04 server can be used by 9.10,10.04 and 11.04 clients without any problems or conflicts). If you have client laptop(s) that roam betweeen networks, it gets a bit more complex - I've made a script that sets the right proxy depending on the network address; the script is executable and in <code>/etc/network/if-up.d/apt-proxy</code>. Upon receiving an IPv4 address from a DHCP server, the script will set the right apt-cacher server for the respective network: :: Code :: #!/bin/sh
set -e # Don't bother when lo is configured. if [ "$IFACE" = lo ]; then exit 0 fi # Only run from ifup. if [ "$MODE" != start ]; then exit 0 fi # currently only cares about IPv4 if [ "$ADDRFAM" != inet ] && [ "$ADDRFAM" != NetworkManager ]; then exit 0 fi # only run for DHCP-assigned addresses if [ "$DHCP4_IP_ADDRESS" = "" ]; then exit 0 fi # we're matching on network *broadcast* address, # not the specific IP address we were assigned case "$DHCP4_BROADCAST_ADDRESS" in 10.3.141.255) PROXY='Acquire::http::Proxy "http://my-home-server:3142";'; ;; 192.168.154.255) PROXY='Acquire::http::Proxy "http://work-server.foo.bar.example.com:3142";'; ;; # add as needed *) # unknown, no proxying PROXY="" ;; esac # set the proxy FNAME="/etc/apt/apt.conf.d/01proxy" echo -n "$PROXY">$FNAME exit 0 Back to top |
All times are GMT - 8 Hours |