3

Context

With local package repository, I refer to a set of software and configurations on a server which allows to store a software and any client to install this software by normal apt-get command (supposing the repository added to sources.list)

For the creation of a local package repository, I followed this tutorial, which consist in:

  1. generate the .deb
  2. Store the .deb over apache2 server
  3. Generate a Package.gz file

1- To generate the .deb, the software files are required, a DEBIAN folder with metadata is generated and the following command make the job:

dpkg-deb --build <software folder with DEBIAN>

2- I skip this part as very unrelated

3- With the current directory being the apache folder with the .deb, call:

dpkg-scanpackages debian /dev/null | gzip -9c > debian/Packages.gz

The problem

Calling apt-get update over the client machine, it complains with:

W: The repository 'http://example.com packages/ Release' does not have a Release file.

This file is effectively missing on my local store, and look like a register of checksums. But after searching on Internet, and given my low understanding of the topic, I was not able to find how to generate it.

Note: my sources.list has the following line:

deb http://example.com packages/

The question

How to generate the Release file for a local package repository?

4

There are a number of ways of going about this; I use apt-ftparchive.

  1. Create an aptftp.conf file in the root of your repository:

    APT::FTPArchive::Release {
      Origin "Your origin";
      Label "Your label";
      Suite "unstable";
      Codename "sid";
      Architectures "amd64 i386 source";
      Components "main";
      Description "Your description";
    };
    

    with the appropriate values (change “Origin”, “Label”, “Description” at least, and adjust “Architectures” to match the binaries you host).

  2. Create a matching aptgenerate.conf file alongside:

    Dir::ArchiveDir ".";
    Dir::CacheDir ".";
    TreeDefault::Directory "pool/";
    TreeDefault::SrcDirectory "pool/";
    Default::Packages::Extensions ".deb";
    Default::Packages::Compress ". gzip bzip2";
    Default::Sources::Compress ". gzip bzip2";
    Default::Contents::Compress "gzip bzip2";
    
    BinDirectory "dists/unstable/main/binary-amd64" {
      Packages "dists/unstable/main/binary-amd64/Packages";
      Contents "dists/unstable/Contents-amd64";
      SrcPackages "dists/unstable/main/source/Sources";
    };
    
    BinDirectory "dists/unstable/main/binary-i386" {
      Packages "dists/unstable/main/binary-i386/Packages";
      Contents "dists/unstable/Contents-i386";
      SrcPackages "dists/unstable/main/source/Sources";
    };
    
    Tree "dists/unstable" {
      Sections "main"; # contrib non-free";
      Architectures "amd64 i386 source";
    };
    

    (removing i386 if you don’t need that).

  3. In your repository, clear the database:

    rm -f packages-i386.db packages-amd64.db
    
  4. Generate the package catalogs:

    apt-ftparchive generate -c=aptftp.conf aptgenerate.conf
    
  5. Generate the Release file:

    apt-ftparchive release -c=aptftp.conf dists/unstable >dists/unstable/Release
    
  6. Sign it:

    gpg -u yourkeyid -bao dists/unstable/Release.gpg dists/unstable/Release
    gpg -u yourkeyid --clear-sign --output dists/unstable/InRelease dists/unstable/Release
    

    (with the appropriate id instead of yourkeyid).

Whenever you make a change to the repository, you need to run steps 3 to 6 again.

  • After a little bit of tunning, it finally works. Thanks you! – Adrian Maire Nov 9 '17 at 11:45
  • Can you use something like ` dpkg-scanpackages` rather than apt-ftparchive? – Toby Jul 16 at 16:41
  • @Toby you can use dpkg-scanpackages to generate the package catalogs, but it won’t handle Release for you. The simple option nowadays is probably aptly; I should re-write this answer using that. – Stephen Kitt Jul 16 at 17:00
  • Awesome! Thanks. I should have said earlier, I was looking for a cross platform tool which apt-ftparchive seems like it's not. So aptly sounds good for me and I'll read up on creating the packages. I'm assuming the signing is separate anyway. – Toby Jul 17 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.