Configure your computers to use Apt-Cacher-ng

The following procedure describes How To install the Apt-Cacher-NG package in Ubuntu Linux. Apt-Cacher-ng <http://www.unix-ag.uni-kl.de/~bloch/acng/> is a software package that keeps a cache on the disk, of Debian 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.

you can also use the cache to save to a removable drive to perform package updates/installs on a remote machine not connected to the net(providing the packages and their dependencys are in the cache).

Configuration of Server

1- Download and install the package on the machine that is the intended local package server.

sudo apt-get install apt-cacher-ng

2- 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

3- add a symlink so the apt-cacher-ng can import your existing apt cache

sudo mkdir /var/cache/apt-cacher-ng/_import/
sudo ln -s /var/cache/apt/archives/ /var/cache/apt-cacher-ng/_import/apt_existing

to create the symlink

4-Add a proxy entry to the Synaptic system: In Synaptic go to: Settings→Preferences→Network→Manual Proxy Configuration and enter:

servsyn.jpg

Click OK

Click Reload


if you ever need to disable it just use,

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

Web Interface

Load the apt-cacher-ng dashboard at: http://localhost:3142/acng-report.html and Import .deb files already downloaded from the local apt-cache using the new symlink created above in the /var/cache/apt-cacher-ng/_import dir . and then run the import function through the apt-cacher-ng web interface by clicking the “start import” as pictured below,

acngweb.jpg

you should now have all your packages in the apt-cacher-ng repository,


Configuration of Networked Client

below are 3 options depending on your instalation.

For Synaptic GUI

Add a proxy entry to the Synaptic system: In Synaptic go to: Settings→Preferences→Network→Manual Proxy Configuration and enter:

Click OK

Click Reload

For A CLI Interface

To use apt-get, aptitude, etc, add the

Acquire:http { http://server:3142;};

line to /etc/apt/apt.conf.d/01proxy file.

sudo echo >> Acquire:http { http://server:3142;}; /etc/apt/apt.conf.d/01proxy

For Minimal Install Iso

To install a new system with the minimal install CD, simply proceed as normal, entering

http://apt.server.ip.address:3142/

as the proxy when prompted.

then to refresh,

sudo apt-get update

—————————————————————————————

Configuration of Remote Client

1-copy your entire apt-cacher-ng dir across to a removable hard drive or usb key.

2- mount the drive on the remote system

3- add a line in the clients sources.list to point to the new repository and disable the online repositorys in synaptic.

eg

deb file:///home/username/apt-cacher-ng dapper main universe multiverse restricted

reload and use synamptic like your online (providing the required packages and their dependencies are in the personal repo).


Removal of apt/cache server

to cleanup and update apt cache index files

sudo rm -fr /var/cache/apt-cacher-ng/_import
sudo rm -fr /var/cache/apt/archives/*.deb
sudo rm /var/cache/apt/*cache.bin
sudo rm /var/lib/apt/lists/*Packages
sudo rm /var/lib/apt/lists/*Sources
sudo aptitude update

 
apt-cacher-ng_in_ubuntu.txt · Last modified: 2009/05/25 16:15 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki