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

Example Analysis of Program rpm package Management

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Program rpm package management example analysis, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

What's the program? No matter instruction + data, algorithm + data structure. It exists in two forms:

1. Source code: a text file that contains all the code in the programming language of the entire application

two。 Binary: a file that is directly executed after a series of transformations of source code.

Where the process of installing using the source code is as follows:

Preprocessing (using preprocessor)-- > compiling (compiler)-- > bytecode Bitcode for assembly (assembler)-- > systemcall runs directly; libcall needs links (linker); and finally gets the executable binary program file.

When assembling, different hardware is often not compatible with each other. As a result, an international standard was born:

POSIX:Portable Operating System portable operating system. As for IX, it's a tribute to unix.

Whether the final binary can be executed or not depends on the ABI interface of the computer. There are obvious differences in different OS. On unix-like systems, ABI is often in ELF format, if it is Windows series, and generally in exe or msi format.

Let's review the classification of programming languages.

Application level programming language:

Java (good at making applications, doing systematic vegetable chicken)

Hadoop2- big data processing platform, hbase- database, ELK- log query and analysis retrieval system

These software operating environments require a proprietary environment called JVM

Python (too far from the underlying hardware, consuming system resources at first. Now, consumption can be ignored)

Openstack-- cloud stack, saltstack-- automatic operation and maintenance management tool running environment: PVM

Perl, ruby (popular in Japan, developed a lot of once classic games.)

PHP 、 go

The interpreters required by JVM PVM and other application-level languages are developed by C language.

System-level programming language:

C / C +

Kernel programming language of Linux and Unix

Compiler development environment: preprocessor, compiler, header file, development library file (library that allows the compilation library to run)

(development environments for application-level languages such as Java or Python: preprocessors, compilers, development library files;)

In general, there are multiple source code files, and there is a certain relationship between these files; we call them dependencies.

Software project building tools:

C/C++:make

Java:maven

Python:buildout

Despite these build tools, it is very difficult to compile the source code, so some people package the commonly used code into packages and release the open source community for ease of use

Manager of the package:

Different linux distributions with different package managers

Debian:dpt-Debian Package Toolkits . All packages are packaged into package files with .deb suffixes, command line tool dpkg

Redhat:rpm-Redhat Package Manager, rpm tool, .rpm suffix name

Rpm's industry standard for package managers called linux

It was written in perl at first, then rewrote rpm in C, and renamed it rpm is package manager after publication.

Slackware (S.u.S.e): uses rpm, but modifies rpm so that it is approved by Redhat

Gentoo: starting from the kernel, users can choose and choose software at will

Package manager adopted: FreeBSD's portage package management mechanism, emerge tool

Archlinux:pacman

Take CentOS as an example to introduce the relevant contents of the rpm package manager:

1. 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 indicates that a function has changed in the branch of a certain version

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

Rpm package:

Source code package: 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 package

[os]: operating system version information supported by the software, el6, el7, suse11, fedora22...

Arch: hardware architecture type: i386 i686 x64 (amd64) ppc sparc noarch...

For example, gcc-4.8.5-4.el7.x86_64.rpm

When making rpm packages, its makers usually use subcontracting technology to build rpm packages: according to the different functions of the program, build multiple packages; the subcontracted are generally divided into two categories

1. Main package:

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

two。 Ancillary feature Pack:

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

Generally speaking, the main package and the ancillary package have the same version number, release number, operating system requirements and hardware architecture type

So the main package is often dependent on all the satellite packages; the dependency relationship: a-- > B-- > CD-- > A forms a dependency black hole, so rpm has many disadvantages of "being unkind to others".

The way to get the package:

1. A CD of the system distribution, or a mirror image

two。 Official file server or mirror site:

Http://mirrors.aliyun.com

Http://mirrors.sohu.com

Http://mirrors.163.com

Http://mirrors.tuna.tsinghua.edu.cn

Http://mirrors.hust.edu.cn

...

3. The official site of a project, such as apache

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 can basically search for all

A site of http://rpmfind.net in France

Http://rpm.pbone.net

5. Make it yourself.

Recommendation: perform verification and integrity check after obtaining the package:

1. Source legitimacy

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

two。 Package integrity

Sha-1 parity check code

Rpm command line tool:

Install uninstall upgrade (downgrade) query file check

[general options]:

-v-- verbose: displays the details of the installation process, showing 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 uses 50 "#" to indicate the installation progress

-- test: it's not really a security package, it's just testing whether it can be completed properly during installation, dry run

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

When replacefiles installs the software package, the files in the package will directly replace the files that were originally installed.

-- replacepkgs does not uninstall the package but reinstall it

Noscripts does not run any scripts

-- nopre

-- nopost

-- nosignature does not consider whether the source of the software package is legitimate

-- nodigest does not consider whether the package is complete or not

Upgrade:

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

Can be upgraded or newly installed

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

Just upgrade and install the lower version of the package that has already been installed

Common options are the same as installation

Special options:

-- oldpackage downgrade installation

-- force mandatory upgrade

Note:

1. Strongly recommended: do not upgrade the kernel; linux supports multiple kernels

two。 The file changes after the upgrade. By default, the system will not directly change the previous configuration file, and the configuration file of the new package will be renamed, usually: FILENAME.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

-- test: test uninstall

-- nopreun

-- nopostun

Query:

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

[select-options]

-amam Murall: query the names of all installed packages

-fmaine Murray file FILE to find which package the specified file is provided by

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

-- whatprovided CAPABILITY queries which package provides the specified CAPABILITY

-- whatrequires CAPABILITY

[query-options]

-cmaire: view the relevant configuration files

-iLINGULINPULFUPINO query package related information, including version number, release number, etc.

The list of lmmam Meltel list shows which files will be generated by the installer package

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

The dependency of the specified package is queried by Rmaine Melissa

-- scripts: the script that queries the package

Check:

Rpm {- V |-- verify} [select-options] [verify-options]

[select-options] is the same as [select-options] of the query

Certification:

-import PUBKEY... Import the corresponding / PATH/TO/KEY_FILE

{- K |-- checksig} [--nosignature] [--nodigest] PACKAGE_FILE...

Manual testing to verify the validity of the software package

Database Management:

Initialization and reconstruction of the database: / var/lib/rpm

Rpm {--initdb |-- rebuilddb}

[--dbpath DIRECTORY]

After reading the above, have you mastered the method of sample analysis of the program rpm package management? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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

Development

Wechat

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

12
Report