Compdigitec Labs

« | Home | »

Building .deb packages on Ubuntu/Debian

By admin | July 28, 2008

Ever wanted to create your very own .deb packages for Ubuntu and Debian? Well, here’s a guide to tell you how in 10 easy steps!

  1. Create the directory to hold the package by using:
    mkdir package
  2. Change into the package directory:
    cd package/
  3. Make the package file system. For example, any files you put into the usr folder in this folder will go to /usr when installed. You can create them as necessary.
    mkdir usr
    mkdir usr/bin
    mkdir usr/lib
    mkdir etc
  4. Copy the application files to the appropriate directories; For example, if you want file FooBar.sh to be installed in /usr/bin, copy FooBar.sh to the usr/bin folder. Below is a demo, assuming no dependencies.
    cp /path/to/files/a.sh usr/bin
    cp /path/to/files/a.conf etc
    cp /path/to/files/liba-4.so usr/lib
  5. (required) Create the Debian control file. There is a specification file here: http://www.debian.org/doc/debian-policy/ch-controlfields.html
    touch DEBIAN/control
    editor-of-your-choice DEBIAN/control
  6. (optional) Create the postinstall file. This file is exectuted during the installation. Note that this file should be a shell script.
    touch DEBIAN/postinstall
    editor-of-your-choice DEBIAN/postinstall
  7. (optional) Create the prerm file. This file is executed during the removal of this package. Note that this file should be a shell script.
    touch DEBIAN/prerm
    editor-of-your-choice DEBIAN/prerm
  8. You’re almost ready to create the package! Change into the parent directory to begin.
    cd ..
  9. Now we can finally begin! This may take from 2 seconds to 24 hours, depending on the size of the package and the speed of your computer.
    dpkg-deb –build package
  10. You’re done! The package is package.deb. To install it:
    dpkg –install package.deb

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: Linux | 17 Comments »

17 Responses to “Building .deb packages on Ubuntu/Debian”

  1. Building Custom .deb Packages and Chroots « Edge Sentinel Says:
    August 25th, 2010 at 17:36

    […] file DEBIAN/control. The syntax is documented in the Ubuntu man pages and there are overviews at this site and in in the forums. With that documentation, all I really had to do was determine the […]

  2. Guns For Sale Online Says:
    March 25th, 2022 at 18:21

    … [Trackback]

    […] Here you will find 46610 additional Information to that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  3. good dumps with pin shop online Says:
    March 26th, 2022 at 14:44

    … [Trackback]

    […] Read More Info here on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  4. DevOps Strategy consulting Says:
    April 20th, 2022 at 13:21

    … [Trackback]

    […] Here you will find 6312 additional Info on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  5. sbo Says:
    April 30th, 2022 at 20:07

    … [Trackback]

    […] Read More on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  6. สล็อตวอเลท ไม่มีขั้นต่ำ Says:
    July 12th, 2022 at 19:36

    … [Trackback]

    […] Find More Information here to that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  7. sbobet Says:
    October 21st, 2022 at 06:47

    … [Trackback]

    […] Find More on on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  8. มังงะ Says:
    November 2nd, 2022 at 04:24

    … [Trackback]

    […] Find More here on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  9. view website Says:
    December 10th, 2022 at 18:15

    … [Trackback]

    […] Read More on on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  10. 토토휴게소 Says:
    December 21st, 2022 at 12:56

    … [Trackback]

    […] There you can find 74172 more Info to that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  11. Hidden Wiki Says:
    January 3rd, 2023 at 17:18

    … [Trackback]

    […] Here you can find 48205 additional Information on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  12. Chèque Says:
    January 5th, 2023 at 11:07

    … [Trackback]

    […] Read More here on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  13. Champion 4500-Watt Portable Dual Fuel Inverter Generator Says:
    January 26th, 2023 at 14:50

    … [Trackback]

    […] Read More on on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  14. yabo Says:
    February 4th, 2023 at 19:03

    … [Trackback]

    […] Read More Information here to that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  15. my site Says:
    February 26th, 2023 at 02:58

    … [Trackback]

    […] There you can find 18853 more Information on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  16. check that Says:
    February 27th, 2023 at 07:55

    … [Trackback]

    […] Information to that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

  17. weed delivery toronto Says:
    March 16th, 2023 at 10:17

    … [Trackback]

    […] Info to that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]

Comments