Common usage of RPM package manager package management tools

Source: Internet
Author: User

There are two types of software packages:

Binary Package and source code package.

How do I select a software package that suits my binary format?

1. Select a software package based on the CPU architecture

A binary package converts a source program to an Instruction Set supported by the CPU and runs directly. Because different architectures have different CPU instruction sets. So the binary format

A Software Package typically identifies the CPU that applies to that architecture.

Common CPU platforms arch: 1), high power cost, strong performance 2), simplified board PowerPC 3), uitrasparc 4), x86 low power consumption, performance close to the server-level architecture CPU. 5), x86_64 7), MIPS

CPUs in different architectures support different instruction sets. Therefore, the software compiled on the cpu Of The X86 architecture cannot run after it is transplanted to the CPU of the Power Architecture. We need to select the binary software package based on the CPU architecture used.

Example:These two packages are suitable for the cpu Of The i386 and i686 architectures.

[[email protected] ~]# ll /home/admin/total 1136-rw-r--r--. 1 root  root  221868 May  9  2012 drbd83-8.3.8-1.el5.centos.i386.rpm-rw-r--r--. 1 root  root  125974 May  9  2012 kmod-drbd83-8.3.8-1.el5.centos.i686.rpm

2. Select a version based on the operating system used.

Although the application runs on the CPU, it is controlled by the kernel. The formats of binary execution files supported by different kernels are different. The binary format used in Linux is elf. The binary format supported by windows is not elf.

You can use the following method to obtain the binary program format:

[[email protected] ~]# file `which httpd`/usr/sbin/httpd: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

SoWhen selecting a binary package, you need to know whether the platform running the package is windows or Linux. This is the so-called Abi, and the running environment of the program is different.

After selecting a binary software package based on the operating system, do you need to consider whether your operating system is 32-bit or 64-bit?

Although the 64-bit compatibility is 32-bit, it means that a 32-bit application can be run on a 64-bit operating system. However, when an application runs on a 64-bit system, the performance of the 64-bit operating system cannot be fully utilized. A 32-bit operating system cannot run 64-bit applications. It is generally backward compatible. Therefore, we need to know the bit length of the operating system when selecting a binary package. Try to select the bit length and Operating System

Software packages with the same bit length can give full play to the performance of the operating system and applications.

------------In this way, we can select a binary package suitable for our system according to the actual situation.

In Linux, binary applications are usually composed of the following parts: configuration file, library file, header file, binary program, and help document. According to FHS (filesystem Hierarchy Standard) Standards

Different files are stored in different directories.

Put the configuration file in the/etc directory library file in/lib,/usr/lib binary program in/bin,/sbin,/usr/bin,/usr/sbin header file in/usr/include help document stored in/usr/share

In Linux, you can simply delete the installed program file by uninstalling the software. There is no so-called registry concept in windows.

A binary package usually has many files, such as configuration files, library files, header files, binary program files, and help files. Store these files in the preceding directory.

Because these directories store a large number of files, it is inconvenient to uninstall the program. It is very difficult to find out one of these directories and delete them.

This requires a tool to help us record where the application package files are installed, and those files are installed when the program is installed. RPM (RPM package manager) is such a tool.

In Linux, the RPM package management mechanism has become a standard. Release versions such as centos and RedHat are managed using the [RPM] Package Manager to install, upgrade, and uninstall Binary packages. It is equivalent to installing and uninstalling a program in windows.

Let's take a look at the functions of the RPM software package management tool:

1. Packaging

Convert each file of the binary program into a data packet in. RPM format. Data packets in RPM format are in the following format:

Software name |-function of the package |-Main version number of the program. Minor version number. RPM package release number-system platform. CPU platform. rpm
[[email protected] ~]# ll /mnt/cdrom/Packages/ | grep "\<zlib\-[0-9]>"-r--r--r--.  94 root root    74336 Nov 27  2012 zlib-1.2.3-29.el6.i686.rpm

Note: This is a main software package named zlib.

Main version: 8

Minor version: 3

RPM package release number: 8

Applicable System Platform: centos 5

Applicable to CPU architecture i686

[[email protected] ~]# ll /mnt/cdrom/Packages/ | grep "\<zlib\>-devel"-r--r--r--.  77 root root    45052 Nov 27  2012 zlib-devel-1.2.3-29.el6.i686.rpm

Description: The Bar (-) after zlib is not followed by a number, but a word ----> devel. It indicates that the package is a child soft package. "Devel" indicates that the software package is used to open the package.

Zlib is an Internet-based data compression tool that is often used when Web servers transmit data. After data is compressed, it can save bandwidth and save a lot of cost for the company, however, compression consumes CPU computing resources.

[[email protected] ~]# ll /mnt/cdrom/Packages/ | grep "[[:space:]]openssl\>-[0-9]"-r--r--r--.  32 root root  1435936 Jan 21  2013 openssl-1.0.0-27.el6.i686.rpm

Description: The format of the PrM package indicates that the package is the main package.

[[email protected] ~]# ll /mnt/cdrom/Packages/ | grep "[[:space:]]openssl\>-devel"-r--r--r--.  27 root root  1201312 Jan 21  2013 openssl-devel-1.0.0-27.el6.i686.rpm


According to the PrM package format, this package is a sub-package, which is used only during development. The following example shows how to use the SDK?

Compile and install the httpd server software

[[Email protected] httpd-2.2.17] #. /configure -- prefix =/usr/local/apache2 -- sysconfdir =/etc/httpd -- enable-mods-shared = all -- enable-so -- enable-Rewrite -- enable-CGI -- enable -SSL \ ------> enable with SSL -- With-Z [[email protected] httpd-2.2.17] # makechecking OpenSSL/engine. h usability... yeschecking OpenSSL/engine. h presence... yeschecking for OpenSSL/engine. h... yeschecking for ssleay_version... nochecking for ssl_ctx_new... nochecking for engine_init... nochecking for engine_load_builtin_engines... nochecking for ssl_set_cert_store... noconfigure: Error :... error, SSL/TLS libraries were missing or unusable

(Httpd-2.2.17 error. The SSL/TLS library is missing.

Check whether OpenSSL-devel is installed

[[email protected] ~]# rpm -qa | grep -i opensslopenssl-0.9.8e-22.el5_8.4

You can see from the above results that the OpenSSL-devel Development Kit is not installed in the system. Use the yum tool to install the software package.

[[email protected] admin]$ yum install openssl-devel

If you compile again, no error will be reported.

[[email protected] httpd-2.2.17]# makechecking openssl/engine.h usability... yeschecking openssl/engine.h presence... yeschecking for openssl/engine.h... yeschecking for SSLeay_version... yeschecking for SSL_CTX_new... yeschecking for ENGINE_init... yeeschecking for ENGINE_load_builtin_engines... yeschecking for SSL_set_cert_store... yes......


The httpd server, after receiving user requests, analyzes the resources requested by the user. when responding to the user, it must call OpenSSL to encrypt the data and then send it. When compiling the httpd software, the API (Development Library) provided by OpenSSL is called to implement data encryption and then transfer. HTTPS. Therefore, when compiling the software, the system will report an error if there is no OpenSSL development library. Although OpenSSL-devel is available on the system, it cannot be found when compiling httpd software. An error will also be reported. This involves where to find the development library by default.

By default, the system will go to the/lib and/usr/lib directories to find the development library. If your development library is not the default place in the system, tell the system where your development library is. There are two methods:

(1 ),Create a file under/etc/lD. So. conf. d/, as long as its suffix is. conf. And then put the path of your development library

Path to the file. Then run ldconfig-V to notify the system configuration file.

(2)When compiling the software, specify the development library in the options: OpenSSL-Dir =/path/to/somepath/

2. Installation

[Rpm-IVH/path/to/package_file] install the software package and display the installation progress. [Rpm-IVH -- test/path/to/package_file] test whether the software package can be installed

One of the important philosophical ideas of Linux: "Combining applets to complete complex tasks ". In Linux, a program often relies on many other small programs to complete a large function. These programs are dependent. The execution process of a program, also known as a program flow. When the program is executed to a certain position, it needs to call another program to complete a specific task and return the execution result to the main program. At this time, the main program can be executed.

In this way, small programs are combined to complete complex tasks. If you use the [RPM] package management tool to install the package, if the package has dependencies. There is no way to solve the RPM package management tool. Only manual solutions are available, and some package dependencies are complex. AI is hard to solve.

Later, we came up with the tool to solve the dependency of the Degree package: Yum yellowdog update modifier. It is the front-end tool of RMP. This can analyze the dependency packages of the packages you want to install and analyze their dependencies. Install the package according to the dependency. If some packages in your system have been installed, they will not be reinstalled.

3. Uninstall

[RPM [Options] package_name]-e uninstall the software package -- nodeps ignores dependencies. It is dangerous to find that the dependent software package cannot be used.

4. Upgrade

Rpm [Option]/path/to/package_file-uvh upgrade and Installation

Note:: The software package is dependent, and the dependent software package cannot be used after the upgrade. Or conflict.

5. Verification

(1)Before the package is installed, check the legitimacy and integrity of the RPM package:

The public key of the producer who imports the package on the current system

Rpm -- import/path/to/key_file

When installing the software package, the legitimacy and integrity of the RPM package are automatically verified.

Manual check. The following methods are used to check the legitimacy and integrity of the RPM package.

RMP-k/path/to/package_file -- nodigest does not check package Integrity -- nosignature does not check source Validity

(2)Check file properties after package installation

Check whether the file attributes are changed. This is a method for software package security.

Rpm-V package_name

Using the above method, we will find that the attributes of the file have changed. The file attributes are as follows:

       S file Size differs           M Mode differs (includes permissions and file type)       5 digest (formerly MD5 sum) differs       D Device major/minor number mismatch       L readLink(2) path mismatch       U User ownership differs       G Group ownership differs       T mTime differs       P caPabilities differ


If the property does not change, it is displayed as a vertex (.). Otherwise, the above attribute is used.

 6. query the package description. Only installed packages can be queried.

Rpm-Qi package_name relocations: whether the installation location can be specified

7. query which package generates the file.

 rpm  -qf /path/to/some_file  [[email protected] ~]# rpm -qf `which free` procps-3.2.8-25.el6.i686

8. query the files generated by a package.

 rpm -ql package_name | less [[email protected] ~]# rpm -ql zlib  /lib/  /lib/

9. query uninstalled packages


[[email protected] ~]# rpm -qpl /mnt/cdrom/Packages/zsh-4.3.10-5.el6.i686.rpm  | grep "^/etc"/etc/skel/.zshrc/etc/zlogin/etc/zlogout/etc/zprofile/etc/zshenv/etc/zshrc

This article is from the "Linux" blog, please be sure to keep this source

Common usage of RPM package manager package management tools

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