Jaime Frutos Morales's blog

24/06/2010

How to install and configure Apt-Cacher NG on Ubuntu Server 10.04

Filed under: Linux, SysAdmin, Ubuntu — acidborg @ 13:34

Description: Apt-Cacher NG is a caching proxy specialized for package files from GNU/Linux distributors, primarily for Debian and Debian based distributions (like Ubuntu). This means that if you have many Debian/Ubuntu machines on your network, you just have to download the deb packages (new software, updates, distro upgrades, etc) from the internet once and the rest of the Debian/Ubuntu machines get them from Apt-Cacher NG cache, saving time and internet bandwidth. To install it, follow these simple steps:

Steps:

  1. Installation: apt-get install apt-cacher-ng
  2. Configuration: Edit /etc/apt-cacher-ng/acng.conf with the following content:
    CacheDir: /var/cache/apt-cacher-ng
    LogDir: /var/log/apt-cacher-ng
    Port:3142
    BindAddress: 0.0.0.0
    Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian
    Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu
    PidFile: /var/run/apt-cacher-ng/pid
    ExTreshold: 4
  3. Restart Apt-Cacher NG: /etc/init.d/apt-cacher-ng restart
  4. Create on the rest of the Debian/Ubuntu machines on the network the file /etc/apt/apt.conf.d/02proxy with the following content:
    Acquire::http { Proxy "http://your-apt-cacher-ng-server:3142"; };

Next time any of your machines needs a deb package, it will ask Apt-Cacher NG for it. If this package was asked previously by any of the other machines, Apt-Cacher will have a copy and will deliver it. Otherwise, it will fetch it from the internet repositories, keep a local copy and deliver it.

Advertisements

Blog at WordPress.com.

%d bloggers like this: