Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Debian This forum is for the discussion of Debian Linux.


  Search this Thread
Old 10-31-2008, 09:59 PM   #1
Senior Member
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Rep: Reputation: 50
build a debian package deb from tar.bz2


howto build a debian package deb from tar.bz2 ?
Old 10-31-2008, 10:52 PM   #2
Senior Member
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Well, if it's installed as a 'debian source' package, the debian build scripts will take care of everything. Otherwise you need to build the software to install to a local directory (but with internals set to look in all the right places for config files and so on), create your own control files, pre/post-install/remove and so on and ask the packaging tools to put everything together. Depending on your skill level it may take a bit of getting used to, so I'd suggest:

1. Create packages which only install a single file in some simple place like '/tmp' - make sure your install and remove scripts work well.

2. Install the debian-source for a relatively simple package (let's say 'pppd') and have a good look at the various debian packaging files that come with it. Make sure you can understand what those files are doing.

3. Go ahead and build your software and create the debian packaging files then create a useful *.deb package (as opposed to what was done in (1) which is only to get comfortable using the tools).

Have a look at this article on TLDP:
Old 11-07-2008, 01:33 PM   #3
Registered: Dec 2003
Location: ~root
Distribution: Debian
Posts: 363

Rep: Reputation: 33
Or, you may be able to use the "checkinstall" package.

Install checkinstall,

apt-get update
apt-get install checkinstall
Then, configure your installation as you would normally do:

checkinstall -D make install
This will create a deb package for you and install it.
Old 11-08-2008, 08:44 AM   #4
Senior Member
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 50
thx a lot !
Old 11-11-2008, 06:42 AM   #5
Registered: Oct 2006
Distribution: Debian x64
Posts: 198

Rep: Reputation: 30
I used to prefer using Dh_make to make .debs. It seemed to work better.
$ tar -xvf foo.tar.bz2
$ mkdir foo_002
$ cp -rv ./foo/* ./foo_002/
$ cd foo_002
$ su 
# aptitude install autotools-dev fakeroot dh-make build-essential
# dh_make --createorig
# dpkg-buildpackage -rfakeroot
# dpkg --install foo_09090.deb
But lately I've had more success with checkinstall.
Old 11-11-2008, 11:51 AM   #6
Senior Member
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Original Poster
Rep: Reputation: 50
thousand thx !
Old 09-17-2009, 03:44 PM   #7
LQ Newbie
Registered: Sep 2009
Posts: 1

Rep: Reputation: 0
hi donnied,

I tried using your method and all went well until

# dpkg-buildpackage -rfakeroot
the only change i made was foo_002 too foo-002 for the "# dh_make --createorig" line too work.

at this point this is my terminal output:
Debian-comp:/home/phr0663r/install/foo-002# dpkg-buildpackage -rfakeroot
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: 
dpkg-buildpackage: set FFLAGS to default value: -g -O2
dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
dpkg-buildpackage: source package foo
dpkg-buildpackage: source version 002-1
dpkg-buildpackage: source changed by root <>
dpkg-buildpackage: host architecture amd64
 fakeroot debian/rules clean
rm -f build-arch-stamp build-indep-stamp configure-stamp
# Add here commands to clean up after the build process.
#/usr/bin/make clean
dh_clean  --exclude ./src/md-eval/test/md_test25.output.orig
 dpkg-source -b foo-002
dpkg-source: info: using source format `1.0'
dpkg-source: info: building foo in foo_002.orig.tar.gz
dpkg-source: info: building foo in foo_002-1.diff.gz
dpkg-source: info: building foo in foo_002-1.dsc
 debian/rules build
# Add here commands to configure the package.
touch configure-stamp
# Add here commands to compile the arch part of the package.
touch build-arch-stamp
# Add here commands to compile the indep part of the package.
#/usr/bin/make doc
touch build-indep-stamp
 fakeroot debian/rules binary
dh_clean -k -s  --exclude ./src/md-eval/test/md_test25.output.orig
dh_installdirs -s
# Add here commands to install the arch part of the package into
# debian/tmp.
/usr/bin/make DESTDIR=/home/phr0663r/install/foo-002/debian/foo install
make[1]: Entering directory `/home/phr0663r/install/foo-002'
(mkdir -p bin)
(cd src; make install)
make[2]: Entering directory `/home/phr0663r/install/foo-002/src'
(cd asclite; make install)
make[3]: Entering directory `/home/phr0663r/install/foo-002/src/asclite'
(cd core; make install)
make[4]: Entering directory `/home/phr0663r/install/foo-002/src/asclite/core'
make[4]: *** No rule to make target `install'.  Stop.
make[4]: Leaving directory `/home/phr0663r/install/foo-002/src/asclite/core'
make[3]: *** [install] Error 2
make[3]: Leaving directory `/home/phr0663r/install/foo-002/src/asclite'
make[2]: *** [install] Error 2
make[2]: Leaving directory `/home/phr0663r/install/foo-002/src'
make[1]: *** [install] Error 2
make[1]: Leaving directory `/home/phr0663r/install/foo-002'
make: *** [install-arch] Error 2
dpkg-buildpackage: failure: fakeroot debian/rules binary gave error exit status 2
I'm not sure what is wrong here! any help would be nice!
other things that may help are that i'm running debian lenny

Last edited by phr0663r; 09-17-2009 at 03:46 PM.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
update .deb package list debian etch rotezecke Linux - Newbie 1 04-02-2008 07:10 AM
How to install ntfs-3g.tar.bz2 Slackware package spiffytech Slackware 6 07-11-2007 11:12 PM
Installing any .tar .bz2 or .deb smcsw2000 Linux - Software 2 06-13-2007 06:52 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
Possible to build deb package from source files? davidas Debian 9 12-09-2006 06:27 PM

All times are GMT -5. The time now is 08:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration