Linux package management principles and basic usage of--rpm and Yum

Source: Internet
Author: User
Tags yum repolist

The packages in Linux are divided into two main categories: Binary executable installation package and source code program file package. This article focuses on using the RPM Package Manager and the Yum Manager front-end tool to implement the installation, query, upgrade, and uninstallation of the binary executable installation package.


Linux in the binary executable installation package will involve more than one file operation, the process will be more complex, in order to simplify the process of using the program installation Package Manager to manage the package installation process, greatly simplifying the package installation process.

Depending on the distribution, Linux uses a different package Manager to manage the package, which focuses on two major branches:

Debian: Using the DPT Manager, using Deb as the manager front-end tool, the package file format is Deb

Redhat: Using the RPM manager, using Yum as the manager front-end tool, the package file format is rpm

Note: The difference between the Deb front end tool and the Deb format package in the specific environment, the RPM Manager and the RPM format package are the same.


RPM Package production and installation process:

RPM Package authors compile the software source code on specific hardware environments and operating system distributions, compile the source files into binary executable files, and generate the default database files for the software itself, which records the software dependencies required to install the software. Package executable program files and database files to generate an installation package in RPM format


RPM Package Naming method

Name-version-arch. Rpm

VERSION = Major. Minor. Release is the same as source package version

ARCH = release. [OS]. Arch

Release refers to the release of RPM, the version of RPM to be compiled and released

OS refers to the type of operating system at compile time

Arch refers to the hardware environment at compile time, generally using CPU type to refer to


When the RPM user installs the RPM package, the RPM package management software (DPT or RPM) in the host will see if the dependent software is satisfied based on the database file in the package:

Install when conditions are met and write software information to the local RPM management software database (/var/lib/rpm directory) for easy follow-up of software queries, validations and upgrades

cannot be installed when conditions are not met, ==> needs to be installed using Yum (discussed later)


Major limitations of RPM packages

1. The Software installation environment must be the same as the RPM package when making the environment

2. Need to meet the dependencies between software requirements


RPM Package Manager Command RPM method of use:

Common options:

-V: Displays the installation process

-H: Displays the installation progress in # form


Because RPM commands are used in many environments, there are different syntax formats in different environment modes

A. installation mode

Syntax: rpm {-i|--install} [install-options] package_file ...

Role: For installing packages

Install-options Installation options:

--test: Test installation, but do not actually perform the installation process; dry run mode;

--nodeps: Ignoring dependencies;

--replacepkgs: Reinstall;

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

--nodigest: does not check package integrity;

EX:RPM-IVH package_file to display the installation package as a process and progress method


B. Upgrade mode

Syntax:

RPM {-u|--upgrade} [install-options] package_file ... the old version exists and is upgraded; Install if old version does not exist

RPM {-f|--freshen} [install-options] package_file ... upgrade to older versions only if older versions are installed: upgrading packages

Install-options Upgrade Options:

--oldpackage: Downgrade;

--force: Forced escalation;


C. Query mode

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

Role: Used to display information about the package, query the installed RPM package does not need to use the version number, query does not install RPM package need to use version number

Select-options Selection Options:

-A: All packages

-F file: To see which package installation builds the specified file

-p/path/to/package_file: Query operation for the package files that have not been installed;

--whatprovides CAPABILITY: Query The specified CAPABILITY is provided by which package;

--whatrequires CAPABILITY: The query specifies which packet the CAPABILITY is dependent on;

Query-options Query Options:

--changelog: Query rpm Package for Changlog

-C: Querying the program's configuration file

-D: Querying the program's documentation

-i:information

-L: View all files generated after the installation of the specified package;

--scripts: Script fragment with package comes in

-r: Query the capability that the specified package depends on;

--provides: Lists the capability provided by the specified package;


D. Unload mode

Syntax: rpm {-e|--erase} [--allmatches] [--nodeps] [--noscripts] [--notriggers] [--test] package_name ...

Role: Used to unload the specified package

Options:

--noreps: Ignore dependencies for uninstallation


E. Calibration Mode

Syntax: rpm {-v|--verify} [select-options] [verify-options]

Role: Used to verify package integrity

The output field meaning of the checksum mode:

S: Whether the size of the file changes

M: File type or file rwx property changed

5:md5 whether the fingerprint code changes

D: Whether the primary and secondary code of the device changes

L: Whether the link path changes

U: Whether the owner of the file has changed

G: Whether the genus Group of the file has changed

T: Does the mtime of the file change

P: Whether the function has changed

# when installing with RPM, you need to import the key first, import the software public key via RPM--import/path/gpgkey, and verify the source legitimacy of the package by viewing and comparison of the public key information


The above is the RPM Package management related principles and basic operations


=============================================================

Yum Package Installation Principle

Yum as the front-end management tool for RPM, the main implementation is to install the package, through the dependencies between the package, get all the dependencies of the package, to achieve the successful installation of the package

# Yum extends the functionality of the RPM Package Manager by relying on the RPM Package manager, so Yum cannot run independently from rpm


650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/72/6B/wKiom1XjJNXTaVCWAAHMztEg1-o462.jpg "title=" Yum principle. jpg "alt=" wkiom1xjjnxtavcwaahmzteg1-o462.jpg "/>


The implementation principle of the Yum function

Yum can be seen as a CS-architecture software

The server side first classifies the packages and stores them in different repository containers; Then, by collecting the dependency data between the packages in a large number of RPM database files, generate the corresponding dependency and the required files in the local storage location of the description file (. xml format), stored in the local Repodata directory for client-side access

The cilent side discovers that some dependency packages are missing when installing the software through the Yum command, and the client locates the specified SERVER side based on the local configuration file (/etc/repodata.d/server.repo). Obtain the description file from the server-side repo directory xxx.xml stored in the local/var/cache/yum for later reading, through the Xxx.xml file to find the dependencies that need to be installed on the server side of the storage location, Then get the required packages in the specified repository container in the server-side Yum Library, and implement the installation locally after the download is complete


Yum Client configuration file description

The user can edit the profile *.repo in the/etc/yum.repos.d/directory of the Local system to specify Yum server, where multiple servers can be specified by repo_id to differentiate, so different repo_id in the same file cannot have duplicate names

[REPO_ID] # Unique identifier of the EPO repository, do not have duplicate ID in the same file
name=description# brief information used to describe the repo
Baseurl=ftp://|http://|file:///path/to/paks # server-side Repodata directory where the specific path, support three path format FTP, HTTP, file (local path): ftp://, http:/ /, file:///
Enabled={1|0} # Indicates whether the repo is enabled and is off by default
gpgcheck={1|0}# indicates whether to verify the legality of RPM package, if enabled must fill in the Gpgkey field, enabled by default
Gpgkey=ftp://|http://|file:///path/to/key # Gpgkey The exact path where the file is located


The Yum Package management Front end tool commands the Yum usage method:

Yum commands use more environments and have different syntax formats in different environment modes


A. query pattern Syntax:

Yum repolist [all|enabled|disabled] Displays the Yum warehouse information in the local repo file

Yum list {available|installed|updates} [GLOB_EXP1] [...] Query related packages based on status

Yum info [...] View package Information

Yum provides |    Whatprovides Feature1 [Feature2] [...] View which package is provided by the specified attribute or file

Yum deplist package1 [Package2] [...] View the capabilities on which the specified package depends


B. installation mode syntax:

Yum install Package1 [Package2] [...] Install the specified package

Yum Reinstall Package1 [Package2] [...] Reinstall the specified package


C. upgrade mode syntax:

Yum check-update check for available upgrades

Yum Update [Package1] [Package2] [...] Upgrade the specified package

Yum downgrade Package1 [Package2] [...] Demote a specified package


D. unload mode syntax:

Yum Remove |    Erase Package1 [Package2] [...] Uninstalling the specified package


E. clean-up mode syntax:

Yum Clean [Packages | metadata | expire-cache | rpmdb | plugins | all] cleanup of specified data based on criteria


F. package Group Management syntax

Yum grouplist [Hidden] [Groupwildcard] [...] List specified program installation package group information

Yum GroupInfo group1 [...] To view the specified program installation group information

Yum Groupinstall group1 [group2] [...] Install the specified program installation package group

Yum groupupdate group1 [group2] [...] Upgrade the specified program installation package group

Yum Groupremove group1 [group2] [...] Uninstalling the specified program installation group


These are the principles and basic operations related to the Yum Package management front End tool


I have limited level, if there is improper understanding of the place, please give correct, thank you very much!


This article is from the "Pavel" blog, make sure to keep this source http://pavel86.blog.51cto.com/8349178/1690012

Linux package management principles and basic usage of--rpm and Yum

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.