If you use Linux in any depth, you’re eventually have to install a program from source code. Normally the process is pretty quick and painless, but it still has some drawbacks, especially when it comes to upgrading or uninstalling that program. To help resolve this, we’ve got checkinstall, a useful tool that adds some cleverness to the process by keeping track of file changes and generating binary packages from your tarballs. With checkinstall, you can generate a RPM, deb, or Slackware package that can be ported between systems for easy install and removal.

Getting checkinstall

Ubuntu users can install by clicking here or using your normal package manager. Others can download the tarball from the checkinstall website.

How it Works

Essentially, checkinstall replaces the make install portion of a normal source code installation. If you’re unfamiliar with installing from source code in Linux, check out this guide to get the basics. The rest of this guide will assume basic familiarity of the normal config/make/install process.

Once you’ve run configure (if necessary) and make, you’d normally run make install to complete the process. Now you’d run checkinstall instead, and it would take over the rest. It will record all the files that would be used by make install and build the proper type of package for your system, so that the existing package manager (apt, yum, etc) can handle upgrades and removals.

Running Checkinstall

For this example, we’ll be using checkinstall to install Python from a source tarball. To follow along, you can download the same tarball here. Once extracted to your target location, open that location in your terminal. Run the normal two steps to start the build

And here is where checkinstall comes in. Instead of make install we’re using

If this is the first time checkinstall has been run in this directory, it’ll start by asking if you want to create a directory to hold some documentation that may be needed for packaging later. Accept the default of Yes and continue.

Next you’ll be asked for a description. This is what will be seen in places like the Summary field when showing package info.

Finally, you’ll get the last screen confirming all of your package’s details. One important aspect of this screen is that you can set dependencies for your package. For more details on that, see this Debian guide.

Make note of the location of the package generated by checkinstall. It has been installed, but the package file could come in handy to reinstall later, bring to another computer, or share online.

Options for Checkinstall

Not everything can be covered by defaults, so of course checkinstall comes with a full set of options. Some of the more useful include:

Full details are of course available with the --help option or man page.