Linux Learning notes: RPM Package Management

Source: Internet
Author: User
Tags pack


For CentOS, for example, the RPM Package Manager contains the following:

CentOS Package Manager:
Naming rules for packages:
Source Code Package:
Software_name-version.tar.gz
VERSION:major.minor.release
Major: The major version number, which typically represents the version branch of a significant feature improvement;
Minor: the minor version number, which usually represents a change in a feature in a branch of a version;
Release: Release number, fixed some bugs or optimized a piece of code;

Apache-tomcat-7.0.63.tar.gz

RPM Package Naming rules:
SOURCE Package: Source code
software_name-version.src.rpm
Binary package:
Software_name-version-[release]. [os].arch.rpm
VERSION:major.minor.release
[release]:rpm the release number of the package
[OS]: Supported operating system versions, EL6, EL7, Suse11, Fedora22, ...
Arch: Hardware platform type, I386, x64 (AMD64), PPC, SPARC, Noarch, ...

puppet-3.8.7-1.el7.noarch.rpm

When making RPM packages, it is common for its producers to use subcontracting techniques to build RPM packages;

Build multiple packages According to the different functions of the program;

Subcontracting packages generally fall into two categories:
Main package:
Software_name-version-[release]. [os].arch.rpm
Accessory Feature Pack:
Software_name-function-version-[release]. [os].arch.rpm

In general, the main package and the Accessory Feature Pack have the same version number, the release number, the operating system and the identity of the compatible platform;

Therefore, the main package is often dependent on all the ancillary feature packs, and the accessory Feature Pack cannot be installed without the main package;

Function:devel, Utils, libs, tools, manual, Client, Common, ...

Dependency Relationship:
A-and B--C D--and A dependent black hole

Front-end tools for package management:
rhel| The front-end management tool for the CentOS system: Yum, Yellow dog Update midifier
Yum opens a transaction when it implements installation, upgrade, uninstall, etc.
The so-called transaction, the operation process as a whole, either full implementation, or all do not execute;

Fedora 22+:DNF

The Debian system's front-end tools: Apt-get,apt-cache
Apt-get: Implement installation, uninstall and other functions;
Apt-cache: Implement keyword-based search to manage local cache and cached metadata

SuSE Front End Tool: Zypper

RPM Package Manager:
1.rpm command line tool;
2.yum tools;

RPM command-line tools:
Function:
1. Package each constituent file of the compiled application into one or more package files;
2. Install, uninstall, upgrade, query, verify and database management functions of the package

A list of the components of the files in the RPM package:
1. Documentation of the program
2. List of documents
3. The script files that are run when the software is installed or uninstalled are divided into four categories:
Preinstall: A script that runs before the official installation operation begins,%pre
Postinstall: The script executed after the installation is complete,%post
Preuninstall: A script that runs before the formal uninstall operation begins,%preun
Postuninstall: The script executed after the uninstallation is complete,%postun

RPM Database (Public):
The package name and version already installed
/var/lib/rpm


Ways to get Packages:
1. CD of the system's release version
2. Official file server or mirror site:
Http://mirrors.aliyun.com
Http://mirrors.sohu.com
Http://mirrors.163.com
https://mirrors.tuna.tsinghua.edu.cn
http://mirrors.hust.edu.cn
...
3. The official site of a project:
4. RPM Package sites produced by third-party organizations
Fedora EPEL: Red Hat's official community organization, which also contains EPEL images in the mirror site;
Search engine:
http://pkgs.org
Http://rpmfind.net
Http://rpm.pbone.net
5. Make your Own

Recommendation: After you obtain the package, implement the integrity check
SOURCE legitimacy:
Through the digital signature of the program provider, we encrypt the data and verify the decryption through its public key;
Package Integrity:
Sha-1 Check Code

Use of RPM and yum two tools

RPM command-line tools:
Install, uninstall, upgrade (downgrade), query, file verification, validation, database maintenance;

Common options for RPM commands:
-V: Displays information about the installation routines, showing only the installation software name
-VV: Displays very detailed information about the operation

Installation:
RPM {-i|--install} [install-options] package_file ...
Install-options:
-H,--hash: Use 50 "#" to indicate the progress of the installation
--test: Not a real installation package, just test whether it can be completed properly during installation, dry run mode;
--nodeps: Ignore installation errors due to dependencies, not recommended;
--replacefiles: When the package is installed, the files in the package will be replaced directly by the original installed files;
--replacepkgs: Reinstall without uninstalling the package;
--noscripts: Do not run any scripts
--nosignature: Do not consider whether the source of the package is legitimate;
--nodigest: Do not consider whether the package is complete;

Example: ~]# rpm-ivh php-mysql-5.3.3-40.el6_6.x86_64.rpm php-pdo-5.3.3-40.el6_6.x86_64.rpm

Upgrade:
RPM {-u|--upgrade} [install-options] package_file ...
If you choose to install the package is not installed in advance, the new installation, if you have installed the old version, you can upgrade the installation;
RPM {-f|--freshen} [install-options] package_file ...
Only the lower version of the package that has been installed can be upgraded and installed;
Common options: Same as Installation
--oldpackage: Downgrade the installation, replace the new version of the package with the old version of the package;
--force: Forced upgrade

Attention:
1. It is strongly recommended not to upgrade the kernel, Linux can support multi-core, can install the new version of the kernel directly, the boot interface can be manually replaced;
2. Upgrading the installation may bring changes to the file, so the system does not directly change the configuration files of the previously installed software, the configuration files in the new package will be renamed, usually: Finename.rpmnew

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

--allmatches: Uninstalls each version of the package that matches the specified name;
--nodeps: Ignore dependencies when uninstalling, do not recommend to use;
--test: Test Uninstall, dry run mode;

Inquire:
RPM {-q|--query} [select-options] [query-options]
[Select-options]
Package_name: Give the package name directly
-A,--All: query all installed package names;
~]# Rpm-qa | grep MySQL
-F,--File file: Find out which package the specified file is provided by;
-P,--Package Package_file: Perform query operations on packages files that are not yet installed
--whatprovides CAPABILITY: Query The specified CAPABILITY is provided by which package
--whatrequires CAPABILITY: Query which package the specified CAPABILITY is dependent on

[Query-options]
--changelog: Query the RPM package changelog;
-C,--configfiles: query Specifies which configuration files are in the package;
-D,--docfiles: Queries which document files are in the specified package;
-I,--info: Query package related information, including version number, issue number, size, etc.;
-L,--list: Lists which files are generated by package installation
--provides: Lists all the capability provided by the specified package;
-R,--requires: Query the dependencies of the specified package;
--scripts: View the contents of the script that the package carries;

Specific Use method:
-QF FILE
-qc|-ql|-qd|-qi package_name
-qpl|-qpc|-qpd|-qpi Package_file

Check:
RPM {-v|--verify} [select-options] [verify-options]
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

Certification:
RPM--import/path/to/key_file
Rpm-k/path/to/package_file

Database management:
Initializing and rebuilding the database
/var/lib/rpm

RPM {--INITDB|--REBUILDDB}
[--dbpath DIRECTORY]

Linux Learning notes: 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.