simple Debian repository

jozef on 2009-07-07T14:40:57

The folder structure is following:

debian-simple-repo
|-- Makefile
|-- Release.conf
`-- unstable # files here generated
   |-- Packages
   |-- Packages.bz2
   |-- Packages.gz
   |-- Release
   |-- Release.gpg
   |-- Sources
   |-- Sources.bz2
   `-- Sources.gz

Makefile

all: repository

repository:
   dpkg-scanpackages unstable /dev/null > unstable/Packages
   dpkg-scansources unstable /dev/null > unstable/Sources

   bzip2 -c9 unstable/Packages > unstable/Packages.bz2
   gzip -c9 unstable/Packages > unstable/Packages.gz
   bzip2 -c9 unstable/Sources > unstable/Sources.bz2
   gzip -c9 unstable/Sources > unstable/Sources.gz

   apt-ftparchive -c=Release.conf release unstable > unstable/Release
   -rm unstable/Release.gpg
   gpg -abs -o unstable/Release.gpg unstable/Release

clean:
   rm -f unstable/Packages* unstable/Sources* unstable/Release*

Release.conf

APT::FTPArchive::Release::Origin "your@email";
APT::FTPArchive::Release::Label "Test repository";
APT::FTPArchive::Release::Suite "unstable";
APT::FTPArchive::Release::Architectures "i386 source";
APT::FTPArchive::Release::Components "main";

generation

All *.deb, *.dsc, *.diff.gz, *.changes, *.orig.tar.gz has to be copied to the unstable/ folder and `make` executed. This will generate unstable/Packages*, unstable/Sources*, unstable/Release* files. Then just the whole folder as-is copied to a web/ftp server.

usage

/etc/apt/sources.list file on a Debian machine has to be updated and a gpg key has to be added through `apt-key add`.

sources.list

deb http://your.hostname/some/folder/ unstable/
deb-src http://your.hostname/some/folder/ unstable/

beyond simple

For more advanced and more distribution like repository use reprepro. Setting up your own APT repository with upload support - is a good introduction to it.