A very short introduction to packaging .debs

IntroductionπŸ”—

This mostly matches to all Debian-based distros (Debian, Ubuntu, Mint, …).

apt install coolpackage

All related file formats etc. are mostly defined in Debian, some small changes might be introduced by downstream distros (Ubuntu, …).

deb, dpkg, apt, repository, …

NotesπŸ”—

All examples use podman, but commands should work as-is with Docker, just s/podman/docker/g.

.deb (the file format)πŸ”—

deb822πŸ”—

tar inside tar insideβ€¦πŸ”—

MVPπŸ”—

debian/changelog
debian/control
debian/copyright
debian/rules
debian/source/format

dpkg (the command)πŸ”—

apt (the command)πŸ”—

(apt) repository (the distribution point)πŸ”—

sources.listπŸ”—

deb http://deb.debian.org/debian          trixie          main non-free-firmware
deb http://deb.debian.org/debian          trixie-updates  main non-free-firmware
deb http://deb.debian.org/debian-security trixie-security main contrib non-free non-free-firmware

Structure of an APT repositoryπŸ”—

root         # (often: /debian or /ubuntu)
|-- dists    # metadata
|-- pool     # assets (sources and binaries; .deb, .tar, ...)
|-- ...

Create new package from scratchπŸ”—

$ dh_make -s -c apache -e user@example.org -n -p coolpackage_1.0
Maintainer Name     : unknown
Email-Address       : user@example.org
Date                : Thu, 06 Mar 2025 06:47:51 +0000
Package Name        : coolpackage
Version             : 1.0
License             : apache
Package Type        : single
Are the details correct? [Y/n/q]
Done. Please edit the files in the debian/ subdirectory now.

See alsoπŸ”—

  • https://www.debian.org/doc/debian-policy/
  • https://wiki.debian.org/DebianRepository/Format
  • https://wiki.debian.org/PackagingWithGit
  • https://www.debian.org/doc/devel-manuals