I went to the Ubuntu wiki but got confused,there were too many ways. Please tell me an easy guide to Debian packaging.

  • 2
    Do you want to create packages for your own use, on a specific computer, or for others to use? – andol Aug 6 '10 at 5:49
  • 1
    Which language is the software you'd like to package? – Umang Aug 6 '10 at 6:07
  • 3
    I have the same issue. Most of the tutorials and guides start with "get the upstream tarball". From this point on we are lost. We have a simple thing we want to deploy, there is no upstream tarball, there is no source code. its just a war file, some scripts, and some jar files. What is the upstream tar ball all about, and has anyone seen a guide NOT using one, which is comprehensive(e.g. deals with the issues of users) – John Little Nov 13 '15 at 15:38
  • 1
    I'll go for the one I posted over StackOVerflow. – rsm Nov 17 '15 at 5:52
up vote 91 down vote accepted

This is a good HOWTO for creating a basic .deb file. It is suitable for creating .deb files for personal use but not stringent enough if you want to the package to be included in Debian / Ubuntu - for that you should read the Debian New Maintainer's Guide and/or the Ubuntu Packaging Guide (which I believe you've already tried).

A good tool for checking your .deb file for compliance is lintian (installable from the repositories).

There were two sessions here in the Ask Ubuntu chatrooms.

The Basics of Packaging on Ubuntu (Packaging: Part 1)

Ubuntu Packaging for Launchpad PPAs (Packaging: Part 2)

  • This nicely compiles what is needed to start with packaging, but in the HOWTO I miss information to include the application icon in the deb file (and haven't found anything about that elsewhere). Any hint on how to do it? – nightcod3r Jul 3 '17 at 7:48

What parts are you having trouble with? Although complicated, the guide seemed quite clear when I was following it.

Quick Summary:

  • Extract source .tar.gz
  • Run dh_make
  • Edit debian files
  • Run debuild
  • 3
    What confused me is, is this process the same no matter the source language or directory structure? – Seth Sep 26 '14 at 0:15
  • 7
    The crux is, we dont have a .tar.gz. we want to package an app we wrote. No guide seems to cover this, they all start with an "upstream tarball" which we dont have. – John Little Nov 13 '15 at 15:40
  • @JohnLittle this answer may be of assistance: askubuntu.com/a/27731/5 – Nathan Osman Nov 13 '15 at 18:25
  • 1
    What about long-term, repeated packaging? Do I have to every-time do such long and complicated packaging process? – kravemir Aug 13 '17 at 18:28
  • If the user has no GPG key, debuild will fail with "debsign: gpg error occurred! Aborting....". – agc Dec 15 '17 at 16:04

You can even use dpkg-deb for creating simple packages.

Here's a nice tutorial from Ubuntuforums.

The very easiest way to package something is to use checkinstall.

  • 4
    checkinstall provides a quick way to build debin binary package(.deb ) from a source install method. However it does not provide a proper debian package (built from a debian source package). – João Pinto Aug 6 '10 at 20:14
  • OH man.. I had to use that BEFORE compiling.. that's like hours of compiling. – ppumkin Feb 20 '15 at 23:57

Originally posted on StackOverFlow, this guide is for pre-compiled or interpreted software:

The right way of building a deb package is using dpkg-buildpackage but sometimes it is a little bit complicated. Instead you can use dpkg -b <folder> and it will create your Debian package.

These are the basics for creating a Debian package with dpkg -b <folder> with any binary or with any kind of script that runs automatically without needing manual compilation (Python, Bash, Pearl, Ruby):

  1. Create the files and folders in order to recreate the following structure:

    ProgramName-Version/
    ProgramName-Version/DEBIAN
    ProgramName-Version/DEBIAN/control
    ProgramName-Version/usr/
    ProgramName-Version/usr/bin/
    ProgramName-Version/usr/bin/your_script
    

    The scripts placed at /usr/bin/ are directly called from the terminal, note that I didn't add an extension to the script. Also you can notice that the structure of the deb package will be the structure of the program once it's installed. So if you follow this logic if your program has a single file, you can directly place it under ProgramName-Version/usr/bin/your_script, but if you have multiple files, you should place them under ProgramName-Version/usr/share/ProgramName/all your files and place only one file under /usr/bin/ that will call your scripts from /usr/share/ProgramName/

  2. Change all the folder permissions to root:

     chown root:root -R /path/to/ProgramName-Version  
    
  3. Change the script's permissions:

     chmod 0755 /path/to/the/script
    
  4. Finally, you can run: dpkg -b /path/to/the/ProgramName-Version and your deb package will be created! (You can also add the post/pre inst scripts and everything you want, it works like a normal Debian package)

Here is an example of the control file. You only need to copy/paste it in to an empty file called "control" and put it in the DEBIAN folder.

Package: ProgramName
Version: VERSION
Architecture: all
Maintainer: YOUR NAME <EMAIL>
Depends: python2.7, etc , etc,
Installed-Size: in_kb
Homepage: http://foo.com
Description: Here you can put a one line description.This is the short Description.
 Here you put the long description, indented by 1 space.

No, the simplest and clearest packaging guide in this world is

http://blog.noizeramp.com/2005/08/31/packaging-java-applications-for-ubuntu-and-other-debians/.

Few days ago, for my first application, I created DEB package by following this tutorial. Very clear and my app packaged succesfully. Yes, at least it is simplest for me.

You can compare it with Debian Packaging Guide.

  • 2
    "Simple" does not mean "complete". There's a lot of policies a basic .deb packaging tutorial will not cover for different types of programs, and therefore packaging is not as easy as just a "simple tutorial". – Thomas Ward Jul 7 '13 at 2:54
  • definitely simple. It got me started and I was able to create my first debian package within minutes. Still a lot of details to deal with (bad package quality messsages from lintian) but great starting point. – atmelino Nov 22 '15 at 1:05

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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