How to use Checkinstall on RedHat

 

Copyright © Trevor Ouellette, 2002

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included at: http://www.gnu.org/licenses/fdl.txt

 

This document is recommended for the beginner/intermediate level

 

Website: http://www.gnuguy.com/linux.html

Email: trevor@gnuguy.com

 

Kudos to Mark Lane for making me aware that such a tool currently exists.

 

NOTE: It is recommended that you have previous knowledge of how to compile simple programs in Linux.  Basic knowledge of bash and rpm are also helpful.  In addition, you may have to “su” root  in order to compile / install the software here.  I used an SSH terminal to capture the screens for this document.

 

 

About Checkinstall

[taken in part from Checkinstall’s documentation]

 

How can you remove a program compiled and installed from source?

 

Some times - very few - the program's author adds an "uninstall" rule to the Makefile, but that's not usually the case. That is the primary reason to use Checkinstall. After you ./configure; make your program, Checkinstall will run "make install" (or whatever you tell it to run) and keep track of every file modified by this installation.

 

This makes it very easy to uninstall programs that you compile from source because they get packaged and installed as an RPM.  (Checkinstall can also make Slackware and Debian packages as well, but this document will not deal with those packages).

 

It is important to realize that Checkinstall is not ALWAYS successful.  There are a few times (installations with SUID, SGID, statically linked binaries) when Checkinstall fails.  Personally, my experience has been that this program can handle complex compiles.  I have installed the SDL library as well as a few X-window games using Checkinstall with great success!

 


Installing Checkinstall

 

http://asic-linux.com.mx/~izto/checkinstall/download.php

 

 

Go ahead and download the checkinstall-1.5.2.tgz source file. (it will even make it’s own RPM on a RedHat system). 

 

You can use wget (http://www.gnu.org/software/wget/wget.html) in order to download the program to your development box if it is connected to the Internet.

 

·         mkdir /source

·         cd /source

·         wget –nv http://asic-linux.com.mx/~izto/checkinstall/files/source/checkinstall-1.5.2.tgz

·         tar –zxf checkinstall-1.5.2.tgz

·         cd check*

·         make

·         make install

·         checkinstall

 

 

Checkinstall is now installed on your system (use “rpm –e checkinstall” to remove it).

 


Using Checkinstall to Build and Install Compiled Software

 

Building, installing and using Nettop software on our RedHat system

 

http://srparish.net/scripts/nettop-0.2.3.tar.gz

Nettop is a program, which looks like top, but is for network packets. It requires libpcap and slang to be installed on your computer.

 

Download the program and save it to a directory of your choice.  I use /source as my location for building software.  I’m sure there are better locations, but this works fine for me.

 

 

Read all documentation to find out how to compile the program.  Look for an INSTALL file or a README document.  This is the most important step because the information contained in these files may include additional steps on how to compile the software successfully.

 

In this case, we need to run configure first:

 

[root@devbox9 /root]# ./configure

 

 

Now we need to run make:

 

[root@devbox9 /root]# make

 

 

Normally, you would just go ahead and do a “make install”, instead we are going to use Checkinstall to build the Nettop RPM for us automatically.

 

First thing, we need to make a directory called doc-pak.  We are going to move our documentation files into this directory.  This step is very important and should be included in all installations.

 

[root@devbox9 /root]# mkdir doc-pak

[root@devbox9 /root]# mv README THANKS ChangeLog doc-pak

 

 

Now we are going to start the installation process.

 

Simply execute the following line:

 

[root@devbox9 /root]# checkinstall –R make install

 

 

Give this program a good description, so that you can help identify it in the future.  I named this one “Nettop is a program, which looks like top, but is for network packets”.  This sounds descriptive enough. 

 

 

Make sure that the Name, Version, Release, License, Group, Architecture information is accurate.  Press ENTER to begin the RPM package creation.

 

 

That’s it!  If everything looks like is OK, then checkinstall will build your package and install it. Let’s check to ensure that the RPM is installed.  You can issue an “rpm –qa | grep nettop” command to verify that it is installed.

 

 

If you want a copy of the RPM (to install on several other machines) or for use on servers without compilers, it’s found in /usr/src/redhat/RPMS/i386.

 

 

 

Let’s run nettop to make sure the program is installed properly.

 

[root@devbox9 /]# nettop

 

 

The program is running fine and we verified that the installation was successful!

 

Our documents (anything you put in the doc-pak folder) can be found in the /usr/doc/nettop-0.2.3 directory.

 

 

To uninstall the entire program, simply do a “rpm –e nettop” from the command line.

 

 

And it is removed from your system cleanly and easily!

 

 

Checkinstall works well when installing software with a lot of files to install because it can keep track of where all of the software is installed, what directories are created, and a lot more.

 

In Linux Journal (Sept. 2002 / pg. 48), David A. Bandel included Checkinstall as one of his reviewed software packages.  Mr. Bandel highly recommends this package and he uses it on all of his production, test, and development systems.

 


Additional Notes:

 

You can find the configuration file for Checkinstall in the /usr/local/lib/checkinstall directory.  You can edit the checkinstallrc file to set defaults and tune Checkinstall for your system.

 

 

Command line Options for Checkinstall

 

Usage: checkinstall [options] [command [command arguments]]

 

Options:

 

*Package type selection*

 

-t,--type=<slackware|rpm|debian>            Choose packaging system

-S                                                         Build a Slackware package

-R                                                         Build a RPM package

-D                                                         Build a Debian package

 

*Scripting options*

 

-y, --default                                            Accept default answers to all questions

--pkgname=<name>                               Set name

--pkgversion=<version>                           Set version

-A, --arch, --pkgarch=<arch>                   Set architecture

--pkgrelease=<release>                          Set release

--pkglicense=<license>                          Set license

--pkggroup=<group>                               Set software group

--pkgsource=<source>                           Set source location

--pkgaltsource=<altsource>                    Set alternate source location

--pakdir=<directory>                               The new package will be saved here

--maintainer=<email addr>                      The package maintainer (.deb)

--provides=<list>                                    Features provided (.rpm)

--rpmflags=<flags>                                 Pass this flags to the rpm installer

--dpkgflags=<flags>                                Pass this flags to the dpkg installer

--spec=<path>                                       .spec file location

--nodoc                                                 Do not include documentation files

 

*Info display options*

 

-d<0|1|2>                                               Set debug level

-si                                                         Run an interactive install command

--showinstall=<yes|no>                           Toggle interactive install command

-ss                                                        Run an interactive Slackware script

--showslack=<yes|no>                           Toggle interactive Slackware script

--exclude=<file|dir[,...]>                           Exclude files/directories from package

 

*Package tuning options*

 

--autodoinst=<yes|no>                            Toggle the creation of a doinst.sh script

--strip=<yes|no>                                    Strip any ELF binaries found in package

--stripso=<yes|no>                                 Strip any ELF binary libraries (.so files)

--gzman=<yes|no>                                 Compress man pages found in package

--docdir=<path>                                     Where to put documentation files

 

*Cleanup options*

 

--deldoc=<yes|no>                                 Delete doc-pak upon termination

--deldesc=<yes|no>                               Delete description-pak upon termination

--delspec=<yes|no>                               Delete spec file upon termination

--bk                                                       Backup any overwritten files

--backup=<yes|no>                                Toggle backup

 

*About CheckInstall*

 

--help, -h                                               Show this message

--copyright                                             Show Copyright information

--version                                                Show version information

 

 

 

FAQ

            (Taken from Checkinstall’s website)

1.       I ran CheckInstall and everything seems to run fine, but when I check my new package I only find the documentation files!

CheckInstall can't trace (yet) the actions of three kind of binaries:


You may now go to check the binaries you're using in the installation process   ;-).

2.       I built my Linux system from scratch (LFS, anyone?) and nothing gets included in the packages I create with CheckInstall!

Most likely you installed GNU make from source, which by default installs the make binary with SUID and/or SGID permissions. A quick fix:

chmod 0755 `which make`

Which means to remove the SUID and SGID bits from the make binary.

Please refer to the first question in this FAQ for the details.

3.       I use Slackware Linux 8.0 and the symbolic links created by my installation do not get into the package!

The ln binary shipped with Slackware 8.0 is statically linked. Replace it with a dynamically linked one.
The one shipped with Slackware 7.1 works just fine. You can download it here

Please refer to the first question in this FAQ for the details.

4.       I used CheckInstall to install the latest XFree86 distribution, but the drivers are being corrupted! If I install XFree86 without CheckInstall everything runs fine. Is this some evil bug?

It's not a bug. It's your driver's files being stripped by the automatic ELF stripping process. Run checkinstall with the "--strip=no" command line option.

5.       I use a RPM based distribution and CheckInstall says it built the rpm package OK but reports an error when installing the .rpm file:

Building RPM package...OK
Installing RPM package... FAILED!

And in the install.log file I find something like this:

error: open of /usr/src/RPM/RPMS/i386/package-1.0-1.i386.rpm failed no such file or directory

What's wrong?

There's something wrong with your RPM installation. Check your system and see if the "rpm-build" and "spec-helper" packages are installed. Also verify that their versions match the version of the rpm binary installed in your system.