Saturday, October 10, 2009

Build Linux installer packages with checkinstall

Compiling from source code is not my preferred way of installing software. One of the wonderful things about Linux is the ability to use prebuilt packages available through the software repositories. However, in the event that a particular software package in not available in a repository or you want a custom build of one, compiling from source may be the only way to go. Compiling from source carries with it the inherent problem that the package manager won't know the software package in question is installed. This can result in an update that breaks the program you installed from source. The way to alleviate this concern is with checkinstall, a convenient tool used to build installer packages for your distribution.

First, make sure you have checkinstall and your development tools installed. Use this command to install them in Ubuntu:
$ sudo aptitude update && sudo aptitude -y install build-essential checkinstall
Now there is where it gets a bit tricky. You will have to follow the build instructions that accompany the code you want to compile. Some times this is easy and sometimes it is difficult. Sometimes the process is very straightforward, like this:
$ ./configure
$ make
Usually the next step here would be to use make install to install the newly compiled code. Instead, run this command:
$ sudo checkinstall
If you want you can work through the options to document the installer package. Now you can install the new installer package using the package manager:
$ sudo dpkg -i [filename].deb
Now the package manager will be aware of the code you just installed.

No comments:

Post a Comment