Setup New Repository

Setup and Create Repository

This section is about setting up and create a new hosting repository.

Install Reprepro Into System

The first thing to do is to install reprepro. To do that, simply use apt-get:

$ sudo apt-get install reprepro -y

Have Your DEB Package Signed and Ready

Normally, you should have built your DEB package standing by for submissions. You need a .deb package standing by for hosting practice.

Getting the Repository Ready

Let's map out the required repository structure. They are 4 critical directories:

  1. basedir - stands for base directory. It is the fallback directory to work with. Usually, you want to set this path to the root of the repository.
  2. outdir - stands for output directory. It is the output directory to host the server. Usually, you want to set this path to the static path of the hosting server, like releases/deb for URI like www.example.com/release/deb.
  3. confdir - stands for configuration directory. It is the configurations directory to produce the output. Usually you want to set this path to somewhere hidden to the repository like .configs/reprepro.
  4. dbdir - stands for database directory. It is the database directory to hold the repository's past data. Usually you want to set this path somewhere hidden like .configs/reprepro.

Overall, your repository structure looks something as such (not a rule, but a reference):

repo                               // basedir path
  +-- static hosting server directory
        +-- ...
        +-- static
              +-- releases
                      +-- deb      // outdir path
  +-- .configs
        +-- reprepro               // confdir and dbdir path

Create Configuration Directory's Structure

Inside the confdir path, create a directory called conf that holds all your reprepro configurations. Hence, the structure looks something as such based on the example above:

repo                               // basedir path
  +-- static hosting server directory
        +-- ...
        +-- static
              +-- releases
                      +-- deb      // outdir path
  +-- .configs
        +-- reprepro               // confdir and dbdir path
              +-- conf

Once done, the next few steps are creating necessary configuration files based on the reprepro man page: https://manpages.debian.org/jessie/reprepro/reprepro.1.en.html#CONFIG_FILES

Create Distributions Config File (Compulsory)

The compulsory config file is Distributions. The path and filename should be:

<confdir>/conf/distributions

This is the file where it lists all the OS and CPU architecture compatibility for all distributions. There are a few important elements as specified by the manual, and highly recommended to be included:

  • Origin - [OPTIONAL] the URI to download the package.
  • Label - [OPTIONAL] a label for APT to sort things out (and you to verify the output).
  • Description - [OPTIONAL] describe the release server when user queries via apt.
  • Codename - [COMPULSORY] the one word code-name for your software release.
  • Suite - [OPTIONAL] the suite name for the deb package distribution tag like stable, testing, and unstable in Debian; xenial, artful, zerus in Ubuntu (see "IMPORTANT NOTE" below for details) .
  • Architecture - [COMPULSORY] a list of supported architectures separated by space. The package must have the associated architecture in order to get imported into the server. Example: i386 amd64 armhf for package that has i386, amd64, or armhf as architecture.
  • Components - [COMPULSORY] a list of repository's supporting components. Example: main contrib non-free
  • SignWith - [OPTIONAL] the GnuPG key ID used to sign the deb package. This is for verification and identification usage between your server and your user.

To create multiple distributions, you simply leave a space between each distribution.

This produces the following example output using Debian distribution suite against the git tri-branches practices:

Origin: www.myapp.com/releases/deb
Label: MyApp Deb Package
Codename: master
Suite: stable
Architectures: i386 amd64 armhf
Components: main
Description: MyApp is a test DEB server for distributing DEB package.
SignWith: 5143B...YOUR GPG KEY ID...8191A

Origin: www.myapp.com/releases/deb
Label: MyApp Deb Package
Codename: staging
Suite: testing
Architectures: i386 amd64 armhf
Components: main
Description: MyApp is a test DEB server for distributing DEB package.
SignWith: 5143B...YOUR GPG KEY ID...8191A

Origin: www.myapp.com/releases/deb
Label: MyApp Deb Package
Codename: next
Suite: unstable
Architectures: i386 amd64 armhf
Components: main
Description: MyApp is a test DEB server for distributing DEB package.
SignWith: 5143B...YOUR GPG KEY ID...8191A

Where your user can include your apt server with the following address:

IMPORTANT NOTE

Codename and Suite are both used by reprepro to populate a built deb package. However, depending on your build system's operating system, the deb packager builder will not tolerate unknown distribution name such as 'master' above.

Hence, it is always a practice that the Suite in reprepro matches the deb packager builder's distribution tag while freeing up the Codename for your own release codes. Example on some Debian-based operating system:

  1. Debian Buster (https://www.debian.org/releases/)
    • In deb package builder:
      1. distribution = stable
    • In reprepro:
      1. Codename = your choice of word (e.g. master for master branch)
      2. Suite = stable
  2. Ubuntu (https://wiki.ubuntu.com/Releases)
    1. In deb package builder:
      • distribution = xenial
    2. In reprepro:
      1. Codename = your choice of word (e.g. master for master branch)
      2. Suite = xenial

Other Non-Reprepro Setup

There are other non-related setup needs to be done before you can tell your users to use it.

Publish Your GnuPG Public Key


Test The Server

Once done, you may start testing your server. To include a deb package into the server, please follow the following page (recommended right-click and open new tab in case you need to amend the configurations):