Creating and Populating a Debian / Ubuntu Package Repository

This document will briefly describe building a debian package from source, and adding the package to a new or existing package repository. The results of this can be seen on http://mirror.cs/uwaterloo/ and http://ubuntu-mirror.cs/ubuntu/uwaterloo/ .

Overall steps:

  1. build package
  2. build repository

Building the Package

In my case, I wanted a java package. Debian (and Ubuntu; for the rest of this document, when I say 'Debian' I also mean Ubuntu, except when I explicitly state otherwise) do not publish Sun Java because that would violate Sun's Terms of Use to distribute. However, it is perfectly legit for Debian to publish a package which you can download, along with Sun's Java installer. Running the package on the installer will create a .deb, which it is perfectly legit for you may use yourself (without distributing to others, according to Sun's license). So, the U of W can use the java package I made, we just can't share it outside.

The procedure for building the sun java package is described here: https://wiki.ubuntu.com/Java

That's all I'll say about making this particular package. At least for now.

Building a New Repository

Basic rules for a repository are here: http://www.ibiblio.org/gferg/ldp/giles/repository/repository-2.html Read that page first.

In summary:

    deb http://chaos/debian    unstable    main local unofficial
        ------ base -------  distribution  ---- components -----

    deb-src http://chaos/debian    unstable    main local unofficial
            ------ base -------  distribution  ---- components -----

    deb http://non-us.debian.org/debian-non-US  stable/non-US  main contrib
        ---------------- base ----------------  distribution   -components-

You can simplify matters by listing a base URL and a subdirectory of that URL, which Debian will translate into its 'distribution'. Apparently, the third part of the official repository structure ('components') are optional.

Let's take the uwaterloo-specific repository for mirror.cs which you may already have in your /etc/apt/sources.list:

    deb http://mirror.cs/ubuntu  uwaterloo
        -------- base ---------  distribution

...which will find files located at: http://mirror.cs/ubuntu/uwaterloo

That directory can contain subdirectories for each architecture (as described in above Basic Rules link) or you can cheat and put architectures into the same directory, in which case this directory has semi-arbitrary subdirectories based on packages.

The package directory name should be descriptive (such as "sun_java").

The package directory will contain your created packages. There can be more than one debian package in the directory, for example, for the java runtime engine and the java SDK. The package filename can differentiate between architectures.

For example:

    ubuntu/uwaterloo
    ubuntu/uwaterloo/sun_java
    ubuntu/uwaterloo/sun_java/sun-j2re1.5_1.5.0+update04_amd64.deb
    ubuntu/uwaterloo/sun_java/sun-j2re1.5_1.5.0+update04_i386.deb
    ubuntu/uwaterloo/sun_java/sun-j2sdk1.5_1.5.0+update04_amd64.deb
    ubuntu/uwaterloo/sun_java/sun-j2sdk1.5_1.5.0+update04_i386.deb

The last step is to generate the Packages.gz file used by apt-get. Simply:

dpkg-scanpackages [packagefile_or_dir] /dev/null | gzip > [destination_directory/Packages.gz]

...for the above example, destination_dir might be ~www/ubuntu/uwaterloo .

You'll need to re-run this every time you modify a package in the repository.

You now have everything you need to start wrapping packages and adding your repositories to /etc/apt/sources.list.

-- DanielAllen - 13 Oct 2005

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2008-06-18 - WalterTautz
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback