This short HOW-TO describes how to setup a repository using reprepro.

First choose a directory where you want to store your repository,

1) Configuration:

Generate a directory named conf/.

Create a file named "distributions" there.

Add entries such as:

Origin: Debian
Label: Debian-All
Suite: stable
Codename: woody
Version: 3.0
Architectures: i386 sparc mips source
Components: main non-free contrib
Description: Debian woody + woody/non-US + woody/updates
#Update: debian non-US security
#SignWith: yes

Or:

Origin: PCPool
Label: PCPool
Suite: stable
Codename: pcpool
Version: 3.0
Architectures: i386 source
Components: main non-free contrib bad protected server
UDebComponents: main
Description: PCPool specific (or backported) packages
SignWith: yes
DebOverride: override
UDebOverride: override
DscOverride: srcoverride

Multiple entries are separated with an empty line.

The codename of the distribution is specified with Codename:.
It is the primary name of a distribution and e.g. used to determine the
directory to create and put the index files into.

Update: is described later.

If SignWith: is there, it will try to sign it: either use "yes" or give
something gpg can use to identify the key you want to use.

The other fields are copied into the appropriate "Release" files generated.

2) Adding files to the repository:

To add a .deb manually:

reprepro -Vb . includedeb pcpool /var/cache/apt/archives/libc6_2.2.5-11.8_i386.deb

to add a .changes file:

reprepro -Vb . include pcpool test.changes

Hint: you can add "-C component", "-A architecture", "-S section" and "-P
priority" to give additional hints where it should go. Note -A will not
overwrite something to go into another architecture, but simply ignore those
not fitting, only "Architecture: all" packages are placed exactly in these
architecture. Helps when it is not available for all architectures and each
binary version needs a fitting version of the "Architecture: all" package.

3) Removing files from the repository:

reprepro -Vb . remove pcpool libc6

to only remove from a specific component or architecture:

reprepro -Vb . -C main -A i386 remove pcpool libc6

4) Getting information about a package:

To see in which architectures/components a package exists and which version it
uses.

reprepro -b . list pcpool libc6

5) Override-Files:

When including packages via "includedeb", "includedsc" or "include"
the applicable override file from the distribution it is placed
into is used. The file given by DebOverride: for ".deb"s, the
file given by UDebOverride: for ".udeb"s and the file given by
DscOverride: for ".dsc"s. If the filename starts with
a slash (/) it is not relative to the conf directory given
with --conf, defaulting to "conf" in the current directory (or in the
directory specified with --basedir, if that is given).

Note that the Format is those of apt-ftparchive's ExtraOverride, not the old format.
An (stupid) example line for that file would be:
libc6 Priority extra

6) importing from upstream repositories:

The file conf/updates can contain entries like this:

Name: debian
Method: http://ftp.debian.de/debian
VerifyRelease: F1D53D8C4F368D5D

Name: non-US
Method: http://ftp.debian.de/debian-non-US
Suite: */non-US
Architectures: i386 sparc mips source
Components: main>main non-free>non-free contrib>contrib
UDebComponents:
VerifyRelease: B629A24C38C6029A

Name: security
Method: http://security.debian.org/debian-security
Suite: */updates
UDebComponents:
VerifyRelease: F1D53D8C4F368D5D

Which of those are used is determined by the Update: line
in the description in conf/distributions. When Suite:,
Architecture:, Components: or UDebComponents: are not given,
those of the distribution to be added are used.
The suite of the target can be used as "*" in the Suite: here.
VerifyRelease: tells which GPG key to use checking the Release.gpg.

Add a "IgnoreRelease: yes" to ignore any Release files.

To import components in other components, use the source>target
syntax.

Method: describes an apt-method, for which the programs
from /usr/lib/apt/methods are used...

To update everything possible do:

reprepro -b . update

To only update some distributions do:

reprepro -b . update woody

There is no support for updating a distribution from only specific
 upstreams yet. You will have to edit conf/distributions for that.

The value for VerifyRelease: can be retrieved using:

gpg --with-colons --list-keys <whatever>

===============================================================================
The following is from V. Stanley Jaddoe <debian@terabytemusic.cjb.net>.
Make sure to include all sources when allowing everyone access to software
only available under GPL to you. Well, you should always supply sources,
but in some cases not doing so might cause you trouble.

Using reprepro with apache2 (sarge, etch, sid)

This example assumes the reprepro repository is under /srv/reprepro/ and that
apache2 has been correctly installed and configured.

The first step is to create a virtual directory called debian/. Assuming your
server runs the host http://www.example.com/, the web repository will be
placed at http://www.example.com/debian/.

Create an apache2 config file in the conf dir of your reprepro repository,
using the following command:

cat > /srv/reprepro/conf/apache.conf << EOF
Alias /debian /srv/reprepro/
<Directory /srv/reprepro>
        Options +Indexes
        AllowOverride None
        order allow,deny
        allow from all
</Directory>
EOF

To enable this virtual directory, a symlink has to be created. This can be done
using the following command:

ln -s /srv/reprepro/conf/apache.conf /etc/apache2/conf.d/reprepro.conf

The second step is setting the permissions in such a way that web users can
browse the repository, but cannot view the reprepro specific configuration.
This can be done using the following commands:

chown -R root:root /srv/reprepro/
chmod 755 /srv/reprepro/
chown -R root:www-data /srv/reprepro/dists/ /srv/reprepro/pool/
chmod 750 /srv/reprepro/*

Reload apache2:

/etc/init.d/apache2 reload

Check if the repository is viewable by web-users, by pointing your browser to

http://www.example.com/debian/

If there are no problems with your reprepro repository and the apache2
configuration, you should see two directories, dists/ and pool/.

The last step is to add this new repository to your sources.list.

This is as easy as:

echo "deb http://www.example.com/debian pcpool main non-free contrib" >> /etc/apt/sources.list
