Tag Archives: apt-cacher

Adding mongo-10gen to apt-cacher (and Ubuntu)

On the server:

Add the following line to /etc/apt-cacher/apt-cacher.conf:
path_map = mongodb-10gen http://downloads-distro.mongodb.org/repo/ubuntu-upstart

Download the key and serve to clients (I rather add the key to the repo server and have clients download it from there, than connect out and get from the internet):
gpg –keyserver keyserver.ubuntu.com –recv-keys 7F0CEB10
gpg –armor –export 9958C967 > mongodb-10gen.pub
python -m SimpleHTTPServer 8000


On client:

Create file /etc/apt/sources.list.d/10gen.list with the following contents:
deb http://your.apt-cacher.hostname:3142/mongodb-10gen dist 10gen

Download key from repo server:
wget http://your.apt-cacher.hostname:8000/mongodb-10gen.pub
apt-key add mongodb-10gen.pub
apt-get update

That should do it.  Then you can stop the python web server on the repo server.

Adding s3ql to apt-cacher

On apt-cacher server

// add repo to apt-cacher /etc/apt-cacher/apt-cacher.conf
path_map = s3ql http://ppa.launchpad.net/nikratio/s3ql/ubuntu

// download the key and serve to clients (remember to exit web server process when you are done with the client)
gpg –keyserver keyserver.ubuntu.com –recv-keys 9958C967
gpg –armor –export 9958C967 > s3ql.pub
python -m SimpleHTTPServer 8000

On client

// add to /etc/apt/sources.list
# s3ql
deb http://apt.cacher.hostname:3142/s3ql lucid main
// download and install the key
wget http://apt.cacher.hostname:8000/s3ql.pub
apt-key add s3ql.pub
apt-get update

Creating custom packages and adding to apt-cacher

To create a custom package:
1. mkdir ~/debian; mkdir ~/debian/DEBIAN
2. vi ~/debian/DEBIAN/control
Add some info to this file:
Package: hello
Priority: optional
Section: devel
Maintainer: My Name myemail@domain.com
Architecture: i386
Version: 0.5
Description: Test package
3. pretend that ~/debian is the root, and put your files inside any subdirectories as appropriate
eg, if you have a script called myscript.sh that you want to put in /usr/bin, you want ~/debian/usr/bin/myscript.sh
4. cd ~
5. dpkg-deb –build debian
6. rename the debian.deb file to your packagename-versionnumber.etc.deb

To get this into apt-cacher, you should put your custom packages into a directory, then run this:
/usr/share/apt-cacher/apt-cacher-import.pl -r /your/directory/path

Setting up apt-cacher on Ubuntu 10.04

On repository server:

  1. Download:
    apt-get install apt-cacher apache2
  2. Get it to auto-start by editing /etc/default/apt-cacher and change autostart to 1
  3. Modify any config options in /etc/apt-cacher/apt-cacher/conf (not required)
  4. Restart apt-cacher – this will create the log files
    /etc/init.d/apt-cacher restart
  5. Import any existing apt-get cache (not sure exactly what this is for, but the documentation mentions it)
    /usr/share/apt-cacher/apt-cacher-import.pl -s /var/cache/apt/archives

On client server:

  1. Modify the sources list at /etc/apt/sources.list, like so:
    cp /etc/apt/sources.list /etc/apt/sources.list.bak
    vi /etc/apt/sources.list
  2. Reload the apt list
    apt-get update
  3. Try and install something