Debian – Creating a Debian package repository for distributing multiple versions of a custom deb package

debdebianpackage-managementrepository

We are building an application, which will be packaged into a DEB package. We would like to be able to install and (in the future) update this application on a number of Linux servers with minimal manual interaction, using apt-get.

For this, we plan to deploy our own DEB package repository within the organization. (So we host our package ONLY, but do not mirror existing external repository ) This package repository then should be used by all Linux servers within the organization to install our single application package only.

Can someone please explain me how this should be done (including best practices)?

  • How to set up a minimal DEB package repository for our package (and
    handle when a new version is released) ?
  • Setting up Debian servers so
    that this single package would be fetched from our custom DEB package
    repository server within the organization.

Best Answer

After spending some time digging around the a number of documentation sources, I came up with the following solution, which I am sharing:

  1. On the machine used to host the repository, set up a personal repository according to the description of Ubuntu documentation, but do NOT add the sources.list entry on that machine.
  2. Expose the directory with the DEB files and the Packages.gz file via a web server, e.g. with Nginx so that it is available all the machines that will consume the DEB file.

  3. On the machines, which will fetch the DEB package, add an entry to the /etc/apt/sources.list file, which points to your server (replace foobar with your own URL): deb [trusted=yes] http://foobar/ /

  4. Run sudo apt update
  5. Run sudo apt install foobar to install your own package (replace foobar with your own package name)

NOTE: this setup hosts the DEB packages without any protection provided by signed packages/repositories. In case the repository is made available for a wider audience than your team's servers residing on a protected subnet behind a company firewall, you probably want to implement signing of the repository and packages.

Related Question