Better Linux Package Management with Checkinstall

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.

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

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.

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.

checkinstall-docpak

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

checkinstall-description

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.

checkinstall-finished

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.

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.

5 comments

  1. Hi, this is a great tutorial. However, I had a problem I'd like to mention.

    When I did this with python, the example you gave, everything went well until I opened synaptic. Upon doing so, I was informed that I had 200 something broken packages. When I filtered based on broken packages, I discovered that every one of those packages depended on “python” which also happens to be the name that checkinstall uses when it turns python3.1.1 into a package. So, all of my programs were expecting 2.6.4 of python but they were seeing 3.1.1.

    To fix it, I had to lock python at 2.6.4 in synaptic and force a downgrade. After that, I ran checkinstall again and renamed the 3.1.1 packages to python3.1.1 instead of just python as it defaults to.

    Again, great article. I just wanted to throw this in there so no one else encounters this and flips out.

Comments are closed.

Sponsored Stories