Management of RPM packages in Linux

Source: Internet
Author: User
Tags gpg

1. Related Concepts

1. Package Manager Features: 1. Application Packaging: in a specific format; 2. To manage a compatible package:
"NOTE: The binary format program is related to the platform, so it is often necessary to make versions that are compatible with popular platforms"

2.C package compilation to machine recognition process: source code (text)----preprocessing-----compile----

At compile time, the compilation can be divided into two categories, depending on whether the called library file is packaged directly into the generated binaries file:
Dynamic Link: Do not package the called library file, but the runtime to load it;
Static Link: Package The called library file in the future, run it yourself completely independently, without the need for external library files to run

3. Package:
Source code:appname-version.tar.gz, appname-version.tar.bz2, Appname-version.tar.xz
Package Manager (RPM) format: appname-version-release.arch.rpm

There are two common types of package managers:

1. . Deb: Mainly used in the Debian series

2. rpm: Full name of Red Hat Package Manager, also for RPM are package Manager


4.RPM package naming format: appname-version-release.arch.rpm

VERSION:
Major: Major Version number
Minor: Minor version number
Release: Release number
RELEASE: The revision number of the package itself, and sometimes the OS information that is applicable, such as the 2.CENTOS6 in bash-4.3.2-2.centos6.x86_64.rpm
ARCH: the applicable platform
X86:i386, i486, i586, i686
x86_64:x86_64, AMD64
Powerpc:ppc
Noarch: Nothing to do with the platform;


Two subcontracting mechanisms in the 5.RPM package:
1. Core package, main package: Naming is consistent with source project name; eg:bash-4.3.2-2.centos6.x86_64.rpm

2. Child Package (bundle): The command is composed of the functionality provided by the file in the attached package after the source project name. eg:bash-devel-4.3.2-2.centos6.x86_64.rpm


6.linux production environment A common way to get packages in China:
1, the system's release disc image or the official site (or site mirror server);

Mount Disc: # mount-r/dev/cdrom/media/cdrom
Common official site, Mirror:
Sohu site: mirrors.sohu.com
NetEase site: mirrors.163.com
Ali site: mirrors.aliyun.com

2. The official site of the package

3. Third Party organization: Epel
Classroom: http://172.16.0.1/fedora-epel/6/

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

"Note: It is important to verify the legitimacy of the package before installing it (i.e., the legitimacy of the source and the legitimacy of the package)"

7. There are four types of scripts, namely:


      • Preinstall: Scripts executed before the installation process begins;

      • Postinstall: Scripts executed after the installation process is complete;

      • Preuninstall: The script executed before the uninstallation begins;

      • Postuninstall: Scripts executed after the uninstallation process is completed;


2.CentOS System on the program RPM package Management related commands (installation, upgrade, uninstall, query, test)


installation of 1.rpm

#rpm {-i|--install} [install-options] package_file1 ...

Options:

-h:hash, to # to indicate the installation progress;

-V,--verbose: Displays detailed information during the installation process;
-VV (-VVV): Show installation more detailed procedure
--nodeps: Ignore dependencies: (with side effects, can be installed successfully, but may not be able to run successfully;)
--replacepkgs: Overwrite installation: Reinstall and overwrite the original file
--force: Forced Installation:
--test: Do not perform the actual installation process, but only report dependencies and conflict information;
"Note: Common combinations during installation:-IVH,-IVVH"

2. RPM Upgrade : (the option in the installation can be used in the upgrade, for example:--test,--nodeps,--force,--oldpackage: Downgrade to the old version)

#rpm {-u|--upgrade} [install-options] package_file ...

Options:

-U: Upgrade or install

#rpm {-f|--freshen} [install-options] package_file ...

Options:

-F: Upgrade

"Note: Common option combinations:-UVH,-FVH"

"NOTE: Do not upgrade the kernel, Linux allows multiple cores to coexist, so you can install multiple versions of the kernel directly;"

Note: If the package configuration file has been modified since the upgrade, the new version of the file will not overwrite the old version of the profile, and the new version of the configuration file is renamed (plus suffix. rpmnew) after saving; "

3.RPM Package Uninstall ( remove installed packages )

#rpm {-e|--erase} [--allmatches] [--nodeps] [--test] package_name ...

(Simple usage:rpm-e package_name ... )

Options:

--nodeps: ignoring dependencies;
--test: Test unload; 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 has been modified after installation, when uninstalled, this file is not usually deleted, but is renamed (plus suffix. rpmsave) to be retained;

4.rpm Query (query whether a package has been installed, and check all packages installed; You can also view a package's details;)

# RPM {-q|--query} [select-options] [query-options]

[Select-options]

1, query whether a package or some packages are installed: # rpm-q Package_name ...

2. Query all packages that have been installed: # RPM-QA

3. Query which package the file is generated by: # Rpm-qf/path/to/somefile

4. Query for information about package files that have not been installed (-P): # RPM-QPI Package_file

[Query-options]

1, query the brief description of a package information:

# Rpm-qi Package_name

2. Query the list of files generated by a package installation:

#rpm-QL Package_name

3. Query all the configuration files generated after the installation of a package is complete:

#rpm-QC Package_name

4. Query all the Help files generated after the installation of a package is complete:

#rpm-QD Package_name

5. Check the Changelog information when the package is made with the version change:

#rpm-Q--changelog package_name

6. Query the capabilities provided by a package:

#rpm-Q--provides package_name

7, query the capabilities that a package depends on:

#rpm-Q--requires package_name

8. Execute the script when you query a package for installation or uninstallation:

#rpm-Q--scripts package_name

5.RPM Checksum (that is, if the file generated after the query package installation has changed)

#rpm {-v|--verify} [select-options] [verify-options] (Common usage: rpm-v package_name)

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


1. Verification of the legality of the package:
1. Legal Origin:

That is, the package is provided by our trusted producer, usually relying on the digital signature of the producer, where the signature is carried out by the author using his own private key encryption package;

               
2. Content is legal:
that is, the package has not been modified two times, the integrity check is successful, usually depends on the producer of the program signature;
Verification Method: The installer uses the same signature extraction algorithm to extract the signature of the package and compare it with the original provider;

2. Verify the source and completeness of the package in its CD-ROM:
# RPM--import/path/to/rpm-gpg-key-file

Example: # rpm--import rpm-gpg-key-centos-6

Validation: #rpm {-k|--checksig} package_file
--nosignature: Does not check the legitimacy
of the source
--nodigest: Do not check integrity

6.rpm Manager database ( database path in:/var/lib/rpm directory)

1. Rebuilding the database:

#rpm {--INITDB|--REBUILDDB} [-v] [--dbpath DIRECTORY]

Options:

--INITDB: Initializes the database, that is, when the database is completely saved, it can be created;

--REBUILDDB: Whether the current data exists or not, the library will be rebuilt directly;



This article is from the "Jason" blog, make sure to keep this source http://tanjie.blog.51cto.com/10027618/1631960

Management of RPM packages in Linux

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.