The Problem

Although I don’t mind compiling software from source, I always prefer to use my distro’s package repositories if possible. It’s just easier that way and updates get taken care of behind the scenes.

As I use Debian stable, I sometimes need to get dirty and compile something myself. The problem is, I have had to do the same process on all five of my servers. Here are two examples:

I use Alpine on all of my servers, primarily to receive patches for Python services. If you want to use the Maildir format with Alpine, you’ll need to apply a patch to the source tree. Then it’s the usual

$ ./configure
$ make
$ sudo make install

If any dependencies are missing the configure script will alert you. Once you have everything installed, things should be plain sailing.

The problem with this workflow is that you need to repeat the process on each machine. So, I set about looking into creating .deb packages directly to make things easier.

However, the problem with this solution, is that it’s not exactly quick. Plus you need lots of files correctly populated in the debian subdirectory (see link at bottom of page about Debian packaging).

Well, I’m lazy and thought there must be an easy way to get this **** done! Well there is and it’s been around forever: CheckInstall.

A lot of people has asked me how can they remove from their boxes a program they compiled and installed from source. Some times – very few – the program’s author adds an “uninstall” rule to the Makefile, but that’s not usually the case. That’s my primary reason to write checkinstall. After you ./configure;make your program, It will run “make install” (or whatever you tell it to run) and keep track of every file modified by this installation, using the excellent installwatch utility written by Pancrazio ‘Ezio’ de Mauro

.

Well, that’s exactly what I’m after mate! Now the new workflow is:

$ ./configure
$ make
$ sudo checkinstall

This will launch an interactive script asking for certain information about this package. You’ll end up with the package being installed on your system, plus a .deb in the source directory. If you ever need to remove the package you just run

$ sudo dpkg -r <package_name>

Copy the .deb to another machine and run

$ sudo dpkg -i <package_name>

I think I’ll use this method from now on for installing anything from source.

Further Reading

Debian CheckInstall Reference
Ubuntu CheckInstall Reference
Debian Packaging