Linux Package Manager (top)--rpm detailed

Source: Internet
Author: User

In the process of using the Linux operating system, some of the services we need (such as nginx) are not provided and require the user to install the appropriate packages to use the appropriate services. This article takes CentOS6.6 as an example, divided into three sections for the readers to explain in detail the RPM, yum and the package of the compilation of three kinds of package management methods.

Rpm

RPM Package management tool is a part of Red Hat's RPM package Manager, which is widely used in major releases such as Rhel, CentOS, Fedora, and SuSE.

The RPM Package management tool can be used to install, upgrade, uninstall, reinstall, or to query which programs are installed on the current system, which files are generated by the Setup program, or whether a file is generated by which program was installed, or verify the source integrity and legitimacy of the package.

Before explaining the RPM use, check out the RPM package first. RPM Package Naming:RPM Package Name-Major version number-minor version-issue number-RPM package own release number (note: Regardless of the source code's release number)-platform type. RPM. For example: Bash RPM package Name: bash-4.1.2-29.el6.x86_64. Each RPM package contains a list of program components, including the installation and uninstallation scripts, the public database pointing path, and the list of files that the program will generate after installation. Readers can think of Windows under the installation program, such as QQ, it is in the process of automatic installation, but also run the script file to install, register in the registry (similar to the common database under Linux) to generate the appropriate files in the Windows system. RPM management tool is to extract the files in the package to install, the installation process, will check whether the installed package depends on other packages, other packages are installed in the system, feedback the appropriate information to the user, for example, if the installed package depends on other packages, will tell the user to install the package to install those packages first (in fact, This message also appears when you install programs under Windows, and when you install the League of Legends, you will be prompted to install the package if you do not have DirectX installed.

installation of RPM packages

to install the RPM package, you first have to download the RPM package, paddle! There are several ways to get RPM: ① preferred System release disc or official mirror site; ② The official site of the program project; ③ reliable third-party organizations: such as the EPEL community in Fedora: http://fedoraproject.org/wiki/EPEL/ Zh-cn;④ Conscience RPM Package exclusive search engine: Http://rpmfind.net, Http://rpm.pbone.net, http://pkgsorg.

Install command : RPM-IVH Package name (note path)

For example, install the Nginx package RPM-IVH nginx-1.4.7-1.el6.ngx.x86_64.rpm.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/25/wKioL1R5ik7RHfGSAAH2TnnaX68748.jpg "title=" rpm_1. PNG "alt=" wkiol1r5ik7rhfgsaah2tnnax68748.jpg "/>

Common installation options:

--nodeps ignores the dependencies of the package. Note: It is strongly not recommended to use this option.

--replacepkgs Replace the original package reinstall, that is , reload the program. For example, we reinstall the NGINX program: RPM-IVH nginx-1.4.7-1.el6.ngx.x86_64.rpm--replacepkgs

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/26/wKiom1R5ivLRsVGYAAFpOPD_8TA221.jpg "title=" rpm_2. PNG "alt=" wkiom1r5ivlrsvgyaafpopd_8ta221.jpg "/>

--test is a test-only installation, not a real installation, and is often used to check dependencies between packages

--prefix NewPath installs the program under a custom path, provided that the package supports a user-defined installation path.

Upgrade Command: RPM-UVH Package Name (note path): If an older version of the package is installed, upgrade the installation, or perform the installation operation

RPM-FVH Package Name (note path): If an older version of the package is installed, the installation is upgraded, otherwise no action is taken.

For example, upgrade Nginx from 1.4.7-1 to 1.6.1-1:RPM-UVH nginx-1.6.1-1.el6.ngx.x86_64.rpm

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/25/wKioL1R5meOSNiaZAAEAD02TtrQ299.jpg "title=" rpm_4. PNG "alt=" wkiol1r5meosniazaaead02ttrq299.jpg "/>

Common Upgrade Options:

--force: Forced escalation ignores conflict process

--oldpackage: Downgrade installation , which replaces existing programs with older versions of the program. For example: we downgrade the 1.4.7-1 version of Nginx to the 1.0.8-2 version. From Nginx official website: http://nginx.org/packages/centos/6/x86_64/RPMS/Download the corresponding layout, execute the command: RPM-UVH nginx-1.0.8-2.el6.ngx.x86_64.rpm-- Oldpackages

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/26/wKiom1R5l4GB_lK4AARfwlYlK1o172.jpg "title=" rpm_3. PNG "alt=" wkiom1r5l4gb_lk4aarfwlylk1o172.jpg "/>

--test Testing the upgrade process

Note: Do not upgrade the kernel package, Linux itself supports the coexistence of multiple versions of the kernel, therefore, the new version of the kernel package can be installed directly, if the original package configuration file was modified after installation, upgrade, The new version of the file does not directly overwrite the old version of the file but instead renames the new version of the file (plus the suffix. rpmnew) reserved.

Uninstall command: RPM-E program name (Note: not package name)

For example, uninstalling NGINX:RPM-E Nginx

Common options:

--nodeps Ignore dependencies Perform uninstallation

--test Unloading test

Note: If the profile of the package has been modified since it was uninstalled, this profile will not be deleted but is renamed (plus suffix. rpmsave) to be retained.

Query class Commands

Query whether a program has been installed: Rpm-qa program name


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/26/wKiom1R5pguwWi4QAACmL_DwcPM652.jpg "title=" rpm_5. PNG "alt=" wkiom1r5pguwwi4qaacml_dwcpm652.jpg "/>


Query which package is generated after a file is installed: Rpm-qf/path/to/somefile


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/26/wKiom1R5pqmjmAKYAACcqeu7ItE358.jpg "title=" rpm_6. PNG "alt=" wkiom1r5pqmjmakyaaccqeu7ite358.jpg "/>



Query which files are generated after a package that has not been installed is installed: RPM-QPL package_file.rpm


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/25/wKioL1R5qCHyvdh-AAIuhXllRSg865.jpg "title=" rpm_7. PNG "alt=" wkiol1r5qchyvdh-aaiuhxllrsg865.jpg "/>


Query summary information for a program RPM-QI program name


650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/54/25/wKioL1R5qzjSY724AAIwGu5_R3A453.jpg "title=" rpm_9. PNG "alt=" wkiol1r5qzjsy724aaiwgu5_r3a453.jpg "/>


to query a list of files generated by a program: RPM-Q Program Name

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/27/wKiom1R5qLuCyKsBAAGpYVuCiMA775.jpg "title=" rpm_8. PNG "alt=" wkiom1r5qlucyksbaagpyvucima775.jpg "/>

The RPM commands that are commonly used in production are roughly the same, and you want to know more about the command instructions for RPM, see the Man manual.

Write at the end: using the RPM installer does not automatically resolve dependencies, while another RPM package manager, yum, helps users solve this problem.

This article is from "Xiao Zhi" blog, please be sure to keep this source http://948555452.blog.51cto.com/9146446/1584543

Linux Package Manager (top)--rpm detailed

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.