Logo Background RSS

HTTP download proxy for software packages

  • Apt-Cacher-ng is a software package that keeps a cache, on the disk, of Debian/Ubuntu Packages and Release files.When an apt-get like client issues a request for a file, Apt-Cacher intercepts it and if the file is already cached it serves it to the client immediately, otherwise it fetches the file from the Internet, saves it on the cache, and then serves it to the client. This means that several Debian machines can be upgraded but each package need to be downloaded only once.

    Apt-Cacher-NG does not require neither an interpreter, nor a web server and not even a huge runtime library. It does never fork after server startup, it does not create flag files, flock() files or similar fun. Instead, it uses native system functions (mmap, sendfile) to operate with few overhead.

    Apt-cacher-ng caches the repo’s from the different versions of ubuntu quite nicely. It even nicely supports the different installs of intrepid in my home with different personal package archives (PPA, you know as in ppa.launchpad.net/*).

    Install Apt-Cacher-NG in Ubuntu Intrepid

    First you need to download the latest version of Apt-Cacher-NG from here or using the following command

    wget http://ftp.debian.org/debian/pool/main/a/apt-cacher-ng/apt-cacher-ng_0.3.3-1_i386.deb

    Install .deb package using the following command

    sudo dpkg -i apt-cacher-ng_0.3.3-1_i386.deb

    or you can use the following command to install

    sudo apt-get install apt-cacher-ng

    Now you need to Add a proxy entry to the apt system

    Configure the apt system (apt-get, aptitude, etc.) to use apt-cacher-ng

    $ echo ‘Acquire::http { Proxy “http://localhost:3142″; };’ | sudo tee /etc/apt/apt.conf.d/01proxy

    Run the following command if you need to disable it

    sudo rm /etc/apt/apt.conf.d/01proxy

    Add a proxy entry to the Synaptic system for this go to: Settings->Preferences->Network->Manual Proxy Configuration and enter

    HTTP Proxy: localhost 3142

    FTP Proxy: localhost 3142

    Click OK

    Click Reload

    Dashboard & manual

    For apt-cacher-ng dashboard use the following URL

    http://localhost:3142/acng-report.html

    For apt-cacher-ng manual: (right click &) open with your browser

    file:///usr/share/doc/apt-cacher-ng/html/index.html

    Import .deb files from the local apt cache

    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

    Now open browser using the following URL

    http://localhost:3142/acng-report.html

    and click “Start Import”

    Configure Client Machines

    If you want to use apt-cache-ng in ubuntu or debian clients use the following command to use this proxy

    $ echo ‘Acquire::http { Proxy “http://serverip:3142″; };’ | sudo tee /etc/apt/apt.conf.d/01proxy

  1. #1 idx websites
    September 29th, 2011 at 7:35 am

    I never knew about the Apt- Catcher- ng until I read this post. Does it only work for Ubuntu users? It looks very helpful and can obviously save someone a lot of work. Your post has been really informative.

    Post ReplyPost Reply
Leave a Comment