Translation(s): English - Italiano - Português (Brasil) - Svenska


The definition of a source package

Source packages provide you with all of the necessary files to compile or otherwise, build the desired piece of software.

It consists, in its simplest form, of three files:

Why looking at a source package ?

Why bother with source package if there is a binary package ?

Some build systems (e.g. cmake) and ad-hoc scripts provide a convenient way to produce Binary packages (i.e. .deb files for Debian, .rpm for RedHat, etc) in a uniform fashion. Although such approach sounds appealing at first, it is not only insufficient for upload into Debian proper, where source package is required, but might be inferior.

Binary-only distribution

How to Download a source package

Sources are normally not installed. You can only install them if you know the package name.

How to find the name of the source package

On, there is a search engine which will go to :<name> .

A source package could generate many .debs. To know the source package name, see the Source: field in the output of

   apt-cache show package_name

Sometimes the SOURCE: field is not present, then you can check using:

   apt-cache showsrc package_name

With apt-get source

One way to obtain source packages is with

   apt-get source <package name>

You need a deb-src entry in your /etc/apt/sources.list file, like :

   deb-src unstable main

A source package is downloaded in the current directory and is not installed (it will not appear in the installed package list), so you need not be root to use apt-get source.


You can do a manual download from

When you are on the page of the package, choose a distribution, and you will have a link to the three files which make the source package.

Working with a source package

How to build the Debian package

You need root privileges or fakeroot to build the .deb. To automatically build the DebianPackage after download, you can also use

   apt-get --build source package_name

If you want to make optimized packages from source to your machine in order to possibly get faster operation, install and use apt-build (which in order uses apt-get source -b ...)

How to extract the source files

Assuming the files of the source package are present in the same directory, to unpack a source package, you can typically use :

dpkg-source -x .../path/to/package_name.dsc

All the files will be unpacked into a directory : package-version.

See also

CategoryPackageManagement CategoryPackaging