System Integration

February 11, 2011

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

Filed under: Ubuntu — Tags: — NyU @ 4:06 pm
Technorati Tags: ,,

Description: Apt-Cacher NG  Apt-Cacher NG is a caching proxy for software packages which are downloaded by Unix/Linux system distribution mechanisms from mirror servers accessible via HTTP. 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. Follow these steps:

Steps:

  1. Installation: apt-get install apt-cacher-ng

  2. Restart Apt-Cacher-NG: /etc/init.d/apt-cacher-ng restart

  3. There are two ways use apt-cacher-ng

    • Specify the caching machine as HTTP Proxy for APT, E.g. Putting a line like the following into a file like /etc/apt/apt.conf.d/02proxy

Acquire::http { proxy “http://your-apt-cacher-ng-server:3142”; };

    • Edit sources.list and replace

###### Ubuntu Main Repos
deb http://vn.archive.ubuntu.com/ubuntu/ maverick main restricted universe multiverse
deb-src http://vn.archive.ubuntu.com/ubuntu/ maverick main restricted universe multiverse

      • Now become

###### Ubuntu Main Repos
deb http://your-apt-cacher-ng-server:3142/ubuntu/ maverick main restricted universe multiverse
deb-src http://your-apt-cacher-ng-server:3142/ubuntu/ maverick main restricted universe multiverse

Trick: Use this command to : just change "server" to the name/ip of your machine

sudo perl -i.bak -pe ‘s/http:\/\//http:\/\/server:3142\//g’ /etc/apt/sources.list

Ref: http://www.unix-ag.uni-kl.de/~bloch/acng/html/index.html

Create a free website or blog at WordPress.com.