Debian binary packages can be built from the source, a patch file and a “description” file with extension .dsc.

This is needed, when, e.g. a certain package is not included in the Debian version of the server.


  • This page does not describe the process of creating or fixing/patching a Debian package which is included in the respective Debian version. In that case, you would include “source” repositories in your sources.list and download the source package files with apt‑get source packagename.

  • Packages built this way will most probably expose problems while installing, configuring or running them. Be prepared to deal with these problems.


apt-get install build-essential dpkg-dev fakeroot

Get the package source

For package with version v.v.v-d.d download following three files:

  • package_v.v.v-d.d.dsc
  • package_v.v.v.orig.tar.gz
  • package_v.v.v-d.d.diff.gz

These often come from URLs like:

curl -OL is your friend here.



for post in dsc diff.gz; do
  curl -OL$pre/$pkg/${pkg}_$ver.$post;
curl -OL$pre/$pkg/${pkg}_${ver%-*}.orig.tar.gz


Run dpkg-source -x package_v.v.v-d.d.dsc, this will create the directory package_v.v.v.

Enter the package_v.v.v directory and run dpkg-buildpackage -us -uc -rfakeroot. This will build all packages in the parent directory.

Return to the parent directory, you will find package with names like package-v.v.v-d.d_amd64.dpkg (Note: -, not _).



dpkg-source -x ${pkg}_$ver.dsc
cd ${pkg}-${ver%-*}
dpkg-buildpackage -us -uc -rfakeroot
cd ..
ls ${pkg}*.deb