Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux Learning Notes: rpm package Management

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Taking CentOS as an example, the relevant contents of the rpm package manager are as follows:

Package Manager for CentOS:

Naming rules for packages:

Source code package:

Software_name-VERSION.tar.gz

VERSION:major.minor.release

Major: the major version number, which usually represents the version branch of major feature improvements

Minor: minor version number, which usually represents a change in a function in a branch of a version

Release: release number, fixed some bug or optimized a piece of code

Apache-tomcat-7.0.63.tar.gz

Rpm package naming rules:

Source code package: source code

Software_name-VERSION.src.rpm

Binary package:

Software_name-VERSION- [release]. [os]. Arch.rpm

VERSION:major.minor.release

[release]: the release number of the rpm packet

[os]: supported operating system version, el6, el7, suse11, fedora22,...

Arch: hardware platform type, I 386, x64 (amd64), ppc, sparc, noarch,...

Puppet-3.8.7-1.el7.noarch.rpm

When making rpm packages, its makers usually use subcontracting technology to build rpm packages.

Build multiple packages according to the different functions of the program

Packages that are subcontracted are generally divided into two categories:

Main package:

Software_name-VERSION- [release]. [os]. Arch.rpm

Ancillary feature Pack:

Software_name-function-VERSION- [release]. [os]. Arch.rpm

Generally speaking, the main package and the subsidiary package have the same version number, release number, operating system and compatible platform identification.

Therefore, the main package is often relied on by all the ancillary feature packages, which cannot be installed without installing the main package.

Function:devel, utils, libs, tools, manual, client, common,...

Dependencies:

A-- > B-- > CD-- > A dependent black hole

Front-end tools for package management:

RHEL | frontend management tools of CentOS system: yum, Yellow dog Update Midifier

Yum will start transactions when implementing installation, upgrade, uninstallation, etc.

The so-called transaction regards the operation as a whole, either all or none at all.

Fedora 22+:dnf

Front-end tool of Debian system: apt-get,apt-cache

Apt-get: implement installation, uninstall and other functions

Apt-cache: implement keyword-based search function to manage local cache and cached metadata

Suse front-end tool: zypper

Rpm package Manager:

1.rpm command line tool

2.yum tool

Rpm command line tool:

Features:

1. Package the component files of the compiled application into one or more package files

two。 Software package installation, uninstall, upgrade, query, verification and database management functions

A list of the files in the rpm package:

1. The file of the program

two。 List of documents

3. Script files that run when the software is installed or uninstalled are divided into four categories:

Preinstall: script run before the formal installation operation begins,% pre

Postinstall: script executed after installation,% post

Preuninstall: script run before the official uninstall operation starts,% preun

Postuninstall: script executed after the uninstall is complete,% postun

Rpm database (public):

The name and version of the installed package

/ var/lib/rpm

The way to get the package:

1. CD-ROM of the distribution version of the system

two。 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 for a project:

4. Rpm package sites produced by third-party organizations

Fedora EPEL: the official community organization of Red Hat, which also includes EPEL images in the mirror site.

Search engine:

Http://pkgs.org

Http://rpmfind.net

Http://rpm.pbone.net

5. Make it yourself

Recommendation: after obtaining the package, perform an integrity check

Source legitimacy:

The data encrypted by the digital signature of the program provider is decrypted and verified by its public key.

Package integrity:

Sha-1 parity check code

The use of rpm and yum tools

Rpm command line tool:

Install, uninstall, upgrade (downgrade), query, file verification, verification, database maintenance

Common options for the rpm command:

-v: displays the information of the installation routine, only the name of the installation software

-vv: displays very detailed operation information

Installation:

Rpm {- I |-- install} [install-options] PACKAGE_FILE...

Install-options:

-h,-- hash: use 50 "#" to indicate the installation progress

-- test: it's not really about installing the package, it's just testing whether it can be done properly during installation, dry run mode

-- nodeps: ignore installation errors caused by dependencies and are not recommended

-- replacefiles: when installing a software package, the files in the package will directly replace the files that were originally installed

-- replacepkgs: reinstall without uninstalling the package

-- noscripts: do not run any scripts

-- nosignature: regardless of whether the source of the package is legitimate

-- nodigest: regardless of 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 that is not installed in advance, install it completely; if you have already installed the old version, you can upgrade the installation.

Rpm {- F |-- freshen} [install-options] PACKAGE_FILE...

Only low-version packages that have been installed can only be upgraded and installed

Common options: same as installation

-- oldpackage: downgrade the installation and replace the new version of the package with the old version

-- force: force upgrade

Note:

1. It is strongly recommended not to upgrade the kernel; Linux can support multiple kernels, you can install a new version of the kernel directly, and you can manually replace it in the startup interface.

two。 Upgrading the installation may change the files, so by default, the system will not directly change the configuration file of the previously installed software, and the configuration file in the new package will be renamed, usually: FINENAME.rpmnew

Uninstall:

Rpm {- e |-- erase} [--allmatches] [--nodeps] [--noscripts] [--notriggers] [--test] PACKAGE_NAME...

-- allmatches: uninstalls all versions of packages that match the specified name

-- nodeps: ignore dependencies when uninstalling. It is not recommended to use

-- test: test uninstall, dry run mode

Query:

Rpm {- Q |-- query} [select-options] [query-options]

[select-options]

PACKAGE_NAME: give the package name directly

-AMAL: query the names of all installed packages

~] # rpm-qa | grep mysql

-fmam Murray file FILE: find out which package provided the specified file

-pmam Meltel package PACKAGE_FILE: perform query operations on package files that have not yet been installed

-- whatprovides CAPABILITY: query which package the specified CAPABILITY is provided by

-- whatrequires CAPABILITY: queries which package the specified CAPABILITY is dependent on

[query-options]

-- changelog: query the changelog of the rpm package

-cmaire: query which configuration files are included in the specified package

-dmine:: query which document files are in the specified package

-imam murmurinfo: query package-related information, including version number, release number, size, etc.

-lmmam Musi list: the list shows which files will be generated by the package installation

-- provides: lists all the CAPABILITY provided by the specified package

-Rmaine Mustang: query the dependencies of the specified package

-- scripts: view the contents of the scripts carried by the package

Specific usage:

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

Initialization and reconstruction of database

/ var/lib/rpm

Rpm {--initdb |-- rebuilddb}

[--dbpath DIRECTORY]

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report