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 Day 11: (August 17) Linux package Management rpm

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Linux Day 11: (August 17) Linux package Management rpm

Software running environment

API:Application Programming Interface

POSIX:Portable OS

Program source code-- > preprocessing-- > compilation-- > assembly-- > link

Static compilation:

Shared compilation: .so

ABI:Application Binary Interface

Windows is not compatible with Linux

ELF (Executable and Linkable Format)

PE (Portable Executable)

Library-level virtualization:

Linux: WINE

Windows: Cywin

Development language

System-level development

C

C++

Application-level development

Java

Delphi

Python

Go

Php

Perl

Ruby

Package Manager

Components of a binary application:

Binaries, library files, configuration files, help files

Package Manager:

Debian:deb file, dpkg package manager

Redhat: rpm file, rpm package manager

Rpm: RedhatPackage Manager

RPM Package Manager

Package naming

Source code: name-VERSION.tar.gz | bz2 | xz

VERSION: major.minor.release

How the rpm package is named:

Name-VERSION-release.arch.rpm

Example: bash-4.2.46-19.el7.x86_64.rpm

VERSION: major.minor.release

Release:release.OS

Common arch:

X86: i386, i486, i586, i686

X86_64: x64, x86_64, amd64powerpc: ppc

Platform independent: noarch

Package naming and tools

Packages: sorting and unpacking

Application-VERSION-ARCH.rpm: main package

Application-devel-VERSION-ARCH.rpm development subpackage

Other subpackages of Application-utils-VERSION-ARHC.rpm

Other subpackages of Application-libs-VERSION-ARHC.rpm

Between packages: there may be dependencies, even circular dependencies

Resolve dependency package management tools:

Front-end tools for yum:rpm package manager

Apt-get:deb package Manager front-end tools

Zypper: rpm front-end management tool on suse

Dnf: Fedora 18 + rpm package Manager front-end management tool

Library file

View the library files that the binary depends on:

Ldd/PATH/TO/BINARY_FILE

Manage and view the library files loaded on this machine:

Ldconfig

/ sbin/ldconfig-p: displays all available library file names and file path mapping relationships that have been cached on this machine

Configuration file: / etc/ld.so.conf, / etc/ld.so.conf.d/*.conf

Cache file: / etc/ld.so.cache

Package Manager

Package Manager:

Function: package one or more package files from each component file of the compiled application, so as to easily and quickly realize the management operations such as installation, uninstallation, query, upgrade and verification of the package.

1. Composition of package files (unique to each package)

Files in the RPM package

RPM metadata, such as name, version, dependency, description, etc.

Scripts that run when installing or uninstalling

2. Database (public)

Package name and version

Dependency relationship

Function description

File path and check code information generated after package installation

How to manage packages:

Use the package manager: rpm

Use front-end tools: yum, dnf

The way to get the package:

(1) the CD-ROM of the system version or the official server

CentOS image:

Https://www.centos.org/download/

Http://mirrors.aliyun.com

Http://mirrors.sohu.com

Http://mirrors.163.com

(2) official site of the project

(3) third-party organizations:

Fedora-EPEL:

Extra Packages for Enterprise Linux

Recommended by Rpmforge:RHEL, the package is very complete

Search engine:

Http://pkgs.org

Http://rpmfind.net

Http://rpm.pbone.net

Https://sourceforge.net/

(4) make it yourself.

Note: check its legitimacy: source legitimacy, package integrity

Rpm package management

Use the rpm command to manage the package on a CentOS system:

Installation, uninstallation, upgrade, query, verification, database maintenance

Installation:

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

-v: verbose

-vv:

-h: displays the progress of package management execution in #

Rpm-ivhPACKAGE_FILE...

Rpm package installation

[install-options]

-- test: test the installation, but do not actually perform the installation; dry run mode

-- nodeps: ignore dependencies

-- replacepkgs | replacefiles

-- nosignature: do not check the validity of the source

-- nodigest: do not check package integrity

-- noscripts: do not execute package scripts

% pre: pre-installation script;-- nopre

% post: post-installation script;-- nopost

% preun: pre-uninstall script;-- nopreun

% postun: script after uninstallation;-- nopostun

Rpm package upgrade

Upgrade:

Rpm {- U |-- upgrade} [install-options] PACKAGE_FILE...

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

Upgrade: upgrade if an old package is installed

If there is no legacy package, install

Freshen: upgrade if an old package is installed

If there is no legacy package, no upgrade operation is performed

Rpm-UvhPACKAGE_FILE...

Rpm-FvhPACKAGE_FILE...

-- oldpackage: downgrade

-- force: force upgrade

Upgrade attention item

(1) do not upgrade the kernel; Linux supports the coexistence of multiple kernel versions, so install a new version of the kernel directly

(2) if the configuration file of the original package has been modified after installation, the same configuration file provided by the new version will not directly overwrite the configuration file of the old version, but the new version of the file will be renamed (FILENAME.rpmnew) and retained.

Packet query

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

[select-options]

-a: all packages

-f: check which package installation generates the specified file

-p rpmfile: query for package files that have not been installed

-- whatprovidesCAPABILITY: query which package provides the specified CAPABILITY

-- whatrequiresCAPABILITY: query which package the specified CAPABILITY is dependent on

Rpm2cpio package files | cpio-itv preview of files in the package

Rpm2cpio package files | cpio-id "* .conf" releases files in the package

Packet query

[query-options]

-- changelog: query the changelog of the rpm package

-c: the configuration file of the query program

-d: query the documentation of the program

-I: information

-l: view all files generated after the specified package is installed

-- scripts: the script that comes with the package

-R: query the CAPABILITY on which the specified package depends

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

Query usage:

-qi PACKAGE,-qfFILE,-qc PACKAGE,-qlPACKAGE,-qdPACKAGE

-qpiPACKAGE_FILE.-qplPACKAGE_FILE.

-qa

Uninstall:

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

Packet 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 mTimediffers

P capabilities differ

Validity and integrity verification of package sources:

Integrity verification: SHA256

Verification of Source legitimacy: RSA

Public key encryption:

Symmetric encryption: encrypt and decrypt using the same key

Asymmetric encryption: keys are paired

Public key: public key, public owner

Secret key: private key, cannot be made public

Import the required public key:

Rpm-K | checksigrpmfile checks the integrity and signature of the packet

Rpm--import / etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Available on the CentOS 7 distribution CD: RPM-GPG-KEY-CentOS-7

Rpm-qagpg-pubkey*

Rpm database

Database Reconstruction:

/ var/lib/rpm

Rpm {--initdb |-- rebuilddb}

Initdb: initialization

If the database does not exist in advance, create a new database

Otherwise, no action is performed

Rebuilddb: rebuild the database index directory of the installed package header

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