Saturday, 26 June 2010

Creating a TRIVIAL DEBIAN REPOSITORY

This howto shows the way to create a trivial debian repository. Just a simple collection of deb package files.

There are two debian repository types: automatic and trivial.

Automatic repos are more complex. We are going to deal with trivial ones.

A trivial repository is composed of a root directory and one or more subdirectories.
No database server is needed.

This trivial repository is good enough to host a few packages, e.g creating a repo with your /var/cache/apt/archives deb packages and burn a cd or store them in a removible drive.

Trivial repos do not follow the standard debian repo directory structure, so we will have to specify the exact path in sources.list file.


CREATING MY TRIVIAL REPO STRUCTURE:

Our repo will consist of MyRepo root directory with binary subdirectory.

$mkdir -p /path/to/MyRepo
$cd /path/to/MyRepo
$mkdir binary

We place there the deb packages our repo will provide.
I.e: we copy packages from the apt cache:
$rsync -vP /var/cache/apt/archives/*.deb /path/to/MyRepo/binary
$cd .. # we move to repo root directory.


CREATE PACKAGES CONFIGURATION FILE

Now we create Packages configuration file and place it in binary directory:
dpkg-scanpackages -m binary /dev/null > binary/Packages # -m option indicates it should include all found packages not only the latest version one.

Packages file shows a package name list with dependency data, checksums, etc...

We can compress it with gzip if it occupies a lot of size.

cd binary; gzip Packages # Packages.gz file will be created.


UPDATE YOUR sources.list FILE:

Add this line in /etc/apt/sources.list file (trailing slash is necessary for trivial repos)
deb file:///path/to/MyRepo binary/

If there would be the root directory only and no subdir: deb file:///path/to/MyRepo ./


UPDATE THE APT DATA BASE

#aptitude update or #apt-get update

Now we can install whatever package from our repo.


CAVEATS
Trivial repositories do not deal with architectures

They do not use a pool directory.

If we want to add new packages we have to repeat the whole process and generate a new Packages file.


REFERENCE:

http://wiki.debian.org/HowToSetupADebianRepository

http://www.debian.org/doc/manuals/repository-howto/repository-howto.en.html

$man dpkg-scanpackages

2 comentarios:

Anonymous said...

You could also consider mini-dinstall to manage a trivial repo, see http://wiki.freegeek.org/index.php/Debian_Package_Repositories

Vicente Hernando said...

Hi,

using dpkg-scanpackages tool is just for a very quick repo setup, but lacking a lot of features.

There are several better repo managing tools, mini-dinstall among them.

This link shows an application list:
http://wiki.debian.org/HowToSetupADebianRepository