Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I would like to know how to create my own .deb packages from the source of a program without the aid of a package manager or any other similar tool (in other words, doing it manually). How difficult is this? Do I need to create my own repository for this to work? Do I need to sign it with my public key or something? Will one deb package work for all Debian-based distributions, or do I need to build a separate version for each flavor?

Edit: I would like to point out the main difference between my question and "Simplest Debian Packaging Guide?", which is that, while the asker of that question wishes to create a package with minimal time and effort, I want to go the long way around, not for the sake of making it harder, but because I want to understand how the packaging system works. In short, I want to learn.

share|improve this question
2  
if you're looking at making packages you need to know how to read the manual. that.is.all. –  hbdgaf Mar 8 '12 at 22:26
1  
Depends, do you want to package a binary for personal use , or learn to "do it right". See wiki.ubuntu.com/PackagingGuide/Complete –  bodhi.zazen Mar 8 '12 at 22:40
1  
@UriHerrera, my question is not quite a duplicate because I want to learn how to do it manually; that is, with as few tools and as much hands-on as possible. Simplest Debian Packaging Guide was a great link, but that question was about doing it the simplest and easiest way possible. –  InkBlend Mar 20 '12 at 17:39
add comment

2 Answers

How difficult is this?

Not so difficult at all. I do all my packaging from scratch. Once you know a few tools, and understand what's going on, the process is fairly simple. Be prepared to spend some time, learning the processes, though.

Do I need to create my own repository for this to work?

A repository (such as a PPA) is for publishing your package to the wider world. So, yes, if you want people to be able to install the package, either you need to get it included in Debian/Ubuntu, or you need to publish it in a repository.

PPAs also have access to the Launchpad build farm, so they can build binary packages from source packages. But you can do this locally, too. And while packaging something, you really want to be test-building locally, rather than waiting for LP to build your package (the LP build queues can be hours long).

Do I need to sign it with my public key or something?

If you want to upload to a PPA, you need to sign your source package with your private key.

Will one deb package work for all Debian-based distributions, or do I need to build a separate version for each flavour?

The safe answer is no. But sometimes it's fairly straightforward to produce once deb that will work on all current Debian and Ubuntu releases. It depends on the package and the toolchain you used.

I suggest:

share|improve this answer
add comment

InkBlend, there is an experimental project on launchpad that aims to make this easier for applications:

https://launchpad.net/pkgme

The goal of the project is for it to be very easy for any developer to be able to create a Debian source package from the metadata already included in your source build system.

There is an older program called dh_make, which should be included with the 'ubuntu-dev-tools' package, but it is less automatic at figuring out what to do with your source code.

Finally, this guide is excellent and will explain all of the aspect of packaging:

http://developer.ubuntu.com/packaging/html/

share|improve this answer
    
I think that you misunderstood my question. "without the aid of a package manager or any other tool (in other words, doing it manually)". Tools are nice and make thing easier, but in this case I would like to learn, and to get as much hands-on time as possible. –  InkBlend Feb 22 '13 at 2:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.