RPM Package Management Detailed

Source: Internet
Author: User
Tags gpg

The RPM command management package on the CentOS system


One, RPM package management is divided into installation, upgrade, uninstall, query and calibration, database maintenance


Installation of RPM packages

The option parameters added after the rpm command are:

RPM-IVH, the installation of the package, followed by the name of the package to be installed, for example:

[Email protected] packages]# RPM-IVH zsh-5.0.2-14.el7.x86_64.rpm

In preparation ... ################################# [100%]

Upgrading/installing ...

1:zsh-5.0.2-14.el7 ################################# [100%]

-I, install package

-V, which shows the details.

-VV, displays a more detailed output of the information.

-H, the output progress bar, each # represents 2% progress.

--test: Test installation, check for and report dependencies and conflicting messages, etc.:

[Email protected] packages]# RPM-IVH--test zsh-html-5.0.2-14.el7.x86_64.rpm

In preparation ... This operation is only a test and is not installed.

--nodeps: Ignore dependencies, which can be used when prompted to have dependencies on the installation, but half is not recommended: for example

[Email protected] packages]# RPM-IVH--nodeps zziplib-0.13.62-5.el7.i686.rpm

In preparation ... ################################# [100%]

Upgrading/installing ...

1:zziplib-0.13.62-5.el7 ################################# [100%]

--replacepkgs: Reinstall (before reinstalling, remove the previously installed programs, and then install, otherwise, the previous configuration file changed, re-install is not used, so you have to remove and then reinstall)

[Email protected] packages]# RPM-IVH--replacepkgs zsh-5.0.2-14.el7.x86_64.rpm

In preparation ... ################################# [100%]

Upgrading/installing ...

1:zsh-5.0.2-14.el7 ################################# [100%]

--nosignature: does not check package signature information and does not check the legitimacy of the source, for example the command is used as follows:

[Email protected] packages]# RPM-IVH--replacepkgs--nosignature zsh-5.0.2-14.el7.x86_64.rpm

In preparation ... ################################# [100%]

Upgrading/installing ...

1:zsh-5.0.2-14.el7 ################################# [100%]

--nodigest: The package integrity information is not checked, and the command is used as follows:

[Email protected] packages]# RPM-IVH--replacepkgs--nodigest zsh-5.0.2-14.el7.x86_64.rpm

In preparation ... ################################# [100%]

Upgrading/installing ...

1:zsh-5.0.2-14.el7 ################################# [100%]

RPM Package Upgrade:

RPM Plus option parameters

-U: Upgrade or install

-F: Upgrade

RPM-UVH Upgrade or install packages

RPM-FVH Upgrade Package

RPM--oldpackage: Downgrade package

RPM--force: Force upgrade Package

RPM Package Uninstallation:

-e Uninstall package, uninstall the package name only after the parameter is unloaded. For example:

[Email protected] packages]# rpm-e zsh

--allmatches: Uninstalls all versions of packages that match the specified name: for example:

[Email protected] ~]# rpm-e--allmatches zsh

--nodeps: Ignore dependencies: for example

[Email protected] packages]# rpm-e--nodeps zsh

--test: Test Uninstall, dry run mode, is the query, not uninstall;

[Email protected] packages]# RPM-EVH--test zsh

In preparation ... ################################# [100%]

RPM Package Query:

RPM Plus parameter options:

-Q: Query for a single package that has already been installed, plus the package name after the parameter:

[Email protected] packages]# rpm-q zsh

Zsh-5.0.2-14.el7.x86_64

-QA: Query all installed packages, for example:

[Email protected] packages]# RPM-QA

-QA: If the number of packages being queried is too large, you can find them with regular expressions, for example:

[Email protected] packages]# Rpm-qa | grep "^zsh"

Zsh-html-5.0.2-14.el7.x86_64

Zsh-5.0.2-14.el7.x86_64


-f:file queries which package the specified file is installed by: (This command statement is to query which package installation of the Fstab file is generated) for example:

[Email protected] packages]# Rpm-qf/etc/fstab

Setup-2.8.71-6.el7.noarch


-QPL,--package Package_file: Used to implement query operations on packages that are not installed;

[Email protected] packages]# RPM-QPL zsh-5.0.2-14.el7.x86_64.rpm

--whatprovides CAPABILITY: Query which package is provided by the specified CAPABILITY, for example:

[Email protected] packages]# rpm-q--whatprovides Bash

Bash-4.2.46-19.el7.x86_64


--whatrequires CAPABILITY: The query specifies which package the CAPABILITY is dependent on, for example:

[Email protected] packages]# rpm-q--whatrequires Bash

Initscripts-9.49.30-1.el7.x86_64

Rsyslog-7.4.7-12.el7.x86_64

Bash-completion-2.1-6.el7.noarch

Dracut-033-360.el7_2.x86_64

Libguestfs-1.28.1-1.55.el7.centos.x86_64

Autofs-5.0.7-54.el7.x86_64

Lvm2-2.02.130-5.el7_2.1.x86_64

Kpatch-0.3.1-1.el7_2.noarch

Rpm-q--changelog: Check the changelog of RPM package (modified date)

[Email protected] packages]# rpm-q--changelog zsh | Less


-QL: A list of all files generated by the query program installation: for example:

[Email protected] packages]# RPM-QL Bash | Wc-l

-qi: View Package-related information, version number, size, the package group to which it belongs, etc.;

[Email protected] packages]# Rpm-qi bash

Name:bash

version:4.2.46

Release:19.el7

Architecture:x86_64

Install date:2016 March 18 Friday 00:24 53 seconds

Group:system Environment/shells

size:3663618

license:gplv3+

signature:rsa/sha256, November 25, 2015 Wednesday 22:14 53 seconds, Key ID 24c6a8a7f4a80eb5

Source rpm:bash-4.2.46-19.el7.src.rpm

Build date:2015 November 20 Friday 13:04 53 seconds

Build Host:worker1.bsys.centos.org

Relocations: (Not relocatable)

Packager:centos Buildsystem

Vendor:centos

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's compatible with the Bourne shell (SH). Bash

Incorporates useful features from the Korn shell (Ksh) and the C shell

(CSH). Most SH scripts can is run by bash without modification


-QC: Queries the configuration file provided by the specified package: for example:

[Email protected] packages]# RPM-QC bash

/etc/skel/.bash_logout

/etc/skel/.bash_profile

/etc/skel/.bashrc

-QD: Queries the help documentation provided by the specified package: for example:

[Email protected] packages]# RPM-QD bash

/usr/share/doc/bash-4.2.46/copying

/usr/share/info/bash.info.gz

/usr/share/man/man1/. 1.gz

/usr/share/man/man1/:.1.gz

/usr/share/man/man1/[.1.gz

/usr/share/man/man1/alias.1.gz

/usr/share/man/man1/bash.1.gz

/usr/share/man/man1/bashbug-64.1.gz

/usr/share/man/man1/bashbug.1.gz

/usr/share/man/man1/bg.1.gz

/usr/share/man/man1/bind.1.gz

/usr/share/man/man1/break.1.gz

/usr/share/man/man1/builtin.1.gz

/usr/share/man/man1/builtins.1.gz

/usr/share/man/man1/caller.1.gz

/usr/share/man/man1/cd.1.gz

/usr/share/man/man1/command.1.gz

/usr/share/man/man1/compgen.1.gz

/usr/share/man/man1/complete.1.gz

/usr/share/man/man1/compopt.1.gz

/usr/share/man/man1/continue.1.gz

/usr/share/man/man1/declare.1.gz

/usr/share/man/man1/dirs.1.gz

/usr/share/man/man1/disown.1.gz

/usr/share/man/man1/enable.1.gz

/usr/share/man/man1/eval.1.gz

/usr/share/man/man1/exec.1.gz

/usr/share/man/man1/exit.1.gz

/usr/share/man/man1/export.1.gz

/usr/share/man/man1/fc.1.gz

/usr/share/man/man1/fg.1.gz

/usr/share/man/man1/getopts.1.gz

/usr/share/man/man1/hash.1.gz

/usr/share/man/man1/help.1.gz

/usr/share/man/man1/history.1.gz

/usr/share/man/man1/jobs.1.gz

/usr/share/man/man1/let.1.gz

/usr/share/man/man1/local.1.gz

/usr/share/man/man1/logout.1.gz

/usr/share/man/man1/mapfile.1.gz

/usr/share/man/man1/popd.1.gz

/usr/share/man/man1/pushd.1.gz

/usr/share/man/man1/read.1.gz

/usr/share/man/man1/readonly.1.gz

/usr/share/man/man1/return.1.gz

/usr/share/man/man1/set.1.gz

/usr/share/man/man1/sh.1.gz

/usr/share/man/man1/shift.1.gz

/usr/share/man/man1/shopt.1.gz

/usr/share/man/man1/source.1.gz

/usr/share/man/man1/suspend.1.gz

/usr/share/man/man1/times.1.gz

/usr/share/man/man1/trap.1.gz

/usr/share/man/man1/type.1.gz

/usr/share/man/man1/typeset.1.gz

/usr/share/man/man1/ulimit.1.gz

/usr/share/man/man1/umask.1.gz

/usr/share/man/man1/unalias.1.gz

/usr/share/man/man1/unset.1.gz

/usr/share/man/man1/wait.1.gz

--provides: Lists all the capability provided by the specified package, for example;

[Email protected] packages]# rpm-q--provides Bash

/bin/bash

/bin/sh

bash = 4.2.46-19.el7

Bash (x86-64) = 4.2.46-19.el7

Config (bash) = 4.2.46-19.el7

-R: Queries the dependencies of the specified package :

[[email protected] packages]# Rpm-q-R bash

/bin/sh

Config (bash) = 4.2.46-19.el7

Libc.so.6 () (64bit)

Libc.so.6 (glibc_2.11) (64bit)

Libc.so.6 (glibc_2.14) (64bit)

Libc.so.6 (glibc_2.15) (64bit)

Libc.so.6 (glibc_2.2.5) (64bit)

Libc.so.6 (glibc_2.3) (64bit)

Libc.so.6 (glibc_2.3.4) (64bit)

Libc.so.6 (glibc_2.4) (64bit)

Libc.so.6 (glibc_2.8) (64bit)

Libdl.so.2 () (64bit)

Libdl.so.2 (glibc_2.2.5) (64bit)

Libtinfo.so.5 () (64bit)

Rpmlib (builtinluascripts) <= 4.2.2-1

Rpmlib (compressedfilenames) <= 3.0.4-1

Rpmlib (filedigests) <= 4.6.0-1

Rpmlib (payloadfileshaveprefix) <= 4.0-1

Rtld (Gnu_hash)

Rpmlib (PAYLOADISXZ) <= 5.2-1


--scripts: View the script fragment that comes with the package: for example

[Email protected] packages]# rpm-q--scripts Bash

Postinstall scriptlet (using <lua>):

NL = ' \ n '

SH = '/bin/sh '. nl

bash = '/bin/bash '. nl

f = io.open ('/etc/shells ', ' A + ')

If F Then

Local shells = nl. F:read (' *all '): nl

If not Shells:find (nl. SH) then f:write (SH) end

If not Shells:find (nl. BASH) then f:write (bash) end

F:close ()

End

Postuninstall scriptlet (using <lua>):

--Run It only if we is uninstalling

If arg[2] = = "0"

Then

t={}

For line in Io.lines ("/etc/shells")

Do

If line ~= "/bin/bash" and line ~= "/bin/sh"

Then

Table.insert (T,line)

End

End


f = Io.open ("/etc/shells", "w+")

For n,line in pairs (t)

Do

F:write (line..) \ n ")

End

F:close ()

End

RPM Package Checksum:

RPM Plus parameter options:

-V: Verify that the program files have been altered:

[Email protected] packages]# File/usr/share/zsh/5.0.2/functions/ztodo

/usr/share/zsh/5.0.2/functions/ztodo:ascii text

[Email protected] packages]# vim/usr/share/zsh/5.0.2/functions/ztodo[[email protected] packages]# rpm-v zsh

S.5 .... T./usr/share/zsh/5.0.2/functions/ztodo


Obtain and import the key for the trusted package author:

CENTOS7 's public key in the house ls/etc/pki/rpm-gpg.

For the CentOS release: RPM--import/etc/pki/rpm-gpg/rpm-gpg-key-centos-7

Database rebuild:

RPM Manager database path:/var/lib/rpm/

Query operations: Through the database here:

Get help:

CentOS 6:man rpm

CentOS 7:man Rpmdb

RPM {--INITDB|--REBUILDDB} [--dbpath directory] [--root directory]

--INITDB: Initializes the database, currently no database can be initialized to create a new one, and sometimes does not perform any operations;

--REBUILDDB: Rebuilt, re-created by reading all installed packages on the current system, for example:


[Email protected] packages]# mkdir/tmp/rpm

[Email protected] packages]# rpm--initdb--dbpath=/tmp/rpm

[Email protected] packages]# ls/tmp/rpm

Basenames __db.003 Name Requirename

Conflictname dirnames Obsoletename Sha1header

__db.001 Group Packages SIGMD5

__db.002 Installtid providename Triggername

[Email protected] packages]# rpm--REBUILDDB--dbpath=/tmp/rpm

[Email protected] packages]# ls/tmp/rpm

Basenames Group obsoletename requirename triggername

Conflictname Installtid Packages Sha1header

Dirnames Name Providename SIGMD5


The above is the RPM command management package operation detailed, hope to add again, continue efforts.

This article is from the "Li Wenming blog" blog, make sure to keep this source http://liwenming18.blog.51cto.com/11068518/1753185

RPM Package Management Detailed

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.