Your Linux Data Center Experts

For the most part, debian documentation is good. However, this week, while trying to setup a third-party repository for testing our debian/ubuntu port of vPostMaster, I discovered that the documentation for setting up a new apt repository leaves something to be desired. Unfortunately, this documentation is sorely needed; compared with the command to setup a yum repository for Red Hat, setting up a debian repository is quite user-unfriendly.

This document seemed to be the most likely source of information on how to quickly setup a debian repository:

Apparently, I'm not the only one who feels that it lacks in some important areas. This page, which eventually led me to the correct setup says:

“The main source of information during my discovery process was Aaron Isotton's Debian Repository HOWTO. This document gives an excellent overview of the process, but is lacking in some areas. Specifically, the finer details of generating all the files necessary to make your repository work.”

In other words, the Debian Repository HOWTO is a good starting point, however, it doesn't give all of the information you'll need to actually setup a repository.

Below, I'll briefly cover what I did to get our repository setup, and then what areas could be more clear in the repository HOWTO. This may be something I could contribute to, but I still don't really know enough about the details to do it justice at this point.

How I set up a debian apt repository

For our setup, I was only including two packages. The necessary directory setup never made sense to me, but I was able to put all of the binary and source files into the same directory and it seemed to work.

  • Setup a directory that's either visible on your web/ftp server, or one for copying over to the server later. I setup a directory on a webserver called “vpostmaster/debian/unstable” in the document root. Because this is a Red Hat webserver, it's not where I actually built the repository.
  • Copy all of the files created by the buildpackage process into your repository directory. I.e. the files created with

     $ dpkg-buildpackage -rfakeroot

as explained in the Debian New Maintainers' Guide.
* Create the Release file.
* Create the package description files with these commands:

     $ dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
     $ dpkg-scansources . /dev/null | gzip -9c > Sources.gz
  • If the files need to go on a different server than where you are creating them, copy or rsync them over.
  • Add necessary lines to “/etc/apt/sources.list”, run “apt-get update” and try it out.

I've bolded text above that needs more explination.

The Release file

Apparently you need a Release file in each directory in your repository that contains any packages (source or binary). The repository HOWTO led me to believe that this was optional and only needed if you use Pinning (which is never explained). There's also some conflicting information about the minimum required fields that need to be in this file. I had to find myself several examples before I felt confident that I had what was needed. This is what worked:

     Archive: unstable
     Label: Debian vPostMaster
     Architecture: all i386 source

This indicates that the repository is for debian “unstable”, includes the company name as the origin, I've named it “Debian vPostMaster” as the descriptive Label, and since I'm including source and binary packages for all architectures and i386, that list of architecture.

Configuring /etc/apt/sources.list

The blow is what worked for our setup. The URLs may yet change, so if you're interested in vPostMaster on debian or ubuntu, check the official vPostMaster download page for details about what lines you should add when the port has been tested and is released.

     # repository for vpostmaster
     deb /
     deb-src /

I had some problems with variations of the above, even after modifying the repository directory on the web server. Lines such as

     deb unstable
     deb unstable non-free

caused apt to search in directories that were non-obvious. And without the Release file in the directory, I may have even had the directory tree setup correctly and not known it.

Suggestions for the Repository HOWTO

  • Explain the directory setup better. How does it interact with the sources.list to identify what directory to look in when you install a file? How does it know to look in binary-i386 when it needs an i386 file? Where do I put binaries that work on all architectures?
  • More examples of the Release file please. Which fields are required? Which fields are suggested? What is Pinning and why do I care?
  • More information about tools to automate the creation of the archives would be great. apt-ftparchive and apt-move are mentioned, but no details except a brief description is included.
  • Links to more resources would help. If there is a bigger document that explains more details, link to it.
comments powered by Disqus

Join our other satisfied clients. Contact us today.