Management of software packages for Linux learning Path (RPM)

Source: Internet
Author: User

At present, there are 2 ways of management software in Linux, one is to use DPT to manage, the other is to use RPM to manage

The DPT is developed using the Debian Linxu community and is currently managed by a DPT, including: B2d,ubuntu, etc.

And RPM is developed by Red Hat, which currently uses RPM to manage software publishers including Fedora, CentOS, SuSE, and so on.

Since most of the current most mainstream package management is managed using RPM, here we only show how to use RPM to manage packages


What is RPM?

RPM: The full name is Redhat Package Manager, or RPM, a set of management mechanisms for installing the software you need into your Linux system in a database-logged way. That is, when installing a software, the information of the software is all written to the RPM database, and subsequent operations such as upgrading, uninstalling, and verifying the software package are based on data from the RPM database.


The naming rules for RPM packages:

name-version-release.arch.rpm

Software Name-version number-number of releases. Operating platform. rpm

Where the version number is the main version number and the minor version number

Main version number: used to correct major version numbers when significant functionality of the package has been improved

Minor version number: When a child function is changed, it is only used to correct minor version numbers.

The number of times the release is compiled

The operating platform mainly consists of the following types:

I386: Suitable for all x86 platforms

I586: Optimized compilation for 586-level computers

X86_64: Optimized compilation for 64-bit CPUs

Noarch: Indicates no hardware-level restrictions




The core features of the Package Manager are:

1, make the software package.

We know that the RPM package is compiled from the original code, so the RPM package can be used for installation, but the RPM packages of different publishers are not common to each other, and some even different versions of the same distributor RPM package can not be used. This is due to the fact that compiling these RPM packages is not the same as the compilation environment. These compilation environments include hardware platforms, library files, and so on.

In other words, the package is available only if the compilation environment and the environment where the RPM is installed are consistent. The package Manager can then be used to compile the original code and make it available on a specific platform.


2. The Package Manager can install, query, upgrade, uninstall, verify the correctness of the files in the package, rebuild the database, and other operations.


Here we first describe how to use RPM to install the software.

In the Linux system, many software in the installation process, there is a dependency, the so-called dependency is that in the installation of a software, must first install the B software, in order to install a software. This is the dependency property of the software .

First, RPM package installation

Syntax format: RPM [option] Package_file (This is the file name of the software, full name)

The meaning of-i:install

-V: Displays detailed information during installation

-VV: Show more detailed information

-H: Displays the installation progress with the # sign, where each # represents 2% progress

Where IVH is usually used together

--nodeps: Ignore dependencies during installation, which may cause the installed software to be unusable

--replacepkgs: Reinstall, replace the original installation

--replacefiles: This option can be overridden during installation if an installation file already exists.

--force: Forced installation, can be re-installed or degraded installation


Second, RPM package query

Previously said RPM package in the installation will generate a database file, this file is the/var/lib/rpm/directory, the RPM query is in this directory to find the database file.

Syntax format: RPM [option] [package_name]

-Q: Query whether the specified package is already installed

-QA: Query All packages that have been installed, not the package name after

-QI: Querying description information for a specified package

-QC: Querying the configuration file for the specified package

-QD: Query the Help file for the specified package (related to man)

-QL: Query the list of files generated after the installation of the specified package

-Q--scripts: Query the script contained in the specified package

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/3F/A7/wKiom1PLzuLinDwdAAFEfrLBSMo212.jpg "title=" sc.png "alt=" Wkiom1plzulindwdaafefrlbsmo212.jpg "/>

-qf/path/to/somefile: The query for the specified file was generated by the RPM package installation.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/3F/A7/wKioL1PL0jbSWFPLAAEIgKW2BOc249.jpg "title=" Qq1.png "alt=" Wkiol1pl0jbswfplaaeigkw2boc249.jpg "/>

If a package is not installed and you want to query information about it, you can use-QP to query

Syntax format: RPM-QP[ILCFD] Package_name (package name not installed)

Where-ICLFD meaning is the same as above


Third, RPM package upgrade

RPM-UVH Package_file: Upgrade If the package is installed, install if it is not installed

RPM-FVH Package_file: If the software is installed, then the upgrade is not installed, then exit

Where option--oldpackage is used to downgrade the installation


Four, RPM package unloading

RPM-E package_name: Uninstalling a Package

--nodeps: Ignores dependencies during uninstallation.

In the uninstallation process, it is best to uninstall from the upper layer one at a time to avoid system confusion.


V. Verifying RPM installation-generated files

Checking the files in RPM can be used to detect if a file has been modified, and if the file has been mistakenly deleted. It is detected by comparing the contents of the database under/var/lib/rpm/and all the files on the current system.

Syntax format:

RPM [option] [package_name]

-V: Detects if the files in the specified package have been modified, only files that have been changed will be displayed

-va: List all files on the system that have been altered

-VF: Detects if a file has been altered

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/3F/A9/wKioL1PL52zypcd1AABHLHPufPs693.jpg "title=" xg.png "alt=" Wkiol1pl52zypcd1aabhlhpufps693.jpg "/>

Where each of these points represents the SM5DLUGT, only the change will show

S: The size of the file has changed

M: The type of file or permission has changed

5:MD5 Random Code is different

D: The main/minor code of the device has changed

L:link Path has changed

U: The owner of the file has changed

G: Changes in the genus Group of the file

T: File modification time changed


The following characters represent the file type

C: Represents a configuration file

D: Data files

G: The file is not included in a software

L: License files (license file)

R: Readme file (Read me)


Vi. Creating a Database

If a user does not accidentally damage the files in the/var/lib/rpm/directory, then you can use RPM to rebuild the database

Syntax format:

RPM--REBUILDDB: Using this option will re-create the database regardless of whether the RPM database exists

RPM--INITDB: Initializes the database, which means that the database is created if it does not exist, and is not created.






This article from the "Linux Learning Path" blog, declined reprint!

Management of software packages for Linux learning Path (RPM)

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.