Installing the TAR Package/rpm package under CentOS

Source: Internet
Author: User
Tags unpack centos
In the CentOS system, the software installation program is quite complex, but the most common are two kinds:

1) One is the source code of the software, you need to build it yourself. This software installation package is typically a tar package that is compressed with gzip (suffix. tar.gz).
2) Another is the software executable program, you just install it can be. This software installation package is usually a RPM package (Redhat Linux Packet Manager, which is the Redhat Package Manager), and the suffix is. rpm.
Of course, you can also use the RPM format to package the source code, with gzip-compressed executable packages. As long as you understand the following ideas, these two forms of installation package is also a cinch.

Below, we are divided into two parts to illustrate the concept of software Installation:

Part I: Done. tar.gz

First, copy the installation files to your directory. For example, if you are logged on as root, copy the software to /root .
----#cp filename.tar.gz/root 
----The file is compressed and packaged, so it should be uncompressed. The command is:  
----#tar xvzf filename.tar.gz 
----The installation file is extracted by path under current directory after the command is executed. You can see the extracted files with the LS command. Files that are usually named "INSTALL" are in the resulting file after decompression. This file is a plain text file, detailing how the package is installed. The
----is installed in much the same way for most software that needs to be compiled. An executable script named Configure that was produced after the decompression was performed. It is used to check whether the system has a library that is required for compilation, and whether the version of the library meets the required system information for installation such as compilation. Prepare for the subsequent compilation work. The command is:
----#./configure 
----If an error is found during the check, configure will give a hint and stop the check. You can follow the prompts to configure the system. Then re-execute the program. After the check passes, the makefile file is generated for compilation. At this point, you can start compiling. The process of compiling depends on the size of the software and the performance of the computer, and the time spent is different. The command is:
----#make  
----After a successful compilation, type the following command to start the installation:  
----#make install 
----  installation finished The temporary files produced during the compilation process and the files generated during configuration are purged . Type the following command:
#make clean 
#make distclean 
to the end of the installation of the software


1. First, use TAR-XZVF to unpack the package, such as:
#tar-XZVF apache_1_3_6_tar.gz
This creates a new directory in the current directory (the directory name is similar to the file name of the. tat.gz package), which is used to store the extracted content. As in this case, apache_1.3.6

2. Enter this directory and then use the LS command to view the included files, such as:
#cd apache_1.3.6
#ls
You see which of the following files is included in this directory: Configure, Makefile, or Imake.
1) If it is a configure file, execute:
#./configure
#make
#make Install
2) If it is a makefile file, execute:
#make
#make Install
3) If it is a Imake file, execute:
#xmkmf
#make

#make Install

The Make principle is to execute a command called (generated) in the makefile file, and the basic use of make is to automatically compile the source file according to the instructions in the makefile. It can also be used to do things like installing software, uninstalling software, etc., but only if the author wrote it in Makefile. For example, there are some things in makefile:
Install: < commands >
Then with make install, the made program will follow the above install: The following command < commands > perform the installation, uninstall is the same reason, most of the author will write a part of the uninstall, just simply to perform the Make Unistall can, if the author lazy did not write, it is only according to the steps in the make install, see what the file it copied to where, and then manually deleted.
The key point is that after the compilation installation is complete, do not delete the source code, or even if the author wrote the Unnistall target, you do not have makefile can be executed.

3. If there are no errors, then it's done. as for where the software is installed, it usually appears at installation time. Otherwise you can only consult the README.

Execute the command to view the installation directory :RPM-QL Apache
If you encounter an error, don't worry, it's usually a very simple question:
1) No C or C + + compilers are installed:
Diagnostic method: Execute command gcc (c + + is g++), indicating that the command could not be found.
Workaround: Mount the Linux installation CD, then go to the RPMs directory and execute the command:
#rpm-ivh gcc* (haha, we used the second installation method)
2) No Make tool installed:
Method of Diagnosis: Execute command make, indicating that the command could not be found.
Workaround: Mount the Linux installation CD, then go to the RPMs directory and execute the command:
#rpm-IVH make*
3) No autoconf tools installed:
Method of Diagnosis: Execute command make, indicating that the command could not be found.
Workaround: Mount the Linux installation CD, then go to the RPMs directory and execute the command:
#rpm-IVH autoconf*
4) missing certain link libraries;
Method of diagnosis: When make, some files are required to be prompted.
Workaround: Install the package containing this file, which needs to accumulate.

Part II: Done. RPM

RPM is the Red Hat company with Redhat Linux introduced a package manager, it makes it easier to implement software installation.

        Copy the installation files to your directory/usr/src. Then use RPM to install the file. The command is as follows:  
----#rpm-IVH filename.i386.rpm 
----RPM will automatically unpack the installation files and install the software into the default directory. and register the installation information of the software in the RPM database.

1. Install the Software: Execute RPM-IVH RPM package name, such as:
            #rpm-IVH apache-1.3.6.i386.rpm 
2. Upgrade software: Perform RPM-UVH RPM package name.
3. Anti-installation: Executes the RPM-E RPM package name.
4. Query Package Details: Execute rpm-qpi RPM Package name
5. Query for a file that belongs to the RPM package: Execute RPM-QF RPM Package name
6. Check what files the package will write to the system : Execute RPM-QPL RPM Package name

Related Article

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.