Linux users often install software packages by compiling from source. However, the Makefile doesn’t always come with a standard uninstall directive to remove the installed files using make uninstall . How do you feel when you find there is no way to clean up after installing the package for a test run? CheckInstall is a tool to address this problem.

CheckInstall tracks the file modifications done by make install or any other command you run. Post the installation phase, CheckInstall generates a native package for your distribution which you can use like any other package, even install it later. Currently Slack, RPM or Debian compatible packages can be generated.

To install CheckInstall on Ubuntu, run:

$ sudo apt-get install checkinstall

In this article we will explore the regular use of the CheckInstall utility. I am on Ubuntu and using the sysdig package source for the examples. CheckInstall has many other options. To take a look, run:

$ checkinstall --help

I am already done with the ./configure and make stages with sysdig the source. To use CheckInstall, I replace make install with checkinstall. Output from the terminal:

$ sudo checkinstall -t debian checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran This software is released under the GNU GPL. The package documentation directory ./doc-pak does not exist. Should I create a default set of package docs? [y]: n Please write a description for the package. End your description with an empty line or EOF. >> sysdig-test >> ***************************************** **** Debian package creation selected *** ***************************************** This package will be built according to these values: 0 - Maintainer: [ root@Tux ] 1 - Summary: [ sysdig-test ] 2 - Name: [ build ] 3 - Version: [ 20150517 ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ checkinstall ] 7 - Architecture: [ amd64 ] 8 - Source location: [ build ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ build ] 12 - Conflicts: [ ] 13 - Replaces: [ ] Enter a number to change any of them or press ENTER to continue: 2 Enter new name: >> sysdig This package will be built according to these values: 0 - Maintainer: [ root@Tux ] 1 - Summary: [ sysdig-test ] 2 - Name: [ sysdig ] 3 - Version: [ 20150517 ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ checkinstall ] 7 - Architecture: [ amd64 ] 8 - Source location: [ build ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ build ] 12 - Conflicts: [ ] 13 - Replaces: [ ] Enter a number to change any of them or press ENTER to continue: Installing with make install... ========================= Installation results =========================== [ 15%] Built target luajit [ 30%] Built target zlib [ 30%] Built target driver [ 51%] Built target scap [ 92%] Built target sinsp [ 96%] Built target sysdig [ 98%] Built target scap-open [100%] Built target scap-validatebuffer Install the project... -- Install configuration: "Debug" -- Up-to-date: /usr/local/src/sysdig-0.1.1-dev/Makefile ... ... -- Up-to-date: /usr/local/share/man/man8/sysdig.8 ======================== Installation successful ========================== Some of the files created by the installation are inside the home directory: /home You probably don't want them to be included in the package. Do you want me to list them? [n]: n Should I exclude them from the package? (Saying yes is a good idea) [n]: n Some of the files created by the installation are inside the build directory: /home/neo/DEVEL/sysdig/build You probably don't want them to be included in the package, especially if they are inside your home directory. Do you want me to list them? [n]: y Should I exclude them from the package? (Saying yes is a good idea) [y]: Copying files to the temporary directory...OK Stripping ELF binaries and libraries...OK Compressing man pages...OK Building file list...OK Building Debian package...OK Installing Debian package...OK Erasing temporary files...OK Writing backup package...OK OK Deleting temp dir...OK ********************************************************************** Done. The new package has been installed and saved to /home/neo/DEVEL/sysdig/build/sysdig_20150517-1_amd64.deb You can remove it from your system anytime using: dpkg -r sysdig **********************************************************************

The Debian package is generated under the working directory:

$ ll sysdig_20150517-1_amd64.deb -rw-r--r-- 1 root root 662K May 17 09:18 sysdig_20150517-1_amd64.deb $ dpkg -l sysdig Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-===============================-====================-====================-=========== ii sysdig 20150517-1 amd64 sysdig-test