Monday, 28 July 2008

apt-cacher-ng

I've been trying to get a decent apt-proxy going which doesn't force me to alter my sources.list file.
I tried apt-cacher, which is supposed to work, but it didn't for me.
Then I tried apt-cacher-ng.

(At my office we connect to the internet through a proxy server which requires username/password authentication,
so obviously I needed to configure apt-cacher-ng to connect
through our normal web proxy to be able to access the internet)

But it gave met the following error when I tried to use it:
407 Proxy Authentication Required

after struggling for some time, I figured out on this Russian site how to fix my problem:
http://linuxforum.ru/index.php?s=c9cb81224e4e338dc7ba84b6857dca5f&showtopic=69037&st=0&p=661582&#entry661582

It turns out the sample config file (/etc/apt-cacher-ng/acng.conf) is making you configure the proxy wrongly.
So in stead of configuring like:
proxy: http://user:pass@srv:port
do it like:
proxy: user:pass@srv:port

Now that I could configure my apt-cacher-ng to connect through and authenticate to our internet proxy, I'm able to switch to using it by merely editing /etc/apt/apt.conf:
Acquire::http { Proxy "http://myaptcacherng:3142"; };
//Acquire::http { Proxy "http://networkproxy:3142"; };

(lines starting with // are considered comments)


To Import .deb files from the local apt cache:
# let apt-cacher-ng use the .deb files that are already in /var/cache/apt/archives/
sudo mkdir -p /var/cache/apt-cacher-ng/_import
sudo chown apt-cacher-ng /var/cache/apt-cacher-ng/_import
sudo cp -al /var/cache/apt/archives/* /var/cache/apt-cacher-ng/_import/
# browse to and click "Start Import"
(from http://ubuntuforums.org/archive/index.php/t-981085.html )

2 comments:

  1. Oh, people c'mon... if you found bugs like incorrect inclusion of "http://" in proxy credentials then please report them to the original author (speaking as the one *g*).

    Posting in your blog might help rising the visit count but not getting the bug fixed unless I google for it which happens rarely.

    Thanks anyway, version 0.5.7 will get the fix.

    ReplyDelete
  2. @Anonymous
    Yes you're right. I should have reported the bug, sorry. I probably was just happy I got it working and wanted to share it for in case somebody else struggled with it.
    Thanks for fixing it though.

    ReplyDelete