Sunday, June 7, 2009

Configuring the Apt-Cacher

Apt- cacher is an nice package in Debian distro, which helps in saving a lot of bandwidth by caching the downloaded packages from the internet. If a client requests a package it is served from the local cache. If the package doesn't exist in the cache, it is fetched from the internet, copied to the cache and then served to the client.

Configuring the Apt-Cacher

First i will install the Apt-cacher and then import the packages from a mounted image of Debian distro.

1. apt-get install apt-cacher
2. nano /etc/default/apt-cacher (Change AUTOSTART=1)
3. nano /etc/inetd.conf (Add line "3142 stream tcp nowait www-data /usr/sbinc/apt-cacher/apt-cacher apt-cacher -i")
4. mount -o loop debian.iso /mnt/
5. /usr/share/apt-cacher/apt-cacher-import.pl -Rr /mnt/
6. nano /etc/apt/sources.list (Add line "deb http://ftp.us.debian.org/debian lenny main contrib non-free")
7. apt-get update
8.
nano /etc/apt/sources.list (Add line "deb http://localhost:3142/ftp.us.debian.org/debian lenny main contrib non-free")
9. /etc/init.d/apt-cacher restart
10. apt-get update