Installing and maintaining reprepro on Ubuntu


Reprepro (formerly having the working title mirrorer) is a tool to handle local repositories of debian packages.

  • local addition of files or automatically getting them from some remote repository
  • files are stored in a pool/-hirachy
  • uses libdb4.x, so no database-server is need, but information is stored in local files


Prerequisites: have apache2 installed

apt-get install apache2

We start with generating the key

 gpg --gen-key

GnuPG is used here for two purposes: Signing the Debian packages (manually) Signing the catalog files (automatically by reprepro) In general, you only need to run this command on the computer hosting the apt repository:

 apt-get install dpkg-sig

dpkg-sig will be used to sign the packages
3) Signing a package is done with the following command .Here I have downloaded package openvpn and signed it.

dpkg-sig --sign builder openvpn_2.3.2-5_amd64.deb

to batch sign packages

dpkg-sig --sign builder --cache-passphrase *.deb

Create a repo directory under /var/www to store the repo files so they are accessible over the interweb.

 mkdir -p /var/www/repos/apt/debian/conf

Then we need to get the keys

gpg --list-keys

will print out the the ID of the GnuPG key you generated. You will need this id in the following steps.The key in the example bellow is 696FB244

pub 2048R/696FB244 2013-10-21 uid me
create a configuration file for reprepro called distributions /var/www/repos/apt/debian/conf/distributions

nano /var/www/repos/apt/debian/conf/distributions

Inside the file enter the following data ensure you add the key we got in the previous step

Label: ubuntu repo
Codename: precise
Architecture: i386 amd64
Components: main
Apt repository for Stelios


Installing reprepro

 apt-get install reprepro
  1. PLEASE NOTE you have to run the below command from your repository directory, ie the directory containing the conf folder.) /var/www/repos/apt/debian/conf).

In this example i am creating a repository for ubuntu 12.04 but this can be done for ubuntu 14.04 Debian 7 Debian 8.It doesnt matter as long as you use the correct name(jessie, precise...)

reprepro --ask-passphrase -Vb . includedeb precise /srv/packages/openvpn_2.3.2-5_amd64.deb

or to move multiple

reprepro --ask-passphrase -Vb . includedeb precise /srv/packages/*.deb

Then export the key

gpg --armor --output Main.gpg.key --export 696FB244

Copy this to a webserver under /var/www/repos/debian/conf

10)That’s it .Now to add the repo to ANY UBUNTU RUNNINGMACHINE

 wget -O - | sudo apt-key add -

And add this to your /etc/apt/sources.list

 deb precise main

Useful commands

First you need to change the distributions contents to whaever you want then run
reprepro --delete clearvanished
This deletes packages that are no longer referenced

Now just re –mport the packages like before

reprepro --ask-passphrase -Vb . includedeb precise /srv/packages/*.deb

to remove package dpkg for example

reprepro --ask-passphrase -b . remove precise dpkg

to remove packages that appear although they have been overwritten by newer ones

 reprepro deleteunreferenced Creating custom packages