How to Set Up a Repository There are two types of repositories: more complex ones where the user has only to specify the base path to the repository, the distribution and the components he wants (apt will automatically fetch the ones for the right architecture, if available), and simpler ones where the user has to specify an exact path (and apt will do no magic to find out which packages are the right ones). The former are a bit more complex to set up, but easier to use, and should always be used for complex and/or cross platform repositories; the latter are simpler to set up, but should only be used for small or single-architecture repositories.
Although it is not really correct, I'll call the former Automatic Repositories and the latter Trivial Repositories.
Automatic Repositories The directory structure of an automatic repository with the standard Debian architectures and components looks like this:
Example 1. A Standard Debian Repository
(your repository root) | +-dists | |-stable | |-main | | |-binary-alpha | | |-binary-arm | | |-binary-... | | +-source | |-contrib | | |-binary-alpha | | |-binary-arm | | |-binary-... | | +-source | +-non-free | |-binary-alpha | |-binary-arm | |-binary-... | +-source | |-testing | |-main | | |-binary-alpha | | |-binary-arm | | |-binary-... | | +-source | |-contrib | | |-binary-alpha | | |-binary-arm | | |-binary-... | | +-source | +-non-free | |-binary-alpha | |-binary-arm | |-binary-... | +-source | +-unstable |-main | |-binary-alpha | |-binary-arm | |-binary-... | +-source |-contrib | |-binary-alpha | |-binary-arm | |-binary-... | +-source +-non-free |-binary-alpha |-binary-arm |-binary-... +-source
The free packages go into main; the non-free ones into non-free, and the free ones which depend on non-free ones into contrib. Debian currently supports 11 architectures; I've omitted most of them for the sake of brevity.
Each binary-* directory contains a Packages.gz and an optional Release file; each source directory contains a Sources.gz and an optional Release file. Notice that the packages do not have to be in the same directory as the index files, because the index files contain paths to the individual packages; in fact, they could be anywhere else in the repository. This makes it possible to create pools.
You are free to create as many distributions and components and to call them as you wish; the ones I used in the example are just the ones used in Debian. You could, for example, create the distributions current and beta (instead of stable, testing and unstable), and the components foo, bar, baz and qux (instead of main, contrib and non-free).
While you are free to call the components as you want, it is generally a good idea to use the standard Debian distributions, because that's what Debian users expect.