Creating Debian Packages from Source with Checkinstall

With APT package installation in Debian is really easy. But sometimes you simply can’t avoid to install a package from source probably because there is no *.deb package available, it is outdated or you would like to compile it with specific compiler options.

This causes some problems because when you install packages from source the package management software doesn’t know about them and therefore you can’t really upgrade or remove them in a smooth way. The usual approach to this problem is to install all packages in /usr/local, but it actually doesn’t really solve the problem either. If you install lots of such packages, you will almost certainly end up with a mess.

Here comes checkinstall in, it will observe all modification to the system during package installation and then create a distribution specific package which can be installed as usual.

Below is an usage example, the -D options tells checkinstall to create a Debian package. See the documentation for more options.

configure --prefix=/usr
checkinstall -D

Instead of make install you just type checkinstall or if the build command differs

checkinstall -D make install_command_or_whatever

Checkinstall will ask you a few question and then create and install a regular *.deb file which means that the package is now fully integrated into the package management system and can be removed as usual with apt or dpkg.