Creating local package mirror

References

Motivation

If you want to test a package during debootstrap, you can create a local mirror and have deboostrap refer to that.

There are probably simpler ways of doing this. Right now I'm documenting the steps I took which made this work. I suspect several steps can be dropped.

Steps

First, create the packages as you see fit.

Create the mirror directories:

release=precise
mkdir -p /mirrors/debian/pool/main
mkdir -p /mirrors/debian/dists/$release/main/binary-amd64

If you want to use this for deboostrap, then download the files debootstrap will need, and copy them into the mirror:

debootstrap --download-only $release $release-cache
cp $release-cache/var/cache/apt/archive/* /mirrors/debian/pool/main

Copy the customized packages into pool/main:

cp *.deb /mirrors/debian/pool/main/

Now create Packages list:

cd /mirrors/debian
apt-ftparchive packages pool/main | gzip -9c > dists/$release/main/binary-amd64/Packages.gz

We need a Releases file:

cd /mirrors/debian
cat > release.conf << EOF
APT::FTPArchive::Release {
Origin "APT-Move";
Label "APT-Move";
Suite "$release";
Codename "$release";
Architectures "amd64";
Components "main";
Description "Local Updates";
};
EOF
apt-ftparchive -c release.conf release dists/$release/ > dists/$release/Release

Now, you can add this mirror to your sources.list,

cat >> /etc/apt/sources.list << EOF
deb file:/mirrors/debian $release main
EOF

or you can run debootstrap referring to this mirror:

{{{
debootstrap --no-check-gpg $release $release-rootfs file:///mirrors/debian

SergeHallyn_localrepo (last edited 2013-02-08 14:42:09 by serge-hallyn)