The UHF of the film world.
Latest news

quietearth [General News 08.16.06]

Here's how to easily build a .deb package for ubuntu (or debian). You could build a .deb package using checkinstall, but that wouldn't include all the debian/ubuntu specifics you need. I used the following to build the ubuntu package for my next release of News notification.

First off, let's install the necessary tools:
# apt-get install autotools-dev fakeroot dh-make build-essential

Then copy your source tree into a directory in /tmp:
# cp -r news-notification-0.3 /tmp
# cd /tmp/news-notification-0.3

Now let's make the debian control files:
# dh_make
and pick Single for single binary, or whatever is appropriate for your project.

Edit the debian/control file and at least change the Maintainer and Description fields. There are a few other files you will probably want to edit.

Then run the following: (this has to be done as root)
# dpkg-buildpackage -rfakeroot

Looking at the debian/news-notification/DEBIAN/control file we can see that all the dependencies are proper thanks to the autoconf system. If we look in /tmp (one directory up) we see news-notification_0.3-1_i386.deb which is ready to go! If we want to use the appropriate ubuntu package versioning, check out this post. Since this is my first ubuntu package of this version, with no debian original it would be:


Pingback from
on May 12th, 2007 8:24:22 GMT

Pingback from
on September 15th, 2007 9:34:51 GMT

You might also like


china.newlad (11 years ago) Reply

thank you for this document,i have use this to
create my first deb file


quietearth (11 years ago) Reply

With newer versions of dh_make, you might need to specify the --createorig flag to dh_make if you do not provide the original source file.


gerard (10 years ago) Reply

dpkg-buildpackage -rfakeroot does NOT need to be run as root


Anonymous (10 years ago) Reply

thank you for this document,i have use this to
create my first deb file : me too !


Anonymous (9 years ago) Reply

for me, I get a cannot find Glib2 error when running the dpkg-buildpackage command.


tillux (9 years ago) Reply

thanks :) BUT:
dpkg-buildpackage does indeed built the .deb packages, but they are almost empty. The data.tar.gz only contains the folder-structure "down to" the doc folder, but there is no data in the folder...


pavan (9 years ago) Reply

hey how can i "compile" the source in .deb files??


tshirtman (8 years ago) Reply

Thanks! You helped me to backport ghostscript from lenny to sarge today :).


Kristian Erikson (8 years ago) Reply

Great guide. Helped me out too :)


FCV (8 years ago) Reply

Nice guide, thanks!

I am trying to package code from somebody else. ./configure && make works. But dh_make -s -e '' --createorig && dpkg-buildpackage fails :-(

It is building without some .c file so the linker fails.

Howto fix? Whats so different when using dpkg-buildpackage ?



stein (7 years ago) Reply

Cheers, this helped me compile scanner backend for my Asus eee Xandros system, had to use a separate Etch installation on an old machine.
Changes must always be expected with new software versions butt this little guide worked fine still (May 2010).


Anonymous (7 years ago) Reply


Helped me to back-port vlc to hardy today!


hik (7 years ago) Reply

As i m a newbie, i dont know what rule has to be added.

I got following error for "dpkg" command,
dpkg-buildpackage: warning: using a gain-root-command while being root
dpkg-buildpackage: set CFLAGS to default value: -g -O2
dpkg-buildpackage: set CPPFLAGS to default value:
dpkg-buildpackage: set LDFLAGS to default value: -Wl,-Bsymbolic-functions
dpkg-buildpackage: set FFLAGS to default value: -g -O2
dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
dpkg-buildpackage: source package zsync
dpkg-buildpackage: source version 0.9ubuntu1-1
dpkg-buildpackage: source changed by mathankumarb <>
dpkg-buildpackage: host architecture i386
fakeroot debian/rules clean
rm -f build-stamp configure-stamp
# Add here commands to clean up after the build process.
/usr/bin/make clean
make[1]: Entering directory `/tmp/zsync-0.9ubuntu1'
make[1]: *** No rule to make target `clean'. Stop.
make[1]: Leaving directory `/tmp/zsync-0.9ubuntu1'
make: *** [clean] Error 2
dpkg-buildpackage: failure: fakeroot debian/rules clean gave error exit status 2


creag (7 years ago) Reply


have u installed fakeroot. For me the above procedure is working fine. U might have missed something.


Soul (7 years ago) Reply

how to edit debian/control file??

it say Could not find <name>-<version>.orig.tar.gz at dh_make

does not work T.T


(6 years ago) Reply

dh_make version 0.55 or older may not work correctly if your source has two dotted-decimal points in the name. I downloaded dh_make 0.59 from and it worked fine.


Gen2ly (6 years ago) Reply

Very very helpful. Needed a little morale boost for my first deb, helped quite a bit. thank you.

Leave a comment