RPM Package Management

Source: Internet
Author: User

First, RPM introduction

RPM is the abbreviation for the RPM Package Manager (RPM bundle manager) for installing and uninstalling all types of software on a Linux environment, ending with a. rpm suffix.

Second, the rpm file naming format

appname-version-release.arch.rpm

(1) AppName: Package Name

(2) VERSION:
Major: Major Version number
Minor: Minor version number
Release: Release number

(3) RELEASE: The package's own revision number, and sometimes contains the OS information applicable to it, such as bash-4.3.2-2.centos6.x86_64.rpm
ARCH: the applicable platform

x86:i386,i486,i586,i686,
x86_64:x86_64,amd6464
Powerpc:ppc
Noarch: Platform agnostic

Example: bash-4.3.2-2.centos.x86_64.rpm

Package Name: Bash, Version: 4.3.2 Applicable system: CentOS, applicable platform: x86_64

Three, RPM package to obtain the way

1, the system's release disc image or the official site (or site mirror server)

Attached: CD-ROM Mount method

(1) Mkdir/media/cdrom

(2) Mount-r/dev/cdrom/media/cdrom or Mount-o ro-t iso9660/dev/cdrom/media/cdrom

2. The official site of the package

3. Third party organization: Epel, dpkg

4. Search Engine
Http://rpmfind.net
Http://rpm.pbone.net
http://pkgs.org

Four, through the RPM command to achieve RPM package installation, uninstallation, upgrade, calibration, query and other functions

1. Installation

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

Option:-h:hash, # to indicate the progress of the installation (a # stands for 2%)
-V,--Verbose: Displays detailed information during installation

--test: Does not perform a real installation process, but only reports dependencies and conflicting information

--nodeps: Ignoring dependencies (with side effects: can be installed successfully but not necessarily successfully)

Common combinations for installation:-IVH

Take the installation of zsh as an example:

[Email protected] packages]# RPM-IVH zsh-4.3.10-7.el6.x86_64.rpm
Preparing ... ########################################### [100%]
1:zsh ########################################### [100%]

2, RPM {-u|--upgrade} [install-options] package_file ...
-U: Upgrade or install
RPM {-f|--freshen} [install-options] package_file ...
-F: Upgrade

Combination:-UVH|-FVH

Note: Do not upgrade to the kernel, Linux allows multi-core coexistence, so it is possible to install several different versions of the kernel directly

If the package configuration file has been modified after the upgrade, the new version of the file will not overwrite the old version of the configuration file, and the new version of the configuration file renamed (plus suffix. rpmnew)

--oldpackage: Downgrade to old version RPM-UVH--oldpackage zsh-4.3.10-7.el6.x86_64.rpm

3. Uninstall: Remove the installed package

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

--nodeps: Ignoring dependencies
--test: Test Uninstall, Dry-run mode
--allmatches: If a package installs multiple versions at the same time, this option is uninstalled all at once

Note: If the package configuration file after the installation layer is modified, when uninstalled, this file is usually not deleted, but is renamed (plus suffix. rpmsave) after retention

4, Query: Query whether a package has been installed, and check all installed packages, you can also view a package of details

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

[Select-option]:

(1) Check whether a package or some packages are installed: Rpm-q package_name
[Email protected] packages]# rpm-q zsh
Zsh-4.3.10-7.el6.x86_64

(2) query all packages that have been installed: RPM-QA
(3) query which package the file is installed to build Rpm-qf/path/to/somefile

[Email protected] packages]# Rpm-qf/etc/fstab
Setup-2.8.14-20.el6_4.1.noarch

(4) Query for information about package files that have not been installed: Rpm-qpi package_file

-P can be combined with query options
650) this.width=650; "title=" 1.png "src=" Http://s3.51cto.com/wyfs02/M01/5E/1C/wKiom1UpLK2wsiBgAAMsaTswLQo638.jpg " alt= "Wkiom1uplk2wsibgaamsatswlqo638.jpg"/>

[query-option]: Query options

(1) Query A brief description of a package: (i:information) Rpm-qi package_name

650) this.width=650; "title=" 2.png "src=" Http://s3.51cto.com/wyfs02/M00/5E/1C/wKiom1UpLa_zbWlUAAOJ9bTZMb0819.jpg " alt= "Wkiom1upla_zbwluaaoj9btzmb0819.jpg"/>

(2) Query the list of files generated by a package installation: RPM-QL package_name (direct parking name)

#rpm-ql en

(3) Querying all configuration files generated by a package installation: RPM-QC package_name
# RPM-QC Zsh

(4) Query all Help files generated by a package installation: Rpm-qd package_name
# RPM-QD Zsh

(5) Query the changelog information of the change of version of a package: Rpm-q--changelog package_name
# rpm-q--changelog zsh

(6) Query the capabilities (ability) provided by a package: Rpm-q--proviedes package_name
# rpm-q--provides zsh

(7) Query the Capabilities:rpm-q--requires that a package depends on Package_name

(8) Query execution script when installing or uninstalling a package: Rpm-q--scripts Package_nama

There are four types of scripts here:
Preinstall: script executed before the installation process starts
Postinstall: Scripts executed after the installation process is complete
Preuninstall: script executed before uninstallation starts
Postuninstall: script executed after uninstallation process is complete

(9) Check: whether the files generated after query package installation have changed

RPM {-v|--verify} [select-options] [verify-options]

Common usage: rpm-v package_name

S file size differs file sizes
M Mode differs (includes permissions and file type) permissions
5 Digest (formerly MD5 sum) differs MD5 checksum
D device Major/minor number mismatch master/minor change
L Readlink (2) path mismatch paths mismatch
U User ownership differs owner
G Group ownership differs
T MTime differs last modified
P capabilities differ

RPM Package Management

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.