CentOS System Package Manager "RPM, yum"

Source: Internet
Author: User
Tags file size ftp gpg md5 sha1 centos file permissions
Package Manager
Package compiled files into one or a limited number of files, can be used for easy installation, uninstall, upgrade, query, calibration and other program management. The common program Manager for CentOS is rpm and Yum

Rpm:redhat Package Manager, RPM are package Manager

RPM is a package management method developed by Red Hat, which allows us to install, query, uninstall and upgrade the software conveniently. However, the dependencies between RPM packages are often cumbersome, especially when the software is made up of multiple RPM packages.

The name of the RPM package
For example, bash-4.3.2-1.centos6.x86_64.rpm
rpm application

RPM {-i|--in Stall} [Install-options] package_file ...


-I             Install

-V             Show details, overlay use to view more details, such as-VV,-VVV

-H             Show progress with 50 # as a progress bar


              We typically use-IVH to install RPM packages


--nodeps       Remove dependencies

--replacepkgs Reinstall

--test         test the installation, not the actual installation


[root@localhost ~]# rpm-ivh package.rpm


RPM {-u|--upgrade} [install-options] Package_file ...

      If there is an older version of the package, install the upgrade or install it directly

RPM {-f|--freshen} [install-options] package_file ...

      If there is an older version of the package, upgrade the installation; if not, then terminate


      We typically use-UVH,-FVH to install RPM packages



     --oldpackage   downgrade installation

     --force       ignoring conflicts, enforcing



Do not upgrade the kernel package; Linux supports multiple versions of the kernel, so the new kernel can be installed directly;

If the original package configuration file has been modified after the upgrade, the new version of the file will not directly overwrite the old version of the file, but the new version of the file (suffix. rpmnew) After the name of the reservation;


[root@localhost ~]# rpm-uvh package.rpm


RPM {-e|--erase} [--allmatches] [--nodeps] [--noscripts] [--notriggers] [--test] package_name ...

--nodeps Ignore dependencies

--test Unloading test


[Root@localhost ~]# Rpm-ev Package


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


1. Check if the package is installed

Rpm-q package_name ...

2. Query all installed Packages


3. Query which package is generated by a file


4. Query for information about packages that have not been installed

RPM-QP Package_file


1, query A package of brief description information

Rpm-qi package_name

2. Query the list of all files generated after the installation of a package

RPM-QL package_name

3. Query the list of all configuration files generated after a package is installed

RPM-QC package_name

4. Query the list of all help files generated after a package is installed

RPM-QD package_name

5, query a RPM package production with the version of the Changelog list information

Rpm-q--changelog Package_name

6. Query the capabilities provided by a package

Rpm-q--provides Package_name

7, query the capabilities that a package depends on

Rpm-q--requires Package_name

8. Query the script when loading and unloading a package


There are four types of scripts available when loading and unloading:

Preinstall: Scripts executed prior to installation

Postinstall: Script to execute after installation

Preuninstall: Scripts executed prior to uninstallation

Postuninstall: script executed after uninstallation


Querying all installed RPM packages in the system

[Root@localhost ~]# Rpm-qa

Query the list of files included in the RPM package

[Root@localhost ~]# RPM-QLP Package

Query the list of Help files included in the RPM package

[Root@localhost ~]# RPM-QDP Package


RPM {-v|--verify} [select-options] [verify-options ]

Common usage: rpm-v package_name


After a file change, the check has the following related information:


5: File's MD5 check value

S: File size

L: Link file

T: File creation time

D: Device file

U: File user

G: File user group

M: File permissions


First modify the yum.conf file with vim, then verify

[root@localhost ~]# rpm-v yum.conf

S.5 .... T.  c/etc/yum.conf

package source legitimacy and completeness validation

rpm--import PubKey ...

    Import keys

RPM {-k|--checksig} [--nosignature] [--nodigest] package_file ...

    Authentication keys

   --nosignature: Do not check the legitimacy of the source

    --nodigest: Do not check integrity


[root@localhost ~]# rpm--import/etc/pki/rpm-gpg/rpm-gpg-key-redhat-*

[roo T@localhost ~]# rpm-k/var/ftp/pub/server/kernel-pae-2.6.18-194.el5.i686.rpm

/var/ftp/pub/server/ KERNEL-PAE-2.6.18-194.EL5.I686.RPM: (SHA1) DSA SHA1 MD5 GPG OK

Public database:/var/lib/rpm

Rebuilding the database



New if no data exists in advance; otherwise, no action is taken


Rebuilds and overwrites the existing database directly, regardless of whether the database is already present


[Root@localhost ~]# rpm--INITDB

[Root@localhost ~]# rpm--REBUILDDB

Yum:yellow Dog updater,modified

The main function is more convenient to add/remove/update RPM package, it can automatically solve the dependency problem of the package, easy to manage a large number of system update problems

Configure the Yum warehouse

Yum Warehouse profile:

Point to warehouse location and various configuration information; Each Yum customer can have Multiple available yum warehouses


Main profiles are:



High-level usage of the Yum client configuration:

1, if you have more than one Yum warehouse, you want to use it first, you can add a line in the profile to define the usage cost value of the warehouse, the default value is 1000, the lower the value the higher the precedence

For example: CO st=400

2, you can use variables when specifying paths in BaseURL,

For example: http://mirrors.sohu.com/centos/$releasever/os/$basearch

3, You can use the Mirrorlist directive to replace BaseURL

With a URL that is a text file that holds a large number of mirror server lists, and when users use the Yum repository, they get this list file. Then through the Fastestmirror plug-in to determine which mirror is the fastest access to the server, and as a baseurl

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.