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