2012-06-19 07:55 UTC
There is a useful tool called reprepro that can be used to manage and create Debian repositores. This article will describe a way to mirror an Debian existing repository using this tool.
# apt-get install reprepro
First create a directory that will hold your repository. This directory will be the root of the repository pointed to by the sources.list of your clients. In this directory we need to create a directory called conf that will hold the configuration files used to control reprepro. This directory is only used locally and not accessed by the clients. Two files are needed to create a mirror from an existing repository; conf/distributions and conf/updates.
# cat conf/distributions
Architectures: i386 amd64
This file defines the local repository. I think the fields are quite self explanatory. Multiple distributions can be specified here by adding more of the same text block as above separated by a blank line. Codename is the name of the distribution. You can use you very own fancy name here. For straight mirroring purposes I do not recommend using another name than the original distribution name but here I called my mirrored distribution another name for clarification. Update is a reference to the updates file.
# cat conf/updates
Architectures: i386 amd64
This file contains the sources used when mirroring. Name is the name of the source referenced to by the Updates field in the repositories file. Suite is the name of the distribution to mirror from the source repository. In the same way as conf/distributions multiple sources can be defined here separated by a blank line.
After these files are configured it is time to start reprepro.
# reprepro -b /data/repo/debian update mysqueeze
The -b flag defines the root directory of the repository. In my case /data/repo/debian. This process will most likely take a while depending on which repository you are mirroring. This command is to be executed every time you want to synchronize your local mirror with the master repository.
To verify the consistency on the packages in the pool the reprepro command checkpool can be used.
# reprepro -b /data/repo/debian/ checkpool
Packages in the pool that are no longer referenced to by any distribution can be deleted by using the deleteunreferenced command.
# reprepro -b /data/repo/debian/ deleteunreferenced
This whole process can be used to stage and freeze distributions for testing purposes. Simply remove the Update statement from conf/distributions file and the distribution will freeze and can no longer be mirrored from the master.
Write a comment