Using Checkinstall To Build Packages From Source
Checkinstall is a utility that builds a .deb, .rpm or Slackware package from a third party source code tarball. This allows you to introduce such third party software using the standard package management features of your distribution. In contrast, the conventional instructions for installing such software packages puts your package manager out of sync with the actual collection of software installed on your Linux box.
This short tutorial presumes that you're using a Debian-derived distribution such as Ubuntu, although it should work with most distributions. It also presumes that you have some prior experience of building a package from the source code.
For most users, the preferred method of adding software to a Linux system is by using a package manager. Package management is very reliable these days, and apart from anything else, it offers an advantage that Linux systems enjoy. However, what do you do when a package that you need isn't in the repository of your chosen distribution, or it is in there but it's an old version? In such cases, there is often nothing else for it but to build from source.
Building from source is a reasonably simple process, but it brings with it a few problems. For a start, you're circumventing the package manager, and this puts its internal database out of sync with the software installed on your computer. You can even end up with two versions of an application installed simultaneously which can cause all sorts of problems.
Thankfully, there is a tool called Checkinstall that is designed to sort out this mess. Checkinstall takes a compiled source code tarball and turns it into a Debian, Slackware or RPM package that you can install “officially” via the package management tools. Furthermore, you can distribute the finished package so that other people can install it without having to build from the source code. Best of all, it's very easy to use if you already know how to build packages from the source. Checkinstall is not included by default in some distributions, so you might have to search for it and install it via the package manager.
The normal process for building a package from source is begun by, having first downloaded and unpacked the source code from the maintainer's website, navigating to the the source code directory and typing:
Once the configuration process has completed, you then type:
which builds the source code, followed by:
sudo make install
which installs the package. However, the official instructions typically encourage you to circumvent the advantages of a package manager, and this is the part that causes the problem . Instead of invoking “sudo make install” type:
Checkinstall will begin the process of creating a .deb package (in the case of a Debian style system) and installing it. Before carrying out the actual build you'll be asked a series of questions. If you merely want to build a package to add to your own system, you can safely accept the default answers. However, if you intend to distribute the finished package, it's a good idea to fill in some of the fields such as your contact details and any other important notes.
It's worth noting that, as with most command line tools that install packages, you must make sure that no other package management tools are running when you run Checkinstall. If you merely want to create the .deb without carrying out the installation, use the command line switch
sudo checkinstall --install=no
Creating an Ubuntu package for Beebem, a BBC Micro emulator
I wonder if I'm the only one who thinks that Checkinstall should be more prominently featured in most distributions, perhaps with a GUI front end of some sort?
The Checkinstall website.
UK based freelance writer Michael Reed writes about technology, retro computing, geek culture and gender politics.
- One Port to Rule Them All!
- Privacy Is Personal
- PHP for Non-Developers
- Secure Server Deployments in Hostile Territory
- Linux Kernel 4.1 Released
- Django Templates
- July 2015 Issue of Linux Journal: Mobile
- A Code Boot Camp for Underprivileged Kids
- Practical Books for the Most Technical People on the Planet
- The AtoMiC Toolkit!