Simplest Way To Create A debian Package

Normal Debian packages get a proper source package, including a debian/rules file which automates the steps involved in creating the binary package. Here we just show how to package a simple shell script or binary executable into a small binary package.

One can find lots of examples of .deb files in ‘/var/cache/apt/archives/

Here is a simplest way to make a stand-alone Debian package:

First decide a name for package. Debian Packages have a particular format for their names.The code is:

Code:

<project>_<major version>.<minor version>-<package revision>

For Example, you can name your package as:

gurpinder@gurpinder:~$ firstt_1.0-1
 firstt_1.0-1: command not found 

Now create a directory for your package and it must have same name as that of your package.

gurpinder@gurpinder:~$ mkdir firstt_1.0-1

Now run following commands to put the files of your program where they would be installed to on a system.You can run these commands without sudo power.

gurpinder@gurpinder:~$ mkdir firstt_1.0-1/usr
gurpinder@gurpinder:~$ mkdir firstt_1.0-1/usr/local
gurpinder@gurpinder:~$ mkdir firstt_1.0-1/usr/local/bin
gurpinder@gurpinder:~$ cp "~/Projects/firstt/firstt" firstt_1.0-1/usr/local/bin

Now create a special metadata file with which the package manager will install it.

gurpinder@gurpinder:~$ mkdir firstt_1.0-1/DEBIAN
gurpinder@gurpinder:~$ gedit firstt_1.0-1/DEBIAN/control

Now put something like this in your file.

Package: firstt
Version: 1.0-1
Section: base
Priority: optional
Architecture: i386
Depends: libsomethingorrather (>= 1.2.13), anotherDependency (>= 1.2.6)
Maintainer: Your Name <you@email.com>
Description: Hello World
 Debian GNU/Linux is one of the most popular
 Linux distributions for personal and 
 Internet server machines

 (the space before each line in the description is important)

Now you just need to make the package like this:

gurpinder@gurpinder:~$ dpkg-deb --build firstt_1.0-1
Advertisements

One thought on “Simplest Way To Create A debian Package

  1. Pingback: Stellarium | Parbhdeep Kaur Dhillon

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s