Updated: December 2, 2009
The best way to install applications in Linux is by using the package managers. It's the simplest, safest and most foolproof way of obtaining and maintaining the programs you need. You install them using a friendly and intuitive interface and you uninstall them using the same interface. The dependencies are automatically solved. The program revision is tracked. Whenever you can, use the package manager to get what you need.
There are many package managers available - and they come in two forms: the core utility, which is command-line and the front-end (GUI), which calls on the command-line tool to do the job. In openSUSE, you have the YaST/zypper combo, in Ubuntu, you have Synaptic/apt, in Fedora, you have Pirut/yum, and so forth.
But sometimes, the program you want will not be found in the repositories, even the extras ones like Medibuntu or RPMForge. You will have to download the sources and compile them and install your package manually.
The problem with this approach is that your manually installed programs will not be visible in your package manager. They won't show up, nor be available for upgrades or removal, creating a potential clutter/security issue for you, especially if there are many such programs you must use.
Luckily for you, there's a solution: a utility that can package the sources into installer files that your package manager will recognize and be able to catalog. This utility is called checkinstall.
Enter checkinstall
checkinstall works by functioning as a wrapper for your typical installation from sources. It will follow after the third stage in the configure, make, make install chain and keep track of every change made to the system. Once the installation is done, it will create a package compatible with your package management. checkinstall works with RPM, Debian and Slackware packages, covering a rather large install base.
OK, let's see this thing in action!
Install checkinstall
The first thing is: install checkinstall. A sort of a chicken and an egg problem. You should probably use your package manager to get checkinstall installed.
Install program from source
Your next step is to find the application you want to install, which is not found in the repositories. This is not an east task nowadays. I spent quite a bit of time hunting for a program that I want. Eventually, I settled for Guake, a Quake-like drop-down terminal utility. Please note that it DOES exist in the repositories, but it was a good choice as any.
So I started the usual chain, with configure and make ...
Please note that these two steps may fail, depending on the configuration of your system. Some of your libraries may be missing, outdated or too new for the sources you're trying to compile. Then, the sources themselves might be written badly, with errors and whatnot.
But assuming that everything went smoothly, your next step is to invoke checkinstall as root (or sudo):
checkinstall
A short wizard will guide you through the installation & package creation process. If the package documentation directory does not exist, it will ask you to create one.
You will then have the opportunity to write your own documentation:
Then comes the installation and the creation of the package. You can change the options if you like. Normally, I would not recommend changing any of the values unless you really know what you're doing.
And soon, you will have the program installed:
You can even check in your package manager now, to see whether the package is listed and installed as expected. Yup, there it is! Notice our very own documentation!
And the application in the menu:
From now on, the manually installed program is just like any other program. Your package manager will maintain it, sparing you the grueling manual work. Excellent!
Conclusion
checkinstall is a great addition to the Linux user's arsenal of handy tools, especially experienced users with peculiar taste for non-conventional installations of programs not readily available in the repositories. It allows you to easily keep track and order of all your applications, whether they come as package installers or from sources.
I hope you've enjoyed this short tutorial. Many thanks to Ocky for inspiring yet another article. Ocky, Inspirator Majorus. Thanks!
Cheers.