Linux Software Management rpm

Source: Internet
Author: User

1. Overview

For a software installation to Linux, in general, you need to pay attention to some post-installation locations, such as executable binaries, configuration files, Help files, library files are stored separately, because these are necessary for the application to run. Previously learned the FHS structure of Linux, know/etc for storing configuration files,/lib,/usr/lib,/usr/local/lib for storing library files,/usr/share/,/usr/local/share/for storing help documents;/bin ,/sbin,/usr/bin,/usr/sbin,/usr/local/bin,/usr/local/sbin is used to store executable binaries. RPM, which is the Redhat package manage, Packages Manager. RPM can be used to make software, install software, uninstall software, upgrade software, verify software and other functions.


2. RPM Naming specification

Examples are as follows:

bind-9.7.1-el5-i586.rpm


Bind is the package name, packet is the main package and child package, such as bind (main package), Bind-lib (child package)

9.7.1 is the version number

El5 is the release number, clearly stating that the Redhat Enterprise Edition 5 is equivalent to a system platform

I586 is the platform architecture, i586/i686 is a 32-bit platform x64/x86_64 is a 64-bit platform equivalent to a physical platform


RPM is available in two formats:

Binary format: has been compiled into binary, directly installed, convenient and simple

SOURCE format: Need to compile, a bit of trouble. However, the hardware performance of the host can be maximized



3. Install rpm

Rpm-i path_rpm

-H can display the installation progress, a # represents 2% progress

-V Show More information

-vv

-vvv

--nodeps ignore dependencies, force install "may cause, cannot be used after software Installation"

--replacepkgs re-install overwrite previous version

--force Mandatory Installation "may overwrite, may degrade"

--test is not installed, just under test


For the installation of RPM, in fact, we commonly used is:

RPM-IVH path_rpm



4. Check rpm

We know that for Windows, if the application is installed, there are any registry, what menu, what Control Panel, etc. can be found to install the application. But Linux doesn't have these concepts, so how do we query which RPMs are installed and where?


Rpm-q PackageName Query whether to install the PackageName package with the specified name

Rpm-qa query all installed RPM packages can be followed by a wildcard

Rpm-qi packagename Query for more detailed information

RPM-QL PackageName Find out exactly where this RPM is installed, locate the list of files after installation

RPM-QF FILEPATH queries the specified path of the file is installed by which rpm

RPM-QC PackageName queries the configuration file for the specified package name Configfiles

RPM-QD PackageName Document Description where Docfiles

Rpm-q--scripts PackageName View pre-installation (pre), post-installation (post), uninstall, before uninstalling the script to be executed.



If a RPM package is not installed, then I would like to

Query for more detailed information Rpm-qpi path_rpm

Find out exactly where this RPM is installed and locate the list of files after installation RPM-QPL path_rpm

Query the configuration file for the specified package name Configfiles rpm-qpc path_rpm

Document description where Docfiles rpm-qpd path_rpm

Review pre-installation (pre), post-installation (post), uninstall, before uninstalling the script to be executed. RPM-QP--scripts path_rpm

As above, just add the-p option, followed by the RPM packet path.



Note that sometimes we need to use the RPM package name, and sometimes we need to provide the path to the RPM. If the RPM is already installed, it is actually recorded in the RPM database (/var/rpm/lib), so the query uses the RPM package name directly. If not installed, you obviously need to use the path of the RPM.


[[email protected] rpm]# rpm -qa a* Attr-2.4.32-1.1avahi-0.6.16-1.el5automake14-1.4p6-13autoconf-2.59-12automake-1.9.6-2.1[[email protected]  rpm]# rpm -qi aprName        : apr                            Relocations:  (not relocatable) version      : 1.2.7                              vendor: red  Hat, Inc.Release     : 11                              build date: wed 17 jan 2007 08:36:50 am pstinstall date: fri 27 jun 2014 09:40:03 am pdt       Build Host: ls20-bc2-14.build.redhat.comGroup        : System Environment/Libraries   Source RPM:  apr-1.2.7-11.src.rpmsize        : 267135                             license: apache software licensesignature   :  DSA/SHA1, Wed 17 Jan 2007 12:29:27 PM PST, Key ID  5326810137017186packager    : red hat, inc. 



5. Upgrade rpm

RPM-UVH Path_new_package If the system itself is equipped with an older version, upgrade, otherwise install.

RPM-FVH Path_new_package If the system itself is equipped with an older version, upgrade, otherwise quit.

RPM-UVH--oldpackage is to downgrade the installation "For example, after our software upgrade, we found that it was not good."

Specify the new version of the RPM package location.


6. Uninstalling rpm

Unloading:

RPM-E PackageName

Note that if this package is dependent on other packages, uninstalling will block you, and of course you may be forced to uninstall--nodeps.


7. Check rpm

Since the rpm we downloaded is from the Internet, has this file been changed? How do you judge it? There must be a mechanism for validation.

Rpm-v PackageName

That is, after we have finished installing the RPM, we can use the calibration mechanism.

S file Size differs

M Mode differs (includes permissions and file type)

5 MD5 sum differs

D Device Major/minor number mismatch

L Readlink (2) path mismatch

U User ownership differs

G Group ownership differs

T MTime differs

The above 8 bits are used to represent the change.



Other Notes:

Check source legitimacy, and software integrity:

First, the author or company of this package will publish a key, which is a file

We should import it:

RPM--import Xxxfile

Then verify the

Rpm-k Package_path



8. About the RPM database

RPM--REBUILDDB must be re-established

RPM--INITDB Initialize the database, none is established. Have, do not do the processing.


This article is from the "I want to surpass myself" blog, please be sure to keep this source http://zhangfengzhe.blog.51cto.com/8855103/1440478

Linux Software Management rpm

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.