A while ago, we wrote about an utility called Fpm that helps to easily build Linux packages for multiple Linux platforms. Today, we will discuss about CheckInstall which is also used to build Linux packages from source code.
Table of Contents
A brief introduction to CheckInstall
Usually, we install packages using the distribution's package managers. But if an application that you'd like to install isn't available in your distribution repositories, you have no choice, but manually compile and install yourself from source code.
Compiling and Installing applications from source code is bit difficult for some people, especially the newbies. This is where programs like FPM and CheckInstall comes in help.
CheckInstall is a program that compiles a program from source code, and creates a native package for your Linux distribution. So that you can install the packages using your distribution's package management system (dpkg, rpm or installpkg).
Currently, CheckInstall creates native packages for DEB-based systems, RPM-based systems and Slackware. In this brief tutorial, we will be discussing how to build packages from source using CheckInstall program.
Install CheckInstall in Linux
CheckInstall is available in the most Linux distribution's default repositories. So, you can install it using the package managers.
Say for example, In Debian based systems, you can install it using the following command:
$ sudo apt install checkinstall
On SUSE/openSUSE:
$ sudo zypper install checkinstall
On CentOS, RHEL, Fedora:
Download and install CheckInstall rpm file from this link.
# wget ftp://ftp.pbone.net/mirror/ftp5.gwdg.de/pub/opensuse/repositories/home:/ikoinoba/CentOS_CentOS-6/x86_64/checkinstall-1.6.2-3.el6.1.x86_64.rpm
# yum install checkinstall-1.6.2-3.el6.1.x86_64.rpm
Build Packages From Source Using CheckInstall
Here is the simple steps to create a DEB package of ‘hello’
program. I tested the following steps in Ubuntu 16.04 LTS.
First download the 'hello' program's tarball.
$ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
Extract the tarball using command:
$ tar -zxvf hello-2.10.tar.gz
The, go to the directory where you extracted hello tarball.
$ cd hello-2.10/
Run the following commands one by one to compile it.
$ ./configure
$ make
Now, instead of typing "make install"
command to install the program, we type the following command:
$ sudo checkinstall --install=no
This command will create .deb
package, but won't install it. Press Y to create package documentation directory named "doc-pak"
.
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]: y Preparing package documentation...OK Please write a description for the package. End your description with an empty line or EOF. >> Simple Hello Program ## Type your Program name and hit ENTER key. >> ***************************************** **** Debian package creation selected *** ***************************************** This package will be built according to these values: 0 - Maintainer: [ root@ubuntuserver ] 1 - Summary: [ Simple Hello Program ] 2 - Name: [ hello ] 3 - Version: [ 2.10 ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ checkinstall ] 7 - Architecture: [ amd64 ] 8 - Source location: [ hello-2.10 ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ hello ] 12 - Conflicts: [ ] 13 - Replaces: [ ] Enter a number to change any of them or press ENTER to continue: ## Hit ENTER key [...] Building file list...OK Building Debian package...OK NOTE: The package will not be installed Erasing temporary files...OK Deleting temp dir...OK ********************************************************************** Done. The new package has been saved to /home/sk/hello-2.10/hello_2.10-1_amd64.deb You can install it in your system anytime using: dpkg -i hello_2.10-1_amd64.deb **********************************************************************
Now, you can install the newly created .deb
package using dpkg
package manager:
$ sudo dpkg -i hello_2.10-1_amd64.deb
If you execute the above command without "--install=no"
flag, it will automatically create a .deb
package and install it on your system.
$ sudo checkinstall
Sample output:
checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran This software is released under the GNU GPL. ***************************************** **** Debian package creation selected *** ***************************************** This package will be built according to these values: 0 - Maintainer: [ root@ubuntuserver ] 1 - Summary: [ Simple Hello Program ] 2 - Name: [ hello ] 3 - Version: [ 2.10 ] 4 - Release: [ 1 ] 5 - License: [ GPL ] 6 - Group: [ checkinstall ] 7 - Architecture: [ amd64 ] 8 - Source location: [ hello-2.10 ] 9 - Alternate source location: [ ] 10 - Requires: [ ] 11 - Provides: [ hello ] 12 - Conflicts: [ ] 13 - Replaces: [ ] Enter a number to change any of them or press ENTER to continue: ##Press ENTER [...] 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/sk/hello-2.10/hello_2.10-1_amd64.deb You can remove it from your system anytime using: dpkg -r hello **********************************************************************
This command will create the .deb file and install it automatically on your system. You can remove the install package at anytime using command:
$ sudo dpkg -r hello
CheckInstall will create a .rpm
or a .deb
package automatically, depending on the type of your current Linux distribution you use. If you need to create a .rpm package, just follow the above steps in any RPM-based systems. For Slackware packages, do this on Slackware system.
For more details, see the man pages:
$ man checkinstall
Or, check the help section.
$ checkinstall --help
Resource:
1 comment
Do you really need creating a package without specifying its dependencies?
So you are creating a unuseless beast.