« Install Roadsend PHP Compiler on Ubuntu – without compiling anything! | Home | Using dpkg in Ubuntu and Debian »
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!
- Create the directory to hold the package by using:
mkdir package - Change into the package directory:
cd package/ - 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 - 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 - (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 - (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 - (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 - You’re almost ready to create the package! Change into the parent directory to begin.
cd .. - 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 - 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 | 8 Comments »
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 […]
June 29th, 2024 at 05:05
… [Trackback]
[…] Find More on on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]
July 3rd, 2024 at 18:49
… [Trackback]
[…] Info to that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]
July 17th, 2024 at 21:27
… [Trackback]
[…] Find More to that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]
July 20th, 2024 at 21:42
… [Trackback]
[…] Find More on to that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]
July 22nd, 2024 at 20:21
… [Trackback]
[…] Find More Information here to that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]
August 16th, 2024 at 20:38
… [Trackback]
[…] Information on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]
September 11th, 2024 at 21:27
… [Trackback]
[…] Find More Info here on that Topic: compdigitec.com/labs/2008/07/28/building-deb-packages-on-ubuntudebian/ […]