Easy Package Creation with CheckInstall

2935

Need a fast way to create a Debian Package, RPM or Slackware package? If you need to install software from source, but don’t want to take the time to learn how to create packages, there’s an easier way. CheckInstall is your fast ticket to installable packages.

The bad old days, when you had to compile lots of packages from source, are done and over. But you’ll still find occasions when it’s necessary to compile from source. When you do, it’s better to create a native package to install on your system than to just use make install. This makes it easier to manage the software and to uninstall it at a later date.

But creating packages isn’t trivial, and if you’re not adept at creating native packages (RPMs, Debian Packages or Slackware pkg) then who has the time to do all that? CheckInstall cuts out the hassle and automates package creation.

Why Use CheckInstall?

CheckInstall is good for two scenarios. One, it’s great for installing from source when you don’t have a native package handy. Why not just use make install? Because that doesn’t allow you to easily manage the software at a later date. For example, what if I want to try the brand new GNOME presentation app Glide? Right now, it’s only available by pulling source code from a Git repository.

But it’s in early development, and there’s a good chance I’ll want to install later versions when they’re released. Using make install rather than installing from a package means I won’t be able to easily upgrade later.

The other reason? Let’s say you have 50 Ubuntu servers and want to install the same software on all 50 that you’ve packaged from source. Want to compile and install that software on 50 servers, or would you rather just install from a package? I’d much rather have an RPM or Debian Package to install than compile from source 50 times.

Do not use CheckInstall to create packages for widespread distribution. It’s not meant to create packages to ship with distros or to be used by projects to supply packages. Want to get your software into Debian, Fedora, openSUSE, Ubuntu, and others? Work with the distributions to get your package into the repos. If you want to package for multiple distros and supply packages yourself, look at the openSUSE Build Service. You still need to understand packaging, but you can build for most major distributions from there.

Getting CheckInstall

CheckInstall is packaged for several major distributions. It’s available in the repositories for Debian, openSUSE, Ubuntu, and others. It isn’t packaged for Fedora, though, so you may need to compile from source for Fedora. The project seemed defunct for a while, but the most recent release came out in December of last year. I do hope that the project will continue to be kept up, because it’s terribly handy.

To install CheckInstall, just look for the checkinstall package in your distribution. On Ubuntu or Debian run sudo aptitude install checkinstall; on openSUSE run sudo zypper install checkinstall. Note that you might need other libraries or packages to compile software as well.

Using CheckInstall

Now that you’ve got CheckInstall set up, it’s time to give it a test.

Most software is compiled using ./configure; make; make install. You’ll still need to go through the ./configure and make steps.

After that, run sudo checkinstall instead. CheckInstall will go through the make install steps and then give you a few questions. You’ll see output similar to this:

 

*****************************************
**** Debian package creation selected ***
*****************************************

This package will be built according to these values: 

0 -  Maintainer: [ root@ubuntu ]
1 -  Summary: [ Red Notebook test pkg ]
2 -  Name:    [ rednotebook ]
3 -  Version: [ 0.9.4 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ rednotebook-0.9.4 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ rednotebook ]
Enter a number to change any of them or press ENTER to continue:

If you want to change any of those settings, just enter the number for the value you wish to change. You’ll answer a few more questions about excluding files from the build directory and it’s OK to do this. Then CheckInstall will tell you where the package has been saved to. It will also install the package by default. If for some reason you don’t want to install the package on the same system you’re compiling it on, you can use the –install option:

sudo checkinstall –install=no

This will just create a package and tell you where it was saved.

Python is becoming an increasingly popular language to write desktop software these days. And you’ll usually find that the install instructions for a Python app are to run python setup.py install rather than the familiar ./configure; make; make install steps.

You can also use CheckInstall with Perl modules by running sudo checkinstall after running make and make test; though, it has been a while since I needed to install Perl modules from source.

Happy Packaging

That should help get you started. See the checkinstall man page for further options, if you need more control over the packaging process. CheckInstall may not work with every type of package, but it will handle the bulk of software you might want to compile from source. It’s a really useful utility that I’ve been using for many years and it’s served me well every time.