25
Package Caching Solutions Jonathan Oxer Debian Miniconf 7 January 28, 2008 Melbourne, Australia

Debian Package Caching Solutions

Embed Size (px)

DESCRIPTION

Talk by Jonathan Oxer at the Debian Miniconf at linux.conf.au in January 2008 about the various caching mechanisms available for Debian / Ubuntu packages. Provides an overview of apt-proxy, apt-cacher, and approx. More information at http://jon.oxer.com.au/talks/id/100

Citation preview

Page 1: Debian Package Caching Solutions

PackageCaching

SolutionsJonathan OxerDebian Miniconf 7January 28, 2008

Melbourne, Australia

Page 2: Debian Package Caching Solutions

Problem:for n machines,all packages are

downloaded n times

Page 3: Debian Package Caching Solutions

So run a localmirror, right?Not so fast!

Page 4: Debian Package Caching Solutions

A mirror is a dumbcopy of the

entire archive...

Page 5: Debian Package Caching Solutions

...including everypackage you'venever installed!

Page 6: Debian Package Caching Solutions

ftp.au.debian.orgDec 16th 2007 – Jan 19th 2008:1,200,598 package downloads

Page 7: Debian Package Caching Solutions

ftp.au.debian.orgDec 16th 2007 – Jan 19th 2008:1,200,598 package downloads

277,110 different .debs(35,513 in i386 alone)

16,296 packages in i386

Page 8: Debian Package Caching Solutions

Downloads / .deb: Debian i386

Page 9: Debian Package Caching Solutions

In Debian/i38610% of packages

account for 89.8%of downloads

Page 10: Debian Package Caching Solutions

10,989 .debs(31%) weredownloadedonly once!

Page 11: Debian Package Caching Solutions

Downloads / .deb: Debian all architectures

Page 12: Debian Package Caching Solutions

Downloads / .deb: Debian, Ubuntu, Backports

Page 13: Debian Package Caching Solutions

The moral:

don't downloadwhat you

don't need

Page 14: Debian Package Caching Solutions

Mirror bad:cache good!

Page 15: Debian Package Caching Solutions

A cache is like a mirror with

a brain

Page 16: Debian Package Caching Solutions

Squid?

Page 17: Debian Package Caching Solutions

:-( Not tuned for large files.:-( Cache expiry algorithm doesn't understand DPKG.

Page 18: Debian Package Caching Solutions

apt-proxyapt-cacher

approx

Page 19: Debian Package Caching Solutions

approxWritten in Ocaml.Runs as a daemon.

Forces clients to use specified repos.

Page 20: Debian Package Caching Solutions

1. Install on server:# aptitude install approx

2. Edit /etc/approx/approx.conf to set repo locations such as:debian  http://ftp.au.debian.orgnon­US  http://ftp.au.debian.org/non­USsecurity http://security.debian.org/debian­security

3. Edit /etc/sources.list on clients:deb http://mycache:9999/debian stable main contribdeb http://mycache:9999/security stable main

Logging goes in /var/log/apt-proxy.log

Setting Up Approx

Page 21: Debian Package Caching Solutions

apt-proxyWritten in Python.Runs as a daemon.

Forces clients to use specified repos.v2 is a complete rewrite.

Page 22: Debian Package Caching Solutions

1. Install on server:# aptitude install apt­proxy

2. Edit /etc/apt-proxy/apt-proxy-v2.confto set backend sources such as:[debian]backends =

 http://ftp.au.debian.org http://ftp.us.debian.org

3. Edit /etc/sources.list on clients:deb http://mycache:9999/debian stable main contribdeb http://mycache:9999/security stable main

Logging goes in /var/log/syslog

Setting Up Apt-proxy

Page 23: Debian Package Caching Solutions

apt-cacherWritten in Perl.

Runs as a daemon or CGI.Clients can use any repo they like.Logging; reporting; access control;upstream proxy (with auth); client

advisories in return value.

Page 24: Debian Package Caching Solutions

1. Install on server:# aptitude install apt­cacher

2. Edit /etc/apt-cacher/apt-cacher.confto set options such as:allowed_hosts=192.168.0.0/24admin_email = [email protected]

3. Edit /etc/sources.list on clients:deb http://cache/apt­cacher/ftp.debian.org \   stable main contrib

Logging goes in /var/log/apt-cacher/[access|error].log

Setting Up Apt-cacher

Page 25: Debian Package Caching Solutions

These slides are online now at:http://jon.oxer.com.au/talks/

Image by Andre Gonzalez:http://nostromo2k3.deviantart.com/gallery/