7. Creating a repository

To setup an apt-get repository, you'll need to have an HTTP or FTP server with the standard distribution package tree and its base directory. The top of the directory tree must be in /etc/apt/sources.list.

Note: Other methods besides HTTP and FTP are still untested.

You'll have to make sure that the files available at this server can be accessed. You can use any browser or web tool and try downloading a file for testing purposes. Doing this test will eliminate server's misconfiguration problems now.

You'll need the following directory structure:

main directory

it will contain license files, directories with source packages, directories with binary packages, etc. Its exactly like the root directory on a CD.

vendor directory

this is a holder for other directories that will have the binary packages.


these are the directories that, inside the vendor directory, will contain the packages. Its name must start with RPMS., i.e., the word RPMS in upper case followed by a dot. After the dot you'll put the name that you want to associate with these files. One example is beta or official for, respectively, the beta and official versions of your distribution.

a base directory

this directory will have the pkglist files with packages names and dependencies.

With all these directories you'll be able to configure your sources.list file to access the repositories you've created.

Example 1. /etc/apt/sources.list

    rpm http://joes.box.com/stuff 5.1/conectiva cds security

With configuration shown at Example 1, the repository tree needs to be something like what's described at Example 2.

Example 2. Server tree

    /home/httpd/stuff/5.1                                                (1)
    /home/httpd/stuff/5.1/lots-of-README-and-LICENSE-files               (2)
    /home/httpd/stuff/5.1/conectiva/base/pkglist.security.bz2            (3)
    /home/httpd/stuff/5.1/conectiva/RPMS.cds/                            (4)
    /home/httpd/stuff/5.1/conectiva/RPMS.security/                       (5)
This is the top of the repository tree
This is the top for a specific version, 5.1 here.
We've generated this control file...
And also this one.
This includes the packages available at Conectiva's CDs
This includes the packages that have security fixes

Note: The names cds and security are arbitrary. In practice you can call them the way you want. The only restriction is that they need to be a logical or physical division of the repository tree.

7.1. genbasedir

Every repository needs to have a package index file which will contain the list of every package available, their descriptions and dependencies. This file is named pkglist and is bzip2 compressed.

To generate the pkglist files you need to go to the base directory in the repository and run genbasedir. It will create the bzip2 compressed files.

Example 3. genbasedir's syntax

    # genbasedir [-s | --sign] [--topdir=dir] distribution component [component ...]

Where, for each element of Example 3 we have:

-s or --sign

using this parameter you'll be able to sign your pkglist files. This will prompt you for your gpg passphrase and will create a file named hashfile.gpg at the same directory.


this parameter specifies the top directory where your repository is found. It's the corresponding directory to the URL specified at your sources.list file.


is the name of your GNU/Linux distribution. It's usually your vendor's name with some version or other identifier appended to it. It's also at your sources.list file.


this (or these) are the places where your rpm files are located. You'll have to put here the same suffix you've used before or things won't work...

Then, for Example 2 we'd have:

    # genbasedir --topdir=/home/httpd/stuff 5.1/conectiva cds 
    # genbasedir --topdir=/home/httpd/stuff 5.1/conectiva security