Saturday, July 18, 2009

Creating your own ubuntu packages with checkinstall

Checkinstall is a beautiful program which lets you create your own debs or rpms. This program is available in the Ubuntu universe repository. Using it you can quickly build your own ubuntu packages from source code.
You can install it on Ubuntu 9.04 as below.

$ sudo apt-get install checkinstall

Now download the source package of the program you want to convert to a deb.

Let us take CenterIM , a text mode IM client.
Download the source.
$wget t http://www.centerim.org/download/mobshots/centerim-4.22.7-36-g6ba0.tar.gz

Untar the archive

$ tar -xzvf centerim-4.22.7-36-g6ba0.tar.gz

Try to compile the code.

$ cd centerim-4.22.7-36-g6ba0

Run the configure script to create makefile.

$ ./configure

Now invoke checkinstall.

$ sudo checkinstall -D --install=no

( checkinstall needs root access)

If some of the required directories such as doc--pack is not available it will prompt you to create them and finally show the following screen.


*****************************************
**** Debian package creation selected ***
*****************************************

This package will be built according to these values:

0 - Maintainer: [ fermi@unixlab.blogspot]
1 - Summary: [ Centrim new package ]
2 - Name: [ centerim-4.22.7-36 ]
3 - Version: [ g6ba0 ]
4 - Release: [ 1 ]
5 - License: [ GPL ]
6 - Group: [ Applications/System ]
7 - Architecture: [ i386 ]
8 - Source location: [ centerim-4.22.7-36-g6ba0 ]
9 - Alternate source location: [ ]
10 - Requires: [ ,/bin/sh ]
11 - Provides: [ centerim-4.22.7-36 ]

Enter a number to change any of them or press ENTER to continue:

You can edit the above details as you require and finally press ENTER

Checkinstall will compile and make a debian package for you. It can fail during compilation if the libraries need for compiling the program that you are trying to build is not installed.

You can also create other packages for redhat or slackware based systems. The man pages of checkinstall list lot of options. Have a look at it.

2 comments:

Anonymous said...

it is sudo apt-get install checkinstall
not sudo apt-get checkinstall

Fermi Level said...

Corrected. Thanks Anonymous