Guide for setting up http-replicator, a download cache (proxy) for Ubuntu packages
http-replicator is a powerful Python-based proxy or download cache capable of caching any traffic over http. It's best when used for a network of Ubuntu machines, saving bandwidth and increasing the speed with which updates are obtained by all machines.
NOTE: The deb available from the freshmeat & gertjan.freezope.org page for this package is older then the one here, so please use the one given below.
http-replicator_4.0~alpha2-0tikhonov4~trusty_all.deb' wget https://launchpad.net/~tikhonov/+archive/ubuntu/http-replicator/+build/5924499/+files/http-replicator_4.0%7Ealpha2-0tikhonov4%7Etrusty_all.deb sudo dpkg -i http-replicator_4.0~alpha2-0tikhonov4~trusty_all.deb
Now, to configure the proxy, open up the config file with
sudo sensible-editor /etc/default/http-replicator
Look at the line
DAEMON_OPTS="$GENERAL_OPTS --port 8080 --log /var/log/http-replicator.log --user proxy"
And change it to
DAEMON_OPTS="$GENERAL_OPTS --port 8080 --log /var/log/http-replicator.log --user proxy --ip=192.168.0.*"
--ip=192.168.0.*is whatever network address space your using.
Its probably worth noting that ? and * are wildcards supported by http-replicator. You can make it accept connections from one host (or multiple hosts if you use --ip= more then once) or an entire subnet (as above).
The other change you might like to do is change the port to 80. What this will do is make http-replicator cache all web trafic, without requiring you to reconfigure any client settings at all. Your resultant line will look something like:
DAEMON_OPTS="$GENERAL_OPTS --port 80 --log /var/log/http-replicator.log --user proxy --ip=192.168.0.*"
Save the file and exit.
Restart the daemon (or start for the first time)
sudo /etc/init.d/http-replicator restart
And you're finished with the proxy!
Now, all you have to do is get the clients ready. Note that if you changed the port http-replicator runs on to port 80, the following is unneeded. (The example given below is for proxying packages downloaded by APT).
On the local computer you want to use http-replicator with, add this line to /etc/apt/apt.conf
Replace 192.168.0.1 with the IP of the server http-replicator is running on.
man 1 http-replicator
man 1 http-replicator_maintenance
For the record, the following files are installed by the .deb
./ usr/ usr/share/ usr/share/doc/ usr/share/doc/http-replicator/ usr/share/doc/http-replicator/README.gz usr/share/doc/http-replicator/copyright usr/share/doc/http-replicator/examples/ usr/share/doc/http-replicator/examples/apt.conf usr/share/doc/http-replicator/changelog.gz usr/share/man/ usr/share/man/man1/ usr/share/man/man1/http-replicator.1.gz usr/share/man/man1/http-replicator_maintenance.1.gz usr/bin/ usr/bin/http-replicator usr/bin/http-replicator_maintenance etc/ etc/logrotate.d/ etc/logrotate.d/http-replicator etc/default/ etc/default/http-replicator etc/init.d/ etc/init.d/http-replicator etc/cron.weekly/ etc/cron.weekly/http-replicator