Debianhelp.co.uk


Apt-Proxy Configuration in Debian

What is apt-proxy?

Debian archive proxy and partial mirror builder apt-proxy automatically builds a Debian HTTP mirror based on requests which pass through the proxy. It's great for multiple Debian machines on the same network with a slower internet link. The archive is automatically kept up to date using http, ftp or rsync. Cache cleaning of unused and old versions is configurable. You can also import the contents of your apt cache into the archive using apt-proxy-import.

Home page

http://apt-proxy.sourceforge.net

Install apt-proxy in Debian

#apt-get install apt-proxy

This will install all the needed packages. You might want to install rsync and dpkg-dev. You need dpkg-dev only if you want to merge a local apt cache to apt-proxy. rsync package is only needed, if you want to use rsync to download packages.

After the installation of apt-proxy is complete you have to edit the /etc/apt-proxy/apt-proxy.conf file. Mainly you add all your local apt sources you have.

ALWAYS put a trailing slash after the paths.

For example a line looks like this

add_backend /im-ja/ $APT_PROXY_CACHE/im-ja/ http://im-ja.sourceforge.net/

So / after all paths is very important. All of them! Or else you get a “path not found” error and he can’t get your sources.

Well after you entered all you lines (see the README file and the man page for help and the conf file itself), you just have to update your local sources file (/etc/apt/sources.list).

Replace all deb parts with the the URL + PATH to the apt-proxy.

eg:

deb http://ftp.debian.org/debian/ unstable main contrib non-free

would change into

deb http://:9999/debian unstable main contrib non-free

The path after the apt-proxy host is the first path you gave in the apt-proxy conf file. So if you have

security/ ...

Then ‘security‘ is the path you give in your local sources file.

If there are any problems, check the log file of apt-proxy (/var/log/apt-proxy.log) and see if you can access the target hosts.

If you want more know more options and how to use check apt-proxy man page