skip navigation

www.Hilands.com


Content:: Apt-cacher

Apt-cacher
OS: Debian Wheezy (7.x)
Last Modified: 2013-09-16
Apt-cacher is a simple way to create an automated local repository. If you have a handful of development systems that you are constantly building Apt-cacher can easily save your network traffic and the network traffic of the Debian repositories. The Apt-cacher local repository can be found in /var/cache/apt-cacher.

Table of Contents
Installing Apt-cacher Server
# apt-get install apt-cacher
During the setup/configuration Set the daemon to auto start via "inetd"
We can see the configuration for the auto start in the configuration file # nano /etc/default/apt-cacher You can change the AUTOSTART setting to 1
#AUTOSTART=0
AUTOSTART=1
The "proper" way of changing the configuration file is via the dpkg-reconfigure dpkg-reconfigure apt-cacher
Change the configurations to generate reports and allow any host to connect. # cp /etc/apt-cacher/apt-cacher.conf /etc/apt-cacher/apt-cacher.conf.orig
# nano /etc/apt-cacher/apt-cacher.conf
generate_reports=1
allowed_hosts = *
# /etc/init.d/apt-cacher restart
You can see the status of the server by going to
http://127.0.0.1:3142
To see the reports append /report to the URL.
http://127.0.0.1:3142/report
Setting up the client to use Apt-cacher server during install
Apt-cacher
During the installation you will be prompted for the servers you'd like to connect to. http://<server>:3142

Setting up the client to use Apt-cacher server post install
# nano /etc/apt/apt.conf
Acquire::http::Proxy "http://<server>:3142";

When you do an apt-get upgrade it still points the repository listed in your sources.list file. Network traffic doesn't seem to show connection to the caching server either.

We can point the local sources to our apt-cacher server by adding the servers name along with the default port of 3142 to each of the active lines in our sources.list file.
Edit your sources.list # nano /etc/apt/sources.list
Add "<server>:3142/" between http:// and the mirrors URL. (See the highlighted red area's below).
# 

# deb cdrom:[Debian GNU/Linux 7.1.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130615-23:04]/ wheezy main

#deb cdrom:[Debian GNU/Linux 7.1.0 _Wheezy_ - Official amd64 NETINST Binary-1 20130615-23:04]/ wheezy main

#deb http://ftp.us.debian.org/debian/ wheezy main
#deb-src http://ftp.us.debian.org/debian/ wheezy main
deb http://<server>:3142/ftp.us.debian.org/debian/ wheezy main
deb-src http://<server>:3142/ftp.us.debian.org/debian/ wheezy main

#deb http://security.debian.org/ wheezy/updates main
#deb-src http://security.debian.org/ wheezy/updates main
deb http://<server>:3142/security.debian.org/ wheezy/updates main
deb-src http://<server>:3142/security.debian.org/ wheezy/updates main

# wheezy-updates, previously known as 'volatile'
#deb http://ftp.us.debian.org/debian/ wheezy-updates main
#deb-src http://ftp.us.debian.org/debian/ wheezy-updates main
deb http://<server>:3142/ftp.us.debian.org/debian/ wheezy-updates main
deb-src http://<server>:3142/ftp.us.debian.org/debian/ wheezy-updates main
References