Linux Package Manager (RPM)

Source: Internet
Author: User
Tags gpg

Linux packages can support a variety of tools, such as C, C + +, Perl, and so on.

But this high-level language written out of the code is what we can understand, but the computer is not understand, then the computer how to do, how to understand what people want it to do?

This requires us to do some conversion, the language can be read by the machine can also be recognized, this process is done by the compiler, usually the code language into the binary language.

Process: preprocessing, compiling, compiling, linking

A program runs most of the time without a library .

What is a library? Library is also a program, but unlike other programs, the library does not execute the portal, can not run independently, can only be executed by other independent running programs. The White Library is a service for other programs. )

Classification of libraries: development libraries, runtime libraries

It is conceivable that the development of the library is the application of apes, and users only use the runtime library.

So let's take a look at the source code.

API: A source code that can be compatible with any environment. (That is, it's none of your business. Hardware platform can be)

ABI: A source code, but unlike the API, the ABI relies heavily on the hardware environment. (if it's a different device, it's not going to work, just like the computer-formatted software doesn't work on the phone)

So, if you're porting a piece of software, it's best to be an API.

Note: Some programs do not depend on the hardware to run, and depend on the virtual machine to run. (Can be run across platforms)



Then let's talk about what the package is made of.

Package Composition Format:

Binaries: Storage locations (/bin,/sbin,/uer/bin,/uer/local/bin,/uer/local/sbin)

Library file (development library, runtime): storage location (/lib64 We take 64-bit systems for example,/UER/LIB64,/uer/local/lib64)

Configuration file: storage location (/etc,/uer/local/app/etc or conf)

Help Files: storage location (/uer/share/man,/uer/local/share/man,/uer/local/app/man)




Cut to the chase, Package Manager is mainly divided into: database and program composition of the manifest file

Database: Program name and version, dependencies

Program Composition Checklist: File list, scripts to run when loading and unloading



Package Manager Features: package compiled program into a file or a limited number of files, can be used to implement installation, uninstallation, upgrade, query, calibration, database management and other functions.

It is important to note that the dependencies between programs are complicated and complex tasks are accomplished by a number of single small program combinations. (in relation to the call of the library, the program needs to call the library when it is run, and some programs need to call the library of other programs, thus forming a dependency)




"How to use the RPM package"

RPM Package Naming format: Name-version number-relase. platform. RPM (relase: The revision number of the source code package made into RPM)

The version number includes the major version, minor version, revision number


"Ways to get the RPM"

1, the publisher's CD-ROM or site server

2. Mirror: http://mirrors.163.com

Http://mirrors.sohu.com

3, the project official website: source code, RPM package

4. RPM packages produced and published by third party organizations or individuals

Http://rpmfind.net

Http://rpm.pbone.net


"Verification of the validity of RPM packages"

After the completion of the package, the author will attach a digital signature to the package, the package creator uses one-way encryption to extract the original data signatures, and then use their own private key to encrypt the code, append the original data behind.

Verification process:

Premise: Must have the reliable mechanism obtains to the package author's public key;

1, the use of the producer's public key to decrypt the encrypted signature, can be decrypted means that the source is legitimate;

2, using the same intent as the creator of the encryption algorithm to extract the original data signature, and the decrypted characteristics of the comparison, the same, it means that the integrity of the problem;


"How to install the RPM package"

Command syntax format: RPM option file package path

Among the options are:-I installation

-V Show detailed procedures

-H Displays the installation progress using the # sign

IVH combined installation and display of detailed procedures and progress

--tost test (not really installed, only test is able to install)

--nodeps Ignore dependencies when installing

For example, we install GCC:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/41/65/wKioL1PU-TbCvwYZAAAk3ylgNCU686.jpg "title=" ' SX] tcl2d}ximfbiy~ $IZJ 4.jpg "alt=" Wkiol1pu-tbcvwyzaaak3ylgncu686.jpg "/>


"How to uninstall a package"

Syntax use format: RPM option package name (the option here is-E.) Meaning to uninstall)

For example, we uninstalled the GCC that we just installed

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/41/65/wKioL1PU-c2DmHVFAAA0naVSwIE886.jpg "title=" k]oc[[ (9xhw$3lhv_zi%[]t.jpg "alt=" Wkiol1pu-c2dmhvfaaa0navswie886.jpg "/>


Note: If the package configuration file has been modified, the package configuration file will be renamed and saved when uninstalling .


If you are dependent on another package when uninstalling: 1, uninstall all packages that depend on this package

2. Add--nodeps after ignoring dependency relationship

"How to upgrade Packages"

Commands apply syntax: RPM option Package path

Upgrade or install the option to use:-UVH

The options for simple upgrade are:-FVH

Note: Upgrade or version conflicts, forcing the upgrade with the--force option

Note: The kernel should not be upgraded and the kernel can only be installed. Linux systems allow multiple cores to coexist.


"Query operation for RPM packages"

1. Check if a package is installed: RPM-Q package Name

Such as: Query the GCC package is installed

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/41/65/wKioL1PU_NzQUONwAABLaQLJ1-g556.jpg "title="]}[ 48md3a%agq[t5ka ' FQ) k.jpg "alt=" Wkiol1pu_nzquonwaablaqlj1-g556.jpg "/>


2. Check all installed packages: RPM-QA

Such as:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/41/65/wKiom1PU_B2z10sXAAFGJVN9MWI453.jpg "title=" 3][ HVM9 (RZ (r@v{~d2[~8dx.jpg "alt=" Wkiom1pu_b2z10sxaafgjvn9mwi453.jpg "/>


3. Query the description of the installed package: RPM-QI Package Name

For example: Query the description information of the Groff package

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/41/65/wKioL1PU_dSDrohLAAG3J0h1cfY327.jpg "title=" Lno5htkpeivhssrqq{1j8~c.jpg "alt=" Wkiol1pu_dsdrohlaag3j0h1cfy327.jpg "/>


4. Query the generated file for the installed package: RPM-QL Package Name

Such as: Query the generated file of Groff

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/41/65/wKioL1PU_kChLEUOAADfFGSKlJI481.jpg "title=" 789V (A (NW)} @~yiz1qbpew8.jpg "alt=" Wkiol1pu_kchleuoaadffgsklji481.jpg "/>


Query installation-generated configuration file: RPM-QC package Name

Query installation-generated Help file: RPM-QD package Name

Related script for query installation: RPM-Q--scripts package Name

5, query a file is the package installed generated: RPM-QF file name

6. Query for packages that have not yet been installed: RPM option-P Path package file

Option has-QPI description information

-QPL Generating Files

-QPC Generating a configuration file

-QPD Generating Help files

-QPF file path


"Package Checksum"

Check that the file properties that are generated after the package is installed have changed

RPM-V Package Name



"Show shared library dependencies"

Use syntax: LDD command file path

such as: View the dependencies of the LS command

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/41/65/wKioL1PVAJ3Sc5-XAAHNRgxXK1Y988.jpg "title=" 7x95oimxua~o}1ztyw{@q]m.jpg "alt=" Wkiol1pvaj3sc5-xaahnrgxxk1y988.jpg "/>


RPM package source legality and completeness test:

Prerequisite: The public key of the creator of the package is imported on the current system

Import:

RPM--import File path

Rpm-qa gpg-pubkey* Displays all the public keys in the GPG format that have been imported

Rpm-qi gpg-pubkey-name Display Key details


"Check Package"

Manual Check:

Rpm-k Package file path

RPM--checksig Package file path

Package integrity is not checked:

Rpm-k--nodigest

Do not check the legitimacy of the source:

Rpm-k--nosignature


"Database Rebuild"

Database directory:/var/lib/rpm

Reconstruction:

RPM--INITDB Initialization

If there is no library in advance, a new one is created;

RPM--REBUILDDB Rebuild

Direct reconstruction, overwriting the original database


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.