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
install

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

Example:

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

upgrade

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

 

[Install-options]

     --oldpackage   downgrade installation

     --force       ignoring conflicts, enforcing

 

Note:

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;

Example:

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

Unloading

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

--nodeps Ignore dependencies

--test Unloading test

Example:

[Root@localhost ~]# Rpm-ev Package

Inquire

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

[Select-options]

1. Check if the package is installed

Rpm-q package_name ...

2. Query all installed Packages

Rpm-qa

3. Query which package is generated by a file

Rpm-qf/path/to/somefile

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

RPM-QP Package_file

[Query-options]

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

Rpm-q--scripts

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

Example:

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

checksum

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

Example:

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

Example:

[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

RPM {--INITDB|--REBUILDDB}

Initialization:--initdb

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

Re-structuring:--REBUILDDB

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

Example:

[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:

/etc/yum.conf

/etc/yum.repos.d/*.repo

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.