Detailed interpretation rpm package management

rpm package management

CentOS system using the command rpm package management: installing, uninstalling, upgrading, querying, validation, database maintenance

1. Basic Installation

rpm -ivh  PackageFile

2.rpm Options

rpm {-i|--install} [install-options] PACKAGE_FILE…

-i: install 
-v: display process 
-vv: 
-h: # to display the progress of the implementation of the package manager 
--e: uninstall package 
--test: test installation, but does not actually perform the installation, namely dry run mode 
--nodeps: ignore dependency 
--replacepkgs | ReplaceFiles: If you have the same file, overwriting conflicting files 
--nosignature: Do not check the legitimacy of sources 
--nodigest: Do not check package integrity 
--noscripts: package script does not execute

Example:

When the installation package, and the path name of the package is necessary to write the whole, where / misc / cd / Packages path is an optical disc, back to keep the full name of the installation package

[root@centos6~]#rpm -ivh /misc/cd/Packages/lrzsz-0.12.20-27.1.el6.x86_64.rpm 
Preparing...                ########################################### [100%]
	package lrzsz-0.12.20-27.1.el6.x86_64 is already installed

Uninstall package: If we have installed a package on a direct uninstall, do not need to keep up with the path and extension packages, write directly to the package name, you can uninstall.

[root@centos6~]#rpm -e tree

Example: rpm packages installed by default in the root directory, we can specify a different installation path

[Root @ centos6data] --root = / data / --nodeps data to specify the installation directory #rpm -ivh /misc/cd/Packages/tree-1.5.3-3.el6.x86_64.rpm, ignore dependencies

Example: rpm query command from which package, you can view the program type by type, then there program path:

[root@centos6data]#type rpm
/bin/rpm
[root@centos6data]#rpm -qf /bin/rpm
rpm-4.8.0-59.el6.x86_64

3.rpm upgrade package 

rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...
rpm {-F|--freshen} [install-options] PACKAGE_FILE ...

upgrade: legacy package is installed, the "upgrade" 
If the package is not present legacy, the "install" 
freshens a: legacy package is installed, the "upgrade" 
If the package does not exist legacy upgrade operation is performed 
rpm -Uvh PACKAGE_FILE ... upgrade package operating 
rpm -Fvh PACKAGE_FILE ... upgrade package operating 
--oldpackage: downgrade 
--force: force install

Note:
(1) do not do the kernel upgrade; Linux support for multi-core versions co-exist, therefore, directly install the new version of the kernel, the coexistence of multi-core, so that more of a guarantee
(2) If the original package configuration files are installed been modified, upgrade, the new version provides the same configuration file does not directly cover the old version of the configuration file, the new version of the file is renamed
(FILENAME.rpmnew) after reservations

4. Package inquiry

rpm {-q|--query} [select-options] [query-options]

Options:

-a: All packages 
-f: View the file specified by the installation package which generates 
-p rpmfile: do query operations against the package file has not been installed 
--changelog: Query rpm package ChangeLog 
-c: query program configuration files 
- d: Archie program 
-i: information package information 
-l: View the specified package generated after installing all the file list 
--scripts: the package comes with the script 
--provides: list CAPABILITY specified package provided by 
-R: query the specified package depends CAPABILITY

Example:

If we want to find the current package from which the package is installed, when a query at this time, you need to type a query path for this package, and then when -qf rpm installation package, you need to write the full path

[root@centos6~]#type tree
/usr/bin/tree
[root@centos6~]#rpm -qf /usr/bin/tree
tree-1.5.3-3.el6.x86_64

Example:

See all information currently installed package:

rpm -qpi package name: you can query all of the information package is not currently installed.

[root@centos6~]#rpm -qi bash
Name        : bash                         Relocations: (not relocatable)
Version     : 4.1.2                             Vendor: CentOS
Release     : 48.el6                        Build Date: Thu 23 Mar 2017 08:17:20 AM CST
Install Date: Thu 22 Aug 2019 03:07:43 PM CST      Build Host: c1bm.rdu2.centos.org
Group       : System Environment/Shells     Source RPM: bash-4.1.2-48.el6.src.rpm
Size        : 3142529                          License: GPLv3+
Signature   : RSA/SHA1, Thu 23 Mar 2017 10:59:39 PM CST, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
URL         : http://www.gnu.org/software/bash
Summary     : The GNU Bourne Again shell
Description :
The GNU Bourne Again shell (Bash) is a shell or command language
interpreter that is compatible with the Bourne shell (sh). Bash
incorporates useful features from the Korn shell (ksh) and the C shell
(csh). Most sh scripts can be run by bash without modification.

5, the package check

Storing the data information in the initial installation of software rpm database, check the package when using the information in the database will take over for current information, which is believed to modify or coverage can be found too.
Check whether the package using rpm -V been modified.

rpm -Va system can verify whether the entire packet has been modified.

Detailed explanation of the calibration parameters:

Package source of legitimacy and integrity verification test positive

  • Integrity Verification: SHA256
  • Source legality verification: RSA

Public key encryption

  • Symmetric encryption: encryption, decryption using the same key
  • Asymmetric encryption: key pairs of children
  • public key: public, open for all
  • secret key: the private, not public

Import the required public key

  • rpm -K | checksig rpmfile checking the integrity of packages and signature
  • rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
  • CentOS 7 Release CD-ROM: RPM-GPG-KEY-CentOS-7
  • rpm -qa “gpg-pubkey*”

6.rpm package database

rpm package during installation will generate a database file, the package name and version, dependency, functional description, generated after each installation package file path and check information.

  • Stored in the database directory / var / lib / rpm in the beginning of the file to __db
  • Initialize the database rpm -initdb database does not exist is created, there is no action
  • Reconstruction of the installed database index header directory rpm -rebulidb

7. combat:

Delete the rpm package, recovery of:

[root @ ansible ~] #rm -rf delete RPM RPM 
[root @ ansible ~] # rpm2cpio /misc/cd/Packages/rpm-4.11.3-35.el7.x86_64.rpm | cpio -it first check CD rpm package 
./bin/rpm 
[ansible the root @ ~] # rpm2cpio /misc/cd/Packages/rpm-4.11.3-35.el7.x86_64.rpm | ./bin/rpm the cpio -id individual packets decompress 
Blocks 5182 
[ansible the root @ ~] #ls ./bin/rpm view this directory package 
./bin/rpm 
[ansible the root @ ~] #mv ./bin/rpm / usr / bin / rpm rpm package is then moved to current / usr / bin / rpm directory

  

 

  

  

 

 

Guess you like

Origin www.cnblogs.com/struggle-1216/p/11823707.html