Build your own Debian Repository

From n0r1sk software solutions
Jump to: navigation, search


This article describes how to install and use your own Debian repository.

Install the needed packages

At first you have to install the right packages for your own repository server.

Softare list:

  • reprepro
apt-get update
apt-get install reprepro

Configure & Create your repository

Configure repository basedir

In our installation we modified the repository-basedir. You have to modify your /etc/profile to make an environment variable which points to the repository directory.

vi /etc/profile

Just add the following line at the end of the profile.

export REPREPRO_BASE_DIR=/srv/repository

Create repository

At first we have to create a public key because the repository is only working properly with one.

gpg --gen-key
   choose "1" (DSA and EIGamal)
   choose "2048" Bits for the key
   choose "5y" to grant the key to be valid for 5 years
   choose, for example, "Fritz Cat <>"
   choose a "Mantra" to protect your key

Export your public key.

gpg --armor --export "Fritz Cat" > PublicKey

So it's time to create the repositories. To create a repository you only have to add a .deb-package to it. See the next steps...

Use reprepro to manage your repository

So we can start to manage our first repository. Let's make a "production" repository with one example-package in it. You can choose the name of the repository as you want. The name "production" is only an example.

reprepro -V includedeb production /srv/packages/package.deb

Wow, we have created a new repository with one package (package.deb) in it!

For more packages you only have to add those to the repository the same way we did in the example above.

Add your repository to the client configuration

Add the repository to your apt-configuration

Add the public-key to your client

To get the packages just download the PublicKey from the repository-server. Trust the repository-server (apt) and import the key.

wget http://10.x.x.x:10000/PublicKey
apt-key add PublicKey
gpg --import PublicKey

Tipps and tricks

For those of you which want to see some most-used commands, look at the following list + descriptions.

  • Add a package to the repository
    reprepro -V includedeb production /srv/packages/package.deb
  • Search for a package in the repository
    reprepro list production package
  • Remove a package from the repository
    reprepro remove production package