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

  • 4
    Do you want to create packages for your own use, on a specific computer, or for others to use?
    – andol
    Aug 6, 2010 at 5:49
  • 2
    Which language is the software you'd like to package?
    – Umang
    Aug 6, 2010 at 6:07
  • 8
    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) Nov 13, 2015 at 15:38
  • 3
    I'll go for the one I posted over StackOVerflow.
    – user438925
    Nov 17, 2015 at 5:52
  • If you want to create "virtual packages" (group dependencies together), it is worth taking a look at equivs-build
    – Rolf
    Jun 13, 2019 at 17:08

7 Answers 7


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)

  • 1
    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, 2017 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, 2014 at 0:15
  • 17
    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. Nov 13, 2015 at 15:40
  • @JohnLittle this answer may be of assistance: askubuntu.com/a/27731/5 Nov 13, 2015 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, 2017 at 18:28
  • If the user has no GPG key, debuild will fail with "debsign: gpg error occurred! Aborting....".
    – agc
    Dec 15, 2017 at 16:04

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

Here's a nice tutorial from Ubuntuforums.


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:


    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.

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). Aug 6, 2010 at 20:14
  • OH man.. I had to use that BEFORE compiling.. that's like hours of compiling.
    – Piotr Kula
    Feb 20, 2015 at 23:57

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

Packaging Java Applications for Ubuntu and Other Debian's

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.

  • 3
    "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, 2013 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, 2015 at 1:05

Based on the accepted answer, I have made a Python script that will create a helloworld_1.0-1.deb package following this tutorial. You can modify it for your package.

Copy the script and run it with Python 3: python3 create_debian_package.py

#!/usr/bin/env python3
This script is going to create a debian package
import os

print('This script is going to create a debian package')

include_hello_world_script = True # Set to False to manually copy your files and remove helloworld program
package_name = 'helloworld'
major_version = 1
minor_version = 0
package_revision = 1
section = 'base'
priority = ''
architecture = 'i386' #Change to armhf for Raspberry Pi
depends = '' #For example: libsomethingorrather (>= 1.2.13), anotherDependency (>= 1.2.6)
maintainer = 'Your Name <[email protected]>'
#The space before each line in the description is important
package_description = """Hello World
 When you need some sunshine, just run this
 small program!

version_name = str(major_version) + '.' + str(minor_version) + '-' + str(package_revision)
full_package_name = package_name + '_' + version_name
path = os.getcwd()
package_folder = os.path.join(path, full_package_name)
os.makedirs(package_folder, exist_ok=True)
os.makedirs(os.path.join(package_folder, 'DEBIAN'), exist_ok=True)
with open(os.path.join(package_folder, 'DEBIAN', 'control'), 'w') as file:
    file.write("""Package: """ + package_name + """
Version: """ + version_name + """
Section: """ + section + """
Priority: """ + priority + """
Architecture: """ + architecture + """
Depends: """ + depends + """
Maintainer: """ + maintainer + """
Description: """ + package_description)

if include_hello_world_script:
    script_destination = os.path.join(package_folder, 'usr/local/bin')
    os.makedirs(script_destination, exist_ok=True)
    helloworld_filename = os.path.join(script_destination, 'helloworld')
    with open(helloworld_filename, 'w') as file:
        file.write("""#!/usr/bin/env python3
print('Hello World!')""")
    os.chmod(helloworld_filename, 0o755)

input("Put your files in the package structure and press Enter to continue...")
os.system('dpkg-deb --build ' + full_package_name)

You must log in to answer this question.

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