Common methods for installing software in CentOS

Source: Internet
Author: User
In the CentOS system, software installation programs are complicated, but there are two most common types: 1) the source code of the software, you need to compile it yourself. This software installation package is typically a gzipcompressed tarpackage (suffixed with .tar.gz ).
2) the other is the executable program of the software. you only need to install it. This software installation package is usually an RPM Package (Redhat Linux Packet Manager, which is the Redhat package Manager) with a suffix of. rpm.
Of course, it also uses the source code packaged in rpm format and executable packages compressed with gzip. As long as you understand the following ideas, the installation packages in these two forms are also unavailable.

Part 1: .tar.gz

First, copy the installation file to your Directory. For example, if you log on as root, copy the software to/root.
---- # Cp filename.tar.gz/root
---- Because the file is compressed and packaged, decompress it. Command:
---- # Tar xvzf filename.tar.gz
---- After executing this command, the installation file is decompressed to the current directory by path. Run the ls command to view the decompressed file. The file named "INSTALL" is usually generated after decompression. This file is a plain text file that describes the installation method of the software package in detail.
---- For most software to be compiled, the installation method is roughly the same. After decompression, an executable script program named configure is generated. It is used to check whether the system has the library required for compilation, and whether the library version meets the compilation requirements and other system information required for installation. Prepare for subsequent compilation. Command:
---- #./Configure
---- If an error is found during the check, configure will prompt and stop the check. You can configure the system as prompted. Run the program again. After the check is passed, the MakeFile file for compilation will be generated. Now you can start compiling. The compilation process varies depending on the size of the software and the performance of the computer. Command:
---- # Make
---- After compilation, enter the following command to start installation:
---- # Make install
---- After installation is completed, the temporary files generated during compilation and files generated during configuration should be cleared. Run the following command:
# Make clean
# Make distclean
So far, the software installation is complete.
Part 2
1. First, use tar-xzvf to unbind the package, for example:
# Tar-xzvf apache_1_3_6_tar.gz
In this example, a new directory (the directory name is similar to the file name of the .tat.gz package) is created in the current directory to store the extracted content. In this example, apache_1.3.6 is used.

2. enter the directory and run the ls command to view the files contained, such:
# Cd apache_1.3.6
# Ls
Check which of the following files is contained in the directory: configure, Makefile, or Imake.
1) If the configure file is used, run:
#./Configure
# Make
# Make install
2) if it is a Makefile file, execute:
# Make
# Make install
3) if it is an Imake file, execute:
# Xmkmf
# Make

# Make install

The principle of make is to execute commands in a Makefile called (generated). The basic purpose of make is to automatically compile the source files according to the commands in makefile. It can also be used to install software or uninstall software, provided that the author has written it in makefile. For example, makefile contains the following content:
Install: <commands>
Then, if you use make install, the make program will execute the installation according to the above install: Command <commands>. The same is true for uninstall. most authors will write the uninstallation part, in this case, you only need to simply execute make unistall. if the author is lazy and has not written it, you only need to follow the steps in make install to check which files it copies and then manually delete them.
Another key point is that after compilation and installation is complete, do not delete the source code. otherwise, even if the author writes the unnistall target, no makefile can be executed.
3. if no error message is displayed, it will be done. Where the software is installed, it usually appears during installation. Otherwise, you can only check README.


Run the command to view the installation directory: rpm-ql apache
If an error is prompted, do not worry. it is usually a very simple problem:
1) C or C ++ compiler is not installed:
Diagnosis method: execute the command gcc (C ++ is g ++) and prompt that the command cannot be found.
Solution: mount the Linux installation disc and enter the RPMS Directory. run the following command:
# Rpm-ivh gcc * (haha, we used the second installation method)
2) the make tool is not installed:
Diagnosis method: execute the make command and prompt that the command cannot be found.
Solution: mount the Linux installation disc and enter the RPMS Directory. run the following command:
# Rpm-ivh make *
3) The autoconf tool is not installed:
Diagnosis method: execute the make command and prompt that the command cannot be found.
Solution: mount the Linux installation disc and enter the RPMS Directory. run the following command:
# Rpm-ivh autoconf *
4) some link libraries are missing;
Diagnosis method: some files are prompted During make.
Solution: install the package containing this file, which requires accumulation.
Part 2:. rpm

RPM is a software package manager launched by Red Hat with Redhat Linux, which makes software installation easier.

Copy the installation file to your directory/usr/src. Then use rpm to install the file. The command is as follows:
---- # Rpm-ivh filename. i386.rpm
---- Rpm automatically unpacks the installation file and installs the software in the default directory. And register the software installation information to the rpm database.

1. install software: run the rpm-ivh rpm Package name, for example:
# Rpm-ivh apache-1.3.6.i386.rpm
2. upgrade the software: run the rpm-Uvh rpm Package name.
3. reverse installation: run the rpm-e rpm Package name.
4. query the detailed information of the software package: run rpm-qpi rpm Package name
5. query the rpm package where a file belongs: run the rpm-qf rpm Package name
6. check which files will be written to the system by executing the 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.