RPM command use, package format

Source: Internet
Author: User
Tags gpg sha1

Management of Linux software packages

There are several types of software in Linux: binary packages, source packages

Binary: There is a universal binary,

SOURCE package: Can be customized, cross-platform but the installation is more troublesome, usually need to compile the installation


Two major mainstream of package Manager
DPKG: It was developed by the Debian Linux community, as long as the other Linux distributions of the derivative version of Debian use the dpkg mechanism to manage the software, including b2d, Ubuntu and so on, with its front-end tools Apt-get 。
RPM: Developed by RedHat Inc. (RedHat Package Manager), after being accepted as the standard Pack manager, after renaming (RPM is the Packages manager) including Fedora, CentOS, SUSE, etc., its front-end tool has Y Um.


Basic features of Package Manager:
Packaged
Installation
Inquire
Upgrade
Unloading
Check
Database management


RPM Package named format:

SOURCE program: Name-version.tar. {GZ|BZ2|XZ}
Version is divided into three parts: the main version of major.minor.release. Minor version number. Issue number

RPM Package: name-version-release.arch.rpm
Release: usually contains the RPM production release number and also includes the applicable OS
bash-4.3.2-2.el6.x86_64.rpm

OS: Operating system platform and board
El6: Representing Redhat Enterprise Linux 6
El5: Representing Redhat Enterprise Linux 5
ARCH:CPU Architecture
x86_64
i386, i586, i686
Ppc
Noarch

NGINX-1.4.16-5.NOARCH.RPM (if the arch bit is not written or written noarch this is generally a common format)

is a package format description, (reference)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6E/7B/wKioL1V-YRnzLdLyAAKVsP1ht7w964.jpg "title=" 111. JPG "alt=" wkiol1v-yrnzldlyaakvsp1ht7w964.jpg "/>


In some cases it is not possible to install all the features in the package, and the package author has long thought about it. Such as:

A source: There are 10 features, most users only use its 6 functions, the remaining 4? This time the package may be subcontracting

Subcontract production: A large program is packaged into multiple packages
Main package: bash-4.3.2-2.el6.x86_64.rpm
Support Package: bash-hello-4.3.2-2.el6.x86_64.rpm
bash-world-4.3.2-2.el6.x86_64.rpm

such as Dns:bind, Bind-devel, Bind-libs, bind-utils


Verification of source legality:
SOURCE program: Through MD5 or SHA1 check code verification;
RPM Package: The legitimacy provided by publishers is credible
Verification Package Integrity: check code
Positive source legal: public key


Ways to get the RPM package:
1, the publisher's CD-ROM or site server
Take CentOS for example:
Http://mirrors.163.com
Http://mirrors.sohu.com
2, Http://rpmfind.net
3, Http://rpm.pbone.net


Note that the RPM package gets the path (relative security is not actually found in the above):
1, the publisher, the issue of CD-ROM package, the need to upgrade, the official release of the upgrade package;
2. Fedora EPEL (Googole search EPEL)

The RPM command uses

Format: RPM [option] package_name ...

Option

Installation

-I,--install installation

-V Displays installation information

-vv

-vvv

-h:hash, the number of # shows the installation progress,-a # number of 2%.

--test: Test installation Only, not really installed;

-IVH--replacepkgs: Re-install

The original profile is not overwritten and the newly installed profile is renamed to a file with a. rpmnew suffix.


Unloading

-E,--Erase Uninstall

--nodeps Ignore dependencies
If the uninstall by other programs depends on the package has three solutions: 1, the dependency of the uninstall, 2, ignore the dependency; 3, no longer uninstall


Query (Installed package)

-Q package_name: Query whether a single package has been installed

-QA: Query all installed packages

-qi package_name: Query Package description Information

-QL package_name: Query the files and paths generated by the installation package

-qf/path/to/somefile: Query which package is provided for a file

-QC package_name: Query the configuration file generated by the installation package

-Q--scripts package_name: Query installation package related scripts

There are four types of scripts:

                                     Preinstall: Pre-installation Scripts
                                      Postinstall: Post-installation script
                                     preuninstall: Pre-uninstall script
                                      postuninstall: Post-uninstall script      

Query (not installed package, add-p parameter on the above basis)

Rpm-qpl/path/to/package_file list of files generated after the query is installed

Rpm-qpi/path/to/package_file query its simple description information


Upgrade:

-U: Upgrade (install without installation)

-F: Upgrade only (package does not operate if not installed)

RPM {-UVH|-FVH}/path/to/package_file
--nodeps: Ignoring dependencies
--force: Forced installation

Note: Do not perform upgrade operations on the kernel;
Multiple versions of the kernel can coexist, therefore, it is recommended to perform installation operations;


Check:

Check if the files generated after the package installation have been modified;
Rpm-v package_name

The size of the S file size differs file has changed
M Mode differs (includes permissions and file type) has changed permissions
5 Digest (formerly MD5 sum) differs file MD5 code changed
D device Major/minor number mismatch equipment changed
L Readlink (2) path mismatch
U User ownership differs change of owner
G group ownership differs group changes
T MTime differs timestamp changed
P capabilities differ ability changes,


RPM Package Management: Verifying source legitimacy and package integrity
Package integrity: Through a one-way encryption mechanism (MD5|SHA1)
SOURCE legitimacy: Via Public key Cryptography (RSA)

Command: GPG (cryptographic tool), PGP (Cryptographic specification) GPG using PGP encryption specification

Check Order:
1, the public key of the import producer, the public key of the CentOS distribution is in the ISO file;
2. Import command: RPM--import/path/to/gpg-key-file

3. Check: Rpm-k/path/to/package_file
RPM--checksig/path/to/package_file
--nosignature: Does not check the legitimacy of the source
--nodigest: Does not check integrity, only check the source legitimacy.

RPM Package Management: Database rebuild
Database path:/var/lib/rpm/

Reconstruction:
RPM--INITDB: Initialization
If a database does not exist beforehand, the new one;
RPM--REBUILDDB: Rebuilding
Rebuilding the database directly will overwrite the original library;








RPM command use, package format

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.