I went to the Ubuntu wiki but got confused,there were too many ways. Please tell me an easy guide to Debian packaging.
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.
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.
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):
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 filesand place only one file under
/usr/bin/that will call your scripts from
Change all the folder permissions to root:
chown root:root -R /path/to/ProgramName-Version
Change the script's permissions:
chmod 0755 /path/to/the/script
Finally, you can run:
dpkg -b /path/to/the/ProgramName-Versionand 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
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.