Linux source code Installation Tool checkinstall

Source: Internet
Author: User

Checkinstall is a program that can automatically generate the RPM/Debian or slackware installation package from the source code of the tar.gz class. With checkinstall, you can use almost all the tar.gz class source code to generate a "clean" installation or uninstall package.

Introduction

This problem often occurs: only the source code (such as tar.gz) of the program that you want to try out is available, and no RPM or Debian package is provided. You have to download the source code, decompress it, And then compile it manually. So far, everything is normal. However, what if you want to delete it?

The MAKEFILE file contains only a few unload routines. Of course, you can install the program to a temporary folder, write down all the files generated or modified by the program, and delete them. However, if this program needs to be re-compiled frequently, it will be very painful and the workload will be quite large. The checkinstall written by Felipe Eduardo is used to solve this problem.



Back to Top

Install programs with GNU Autoconf

Generally, the following steps are used to compile and install a program configured by GNU Autoconf:

./configure && make && make install

This configure script file is used to "Guess" a series of system-related variables that will be used in subsequent compilation processes. It checks whether the system variable value meets the compilation requirements, and then uses these variables to generate makefile in each folder of the package. In addition, the configure script generates other files:

  • One or more makefiles (s) under each folder/subfolders)
  • A script named config. Status
  • A text file config. Log

After the configure script file runs successfully, you will enter make to compile the program and get the executable file you need. If make is successful, you can use make install to install the program.



Back to Top

Use checkinstall to install the program

In the previous section, we used GNU Autoconf to compile the program. Now it is time to change the method. You can use the checkinstall tool. It uses its own command checkinstall to replace make install. The other two commands are retained as before. Therefore, the command sequence is changed:

./configure && make && checkinstall

The command checkinstall not only runs make install by default, but also monitors all write operations during installation. Therefore, checkinstall uses the program installwatch written by Pancrazio de Mauro. After make install is complete, checkinstall will generate an slackware-, Debian-, or rpm-installation package, and then install the program according to the default configuration of the software package, the generated installation package is left in the current directory (or the standard installation package storage directory. You can modify the directory by modifying the pak_dir variable.

Checkinstall does not only use make install, but can also be coordinated with other installation commands. For example, if the installation command is setup. Sh, the installation command sequence is:

./configure && make && checkinstall setup.sh

We can also run checkinstall with many parameters.

Figure 1. Run the "checkinstall-h" command to display all available sub-Parameters
 

 

These subparameters are roughly divided:

  • Install options)
  • Scripting options)
  • Info display options)
  • Package tuning options)
  • Cleanup options)
  • About checkinstall (about checkinstall ).

If checkinstall runs with these parameters, it uses these parameter values to replace the corresponding values in the configuration file checkinstallrc.

Checkinstall also has its own limitations. It cannot process programs with static connections, because installwatch cannot monitor files modified during installation. In general, there are two types of connected libraries: Dynamic and Static. These connection libraries are integrated into the program using the include command. The statically connected program already contains all the required library files, so you do not need to load these libraries into the memory at runtime. This program has nothing to do with the Connection Library installed in the system, because the so-called connector (linker) has built these libraries into the executable program during compilation.



Back to Top

Install checkinstall

We can download various pre-compiled installation packages or suitable source code packages on the home page of checkinstall. The entire process of installing the latest source code checkinstall-1.6.1.tgz is shown below. This will install checkinstall, installwatch, and makepak. makepak is the modified version of makepkg. If you are interested in the improvement of the new version, see release notes and changelog.

Listing 1. Generating the RPM installation package for checkinstall

# tar xzf checkinstall-1.6.1.tgz# cd checkinstall-1.6.1checkinstall-1.6.1# makecheckinstall-1.6.1# make installcheckinstall-1.6.1# checkinstall

Figure 2. Run the "checkinstall" command to generate an RPM package
 

Figure 2.1. Process 1
 

Figure 2.2. process 2
 

Figure 2.3. process 3
 

The RPM package for the checkinstall-1.6.1 has been generated and we use RPM to install it.

List 2. Install checkinstall with the generated RPM package

checkinstall-1.6.1# cd /usr/src/redhat/RPMS/i386/i386# rpm -i checkinstall-1.6.1.rpm

Checkinstall-1.6.1 installation is complete. Using the query statement of the package management program, you can check whether the files in the installation package are completely recorded in the library, and view some additional information in the installation package header.

Figure 3. Check the RPM package of checkinstall
 



Back to Top

Configuration of checkinstall

You can change the default configuration of checkinstall by modifying the configuration file/usr/local/lib/checkinstall/checkinstallrc.

The variables worth noting in the file include instype, install, and pak_dir.

The instype variable determines the type of installation package to be generated.

Figure 4. view the instype variable
 

The pak_dir variable determines the storage directory of the installation package.

Figure 5. view the variable pak_dir
 

The install variable determines whether to generate only the installation package or install the package immediately together.

0-generate only the installation package

1-not only generate the installation package, but also install the package immediately

Figure 6. view the variable install
 



Back to Top

Use checkinstall to create an RPM package instance

In the last two sections, we have completed the checkinstall installation and configuration. This section takes the squid-2.6.STABLE12.tar.bz2 as an example to illustrate how to compile the checkinstall into a squid-2.6.STABLE12-1.i386.rpm package.

Listing 3. Generating the RPM installation package for the squid-2.6.STABLE12

# tar jxvf squid-2.6.STABLE12.tar.bz2 # cd squid-2.6.STABLE12 squid-2.6.STABLE12# ./configure --prefix=/usr/local/squid  --sysconfdir=/etc   /--enable-arp-acl  --enable-linux-netfilter  -enable-err-language="Simplify_Chinese"  /--enable-storeio=ufs  --enable-default-err-language="Simplify_Chinese"  /--enable-auth="basic"  --enable-baisc-auth-helpers="NCSA"  --enable-underscore  squid-2.6.STABLE12# makesquid-2.6.STABLE12# checkinstall

When an RPM package is generated, some options are displayed. Select the default option.

Figure 7. Run the "checkinstall" command to generate an RPM package
 

Figure 7.1. Process 1
 

Figure 7.2. process 2
 

Figure 7.3. process 3
 

Figure 7.4. process 4
 

Listing 4. Installing squid-2.6.STABLE12 with the generated RPM package

squid-2.6.STABLE12# cd /usr/src/redhat/RPMS/i386/i386# rpm -ivh squid-2.6.STABLE12-1.i386.rpm

Figure 8. Check the RPM package for the squid-2.6.STABLE12
 



Back to Top

End

Checkinstall is an excellent source code installation software, which makes Linux software management more convenient. Especially when the source code needs to be repeatedly compiled, checkinstall allows you to completely uninstall the program without compromising system consistency. In addition, you can use these compiled installation packages to install them directly on other machines without re-compiling.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.