Rpm Software Package Manager and usage

Source: Internet
Author: User
Tags gpg sha1


I. Introduction and composition of RPM:


1) RPM package introduction:

Rpm is divided into three types: source code package, Binary Package, and delta package. The source code package will be automatically compiled and installed by rpm.


2.) Package Manager in Linux:

Dpkg: Package Manager of the Debian release version.

Rpm: The Package Manager of the RedHat release.



3.) package components:

Binary program:

/Bin/sbin,/usr/bin/usr/sbin,/usr/local/bin

Some special programs are stored in the/libexec directory.

Some are installed in the/OPT directory by default.

Library files (Development Library, Runtime Library ):

/Lib64,/usr/lib64

Configuration file:

/Etc

Help file:

/Usr/share/man

Help File: Man, info.


4.) RPM package manager:

Database:

Program name and version number.

Software Package dependency.

Description of the software package.

Install the generated file path verification code.

Program Composition list:

File List.

Install and uninstall the script that runs.


Ii. RPM operation:


1) rpm installation package command.

* Information such as the Waring key is displayed multiple times during the installation process, and the key verification will be described later to solve the problem. This is temporarily ignored. -I: Install the package. # Rpm-I zsh-4.3.10-7.el6.x86_64.rpm warning: zsh-4.3.10-7.el6.x86_64.rpm: Header V3 RSA/sha1 signature, key ID c105b9de: nokey-V: displays detailed information upon installation. # Rpm-IV zsh-4.3.10-7.el6.x86_64.rpm preparing packages for installation... zsh-4.3.10-7.el6-VV: More detailed information than v. # Rpm-ivv zsh-4.3.10-7.el6.x86_64.rpm D: ================== zsh-4.3.10-7.el6.x86_64.rpm D: loading keyring from pubkeys in/var/lib/RPM/pubkeys /*. key D: couldn't find any keys in/var/lib/RPM/pubkeys /*. key D: loading keyring from rpmdb D: Opening dB environment/var/lib/rpm cdb: mpool: joinenv D: opening dB index/var/lib/RPM/packages rdonly mode = 0x0 D: Locked dB index/var/lib/RPM/packages D: Opening DB index/var/lib/RPM/name rdonly mode = 0x0-H: the installation progress bar is displayed with # during installation. Each # represents the progress of 2%. # Rpm-IVH zsh-4.3.10-7.el6.x86_64.rpm preparing... ######################################## ### [100%] 1: zsh ####################################### #### [2, 100%] -- test: test whether the tool can be installed. # Rpm-IVH -- Test zsh-4.3.10-7.el6.x86_64.rpm preparing... ######################################## ### [100%] Using rpm-Q to check whether this package is installed, -- the effect of test is displayed. # Rpm-Q zsh package zsh is not installed -- nodeps: Ignore dependency. # Rpm-IVH php-dba-5.3.3-26.el6.x86_64.rpm error: Failed dependencies: PHP-common (x86-64) = 5.3.3-26. el6 is needed by the normal installation on the php-dba-5.3.3-26.el6.x86_64 is not installed, show the need to rely on PHP-common package, the following is to ignore the dependency. It is not recommended that you install it like this. Even if it is installed, it may not be used. # Rpm-IVH -- nodeps php-dba-5.3.3-26.el6.x86_64.rpm preparing... ######################################## ### [100%] 1: php-DBA ##################################### ###### [100%] # rpm-q php-DBA php-dba-5.3.3-26.el6.x86_64 -- replacepkgs: the original configuration file has been modified during the re-installation and may not be replaced. Instead, the modified configuration file is renamed. rpmnew file. Or use the zsh package. # Rpm-QC zsh/etc/skel/. zshrc... modify the configuration file and add a # Hello word in the last line! # Rpm-IVH -- replacepkgs zsh-4.3.10-7.el6.x86_64.rpm preparing... ######################################## ### [100%] 1: zsh ####################################### #### [100%] at this time, the original configuration file was not renamed, use the original configuration file, and the last line is Hello woed.


2) run the RPM command to uninstall the software package.

-E: uninstall the RPM package. When I unmount the file, I am prompted that a configuration file has been modified and renamed and saved. # Rpm-e zsh warning:/etc/skel/. zshrc saved as/etc/skel/. zshrc. rpmsave # rpm-Q zsh package zsh Is Not Installed


3.) Upgrade the software package command.

-U: upgrade or installation. # Rpm-u zsh-4.3.10-7.el6.x86_64.rpm warning: zsh-4.3.10-7.el6.x86_64.rpm: Header V3 RSA/sha1 signature, key ID c105b9de: nokey package zsh-4.3.10-7.el6.x86_64 is already installed since no more (gè NG) new installation package, the following two steps are skipped. -F: Upgrade directly. -- Force: Force installation and upgrade.


4.) rpm query Operation Command.

-Q: Check whether the software package is installed. # Rpm-Q zsh zsh-4.3.10-7.el6.x86_64-AP: Query all installed software packages. # Rpm-Qa | more system-config-firewall-base-1.2.27-5.el6.noarch tcp_wrappers-7.6-57.el6.x86_64 sinjdoc-0.5-9.1.el6.x86_64 gtksourceview2-2.8.2-4.el6.x86_64 dejavu-fonts-common-2.30-2.el6.noarch...-Qi: queries the installation information for a software package. # Rpm-Qi zsh name: zsh relocations: (not relocatable) version: 4.3.10 vendor: centos release: 7. el6 build Date: Mon 25 Nov 2013 01:40:59 am C install Date: Sun 20 Jul 2014 11:01:39 am CST build host: c6b9. bsys. dev. centos. O group: System Environment/shells source RPM: zsh-4.3.10-7.el6.src.rpm size: 5009102 license: BSD Signature: RSA/sha1, mon 25 Nov 2013 03:33:46 am Cst, key ID 0946fca2c105 B9de packager: centos buildsystem <-Ql: query the files generated by the installation package. # Rpm-QL zsh | more/bin/zsh/etc/skel /. zshrc/etc/zlogin/etc/zlogout/etc/zprofile/etc/zshenv/etc/zshrc/usr/lib64/zsh/usr/lib64/zsh/4.3.10-QC: query the configuration file generated by the installation package. # Rpm-QC zsh/etc/skel /. zshrc/etc/zlogin/etc/zlogout/etc/zprofile/etc/zshenv/etc/zshrc-QD: query the Help file generated by the installation package. # Rpm-Qd zsh | more/usr/share/doc/zsh-4.3.10/bugs/usr/share/doc/zsh-4.3.10/contributors/usr/share/doc/zsh-4.3.10/faq/usr/ share/doc/zsh-4.3.10/Features/usr/share/doc/zsh-4.3.10/Licence/usr/share/doc/zsh-4.3.10/machines/usr/share/doc/zsh-4.3.10/news-Q -- scriptes: query the script of the software package. There are four types of scripts: Pre-installation scripts. Script after installation. Script before uninstallation. Script after uninstallation. # Rpm-Q -- scripts zsh postinstall scriptlet (using/bin/sh): If [! -F/etc/shells]; then ECHO "/bin/zsh">/etc/shells else grep-Q "^/bin/zsh $"/etc/shells | echo "/bin/zsh"> /etc/shells Fi if [-F/usr/share/INFO/zsh.info.gz]; then # This is needed so that -- excludedocs works .... -QF: queries the software package that generates a file. # Rpm-qf/etc/zshenv zsh-4.3.10-7.el6.x86_64-QP: queries a package that has not been installed. # Rpm-QP zsh-4.3.10-7.el6.x86_64.rpm zsh-4.3.10-7.el6.x86_64


5) Check the software package source validity and integrity.

Rpm -- import key does not prompt warning at this time. # Rpm -- import/Media/RPM-GPG-KEY-CentOS-6 # rpm-QP zsh-4.3.10-7.el6.x86_64.rpm zsh-4.3.10-7.el6.x86_64 displays the imported public key: rpm-Qa GPG-pubkey * # rpm-Qa GPG-pubkey * gpg-pubkey-c105b9de-4e0fd3a 3 rpm-Qi GPG-pubkey-name # rpm-Qi gpg-pubkey-c105b9de-4e0fd3a3 name: GPG-pubkey relocations: (not relocatable) version: c105b9de vendor: (none) Release: 4e0fd3a3 build Date: Sun 20 Jul 2014 11:13:27 am C install Date: Sun 20 Jul 2014 11:13:27 am CST build host: localhost group: public Keys source RPM: (none) Size: 0 license: pubkey Signature: (none) Summary: GPG (CentOS-6 key (centos 6 official signing key) <[email protected] Description :...


Iii. RPM Software Package database.

Re-build the RPM database:

Rpm database Directory:/var/lib/RPM reconstruction: rpm -- initdb: initialization. If no database exists, a new one will be created. If yes, no new one will be created. Rpm -- rebuilddb: directly rebuilt to overwrite the original database. # Cd/var/lib/RPM # tar czvf rpm-db.tgz. /_ db00 * # rpm -- rebuilddb found the error message of the RPM database online: Warning: Waiting for transaction lock on/var/lib/RPM/_ db.000 error: can't create transaction lock on/var/lib/RPM/_ db.000 at this time, their solution is to recreate the database.


Summary:

When using uninstall and query, do not follow the full name of the software package, but take the letter before the version number for operations.

If you really need to re-build the RPM database, you need to back up and re-build the database first.

When installing the RPM software package, if you need to install the dependent packages, install them one by one, or use yum for installation. It is best not to use force installation or ignore dependency installation. Even if the installation is successful, the software package may not run.

Verify the validity of a third-party software package. Download from a reliable site.




Rpm Software Package Manager and usage

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.