There are several ways of making a Debian package. In this article you will learn how to create it using equivs tools, to create a simple package (for example, as when you want to package a binary). Without more ado let’s see the procedure:
You will need to install the tools to use, in particular:
aptitude install equivs
As an example you will be packaging two scripts and an cron job in a .deb file. These are the steps:
- Create the template. To do so use the **equivs-control command, which generates a base file that you can edit later by removing the comments to the options you want to use. To generate the template use this command:
$ equivs-control backups
- Edit the template, which in this example was called backups. Fill in with the needed data for creating the package by removing the comment in the fields you want to edit:
### Commented entries have reasonable defaults. ### Uncomment to edit them. # Source: Section: miscD Priority: optional Homepage: www.lgallardo.com Standards-Version: 3.9.2 Package: backups Version: 1.1 Maintainer: Luis M. Gallardo D. <email@example.com>; # Pre-Depends: # Depends: # Recommends: # Suggests: # Provides: # Replaces: Architecture: all # Copyright: # Changelog: Readme: README.Debian # Extra-Files: Files: backup.sh /usr/local/bin/ restore.sh /usr/local/bin/ backups-cron /etc/cron.d/ Description: Backups scripts Scripts for backuping up files on Debian systems
Before you build thee package you must create the files backup.sh, restore.sh, backups-cron and README.debian, the latter to avoid equivs to use the generic README.
- Build the package. Just write this command:
This will build a package called backups_1.1_all.deb. In order to check the package’s info you can type the following:
$ dpkg -I backups_1.1_all.deb new debian package, version 2.0. size 2396 bytes: control archive=582 bytes. 25 bytes, 1 lines conffiles 302 bytes, 12 lines control 322 bytes, 5 lines md5sums Package: backups Version: 1.1 Architecture: all Maintainer: Luis M. Gallardo D. <firstname.lastname@example.org>; Architecture: all Readme: README.debian Installed-Size: 42 Section: misc Priority: optional Homepage: www.lgallardo.com Description: Backups scripts Scripts for backuping up files on Debian systems
That’s it. You have build your first Debian package!