my question is very simple, but I think it will create a wide range of answers, suggestions and so on ;)

How can I create packages for linux system like Ubuntu or Debian and publish them via a root server?

  • 1
    WTF is a root server in this context?
    – womble
    Oct 18, 2009 at 23:13
  • a dedicated server ? Oct 21, 2009 at 13:28

5 Answers 5


The Debian packaging system is one of the most elegant methods of installing, upgrading, and removing software available in a public repository. If you need to build and maintain an unofficial Debian package repository, you may consider some tips. Here I will describe briefly some steps to get your public Debian repository.
Firstly, install some necessary packages :

sudo apt-get install build-essential devscripts debhelper dh-make diff patch gnupg fakeroot lintian linda pbuilder
and may be cdbs if you intend to use it in your rules file :

sudo apt-get install cdbs

Create a working directory, and move in the source of your package that you intend to build

mkdir packages
cp mypackage-0.1.tar.gz packages
cd packages
Set the maintainer email and full name, this information will be used in the package meta data information.

export DEBEMAIL="user@address"
export DEBFULLNAME ="full name"
After run dh_make, a few questions will pop up which should be answered accordingly, this tool will extract some templates into packages/debian directory. for more information about that run dh_mahe -h

There are many files needed to create .deb package that are stored in the project’s root directory packages/debian. for setting changes necessary to these files you have to know some informatins about your package: dependencies, copyright, changelog, makefile ... please refer to this tuto The next step to build the binaries package which is built calling the following commands in the ./debian directory:

cd debian
debuild -rfakeroot
This will do everything for you. It will:

  • clean the source tree (debian/rules clean), using fakeroot
  • build the source package (dpkg-source -b)
  • build the program (debian/rules build)
  • build the binary package (debian/rules binary), using fakeroot
  • sign the source .dsc file, using gnupg
  • create and sign the upload .changes file, using dpkg-genchanges and gnupg

Let's say that our repository will contain only two sub directories: binary and source
dpkg-scanpackages scans the .deb packages; dpkg-scansources scans the .dsc files.
It is thus necessary to put the .orig.gz, .diff.gz and .dsc files together. The .changes files are not needed.
create repository directory in your www like this:

sudo mkdir -p /var/www/repository/{binary,source}
Move your deb and source package into /var/www/repository/{binary,source} and generate the index.

$ cp mypackage-0.1-1.deb /var/www/repository/binary/
$ cp mypackage-0.1-1.tar.gz  /var/www/repository/source/
$ cd /var/www/repository
$ dpkg-scanpackages binary /dev/null | gzip -9c > /var/www/repository/binary/Packages.gz
$ dpkg-scansources source /dev/null | gzip -9c > /var/www/repository/source/Sources.gz
Lastly, add this your your source.lst to be able to get your package from the repository.

deb http://yourwebserver/repository binary/
deb-src http://yourwebserver/repository source/

I hope that can help, for more information please refer to the complete documentation:

- Debian Maintainers' Guide
- Ubuntu Packaging Guide

  • thank you very much, I will +1 you, after I reached 50 ;) Oct 21, 2009 at 13:28
  • +1 Great answer and very clear explanation!
    – wzzrd
    Oct 23, 2009 at 11:40

You can create packages using the documentation at

When your packages are ready you can use dpkg-scanpackage to create the package files apt needs to list your software.

Alternatively you could use apt-ftparchive that needs a little bit more configration but can be used for bigger repositories with different architectures etc. You can find a nice guide on apt-ftparchive

Maybe you should also have a look at ubuntu's ppas. This is an automatic build service and repository for ubuntu and debian.


The checkinstall tool will automatically create .deb / .rpm and slackware packages by watching what an installation script or makefile does to install something. For less complex packages (those without a lot of pre/post install scripting) it does a reasonably good job.

I would not, however blindly post a package made with checkinstall to the public at large. I use it only for bundling stuff that we install on our local office network.

Still, its worth checking out. A lot of work has gone into it over the last year to make it build even complex packages correctly and without lint.

I like it because its very easy to drop into any build system and populate trivial repositories.

  • I, also, like checkinstall. You ./configure && make && checkinstall. An interactive menu guides you through the building procedure.
    – Joe
    Oct 23, 2009 at 21:26

Take a look at the Debian New Maintainers' Guide.


If you are using ubuntu mainly, you should read this :


I suggest you use launchpad for hosting your packages, unless the packages are private for you company. You should also read Ubuntu's Basic packaging guide, for detailed instructions on how to build packages from sources.

  • -1 Linking to a page with information that is related to the question, but does not answer it directly, does not score point with me. Linking to pages as answers mostly doesn't in general, really.
    – wzzrd
    Oct 23, 2009 at 11:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .