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 system package Management

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

Share

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

Linux package Management

API:Application Program Interface

ABI:Application Binary INnterface

Unix-like, the application file format of the secondary format on the system is

ELF

The application file format of the secondary format of the Windows system is:

Exe,msi

Library-level virtualization:

Linux:WinE, which can run the binary executable program of Windows on Linux system

Windows:Cywin, which can run the bit binary executable program of Linux on Windows system.

Among the various programming languages, it can be divided into

System-level development:

The performance requirements of Cachet Centralizers are more stringent, and it is a service-level application that does not require a graphical interface.

Go

Application-level development:

Java/python/perl/ruby/php:

Java:hadoop,hbase, program operation depends on jvm

Python:openstack, program operation depends on pvm

Perl: (perl) interpreter

Ruby:

C _ blank + program format:

Source code: program code in text format

Compiler development environment: compiler, header file, development library

Binary format: program code in text format-> compiler-> binary format (binary programs, library files, matching files, help files)

Java/python program format:

Source code: compiled into a format that can run on its virtual machine

Development environment: compiler, development library

Binary system

Project build tools:

C/c++:make

Java:maven

Package Manager:

Source code-- > target binary format-- > organized into one or a limited number of "package" files

Install, upgrade, uninstall, query, verify

Package Manager:

Debain:dpt,dpkg, ".deb"

Redhat:redhat package manager, rpm ".rpm" rpm is package manager

S.u.S.E:

Gentoo:ports

ArchLinux:

Source code: name-vVERSION.tar.gz

VERSION:major.minor,release

Rpm package naming format:

Name-VERSION-release.arch.rpm

VERSION:major.minor.release

Release number of the release.arch:rpm package

Release.os:2.el7.i386.rpm

Archetecture:i386,x64 (amd64), ppc,noarch

Redis-3.0.2-1.centos7.x64.rpm

Dependencies:

Front-end tools: automatically resolve dependencies

Front-end tools for rpm package Manager on yum:rhel system

Apt-get (apt-cache): a front-end tool for deb package manager

Zypper:suse 's rpm Manager front-end tool

Front-end tools for rpm package Manager on dnf:Fedora 22 + system

Package Manager:

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

1. The composition manifest of the package (each package is implemented separately):

List of documents

Scripts that run when installing or uninstalling

two。 Database (public)

Name and version of the package

Dependency relationship

Function description

Install the file path and check code information of the generated files

The way to get the package:

1. The CD of the system distribution or the official file server (or mirror site)

two。 The official site of the project

3. Third-party organizations:

(a) EPEL:

(B) search engines

Http://pkgs.org

Http://rpmfind.net

Http://rpm.pbone.net

4. Make your own rpm package

Suggestion: check its legality

Source legitimacy

Integrity of the package

The rpm command management package on CentOS systems:

Install, upgrade, uninstall, query and verify, database maintenance

Rpm command: rpm [OPTIONS] [PACKAGE_FILE]

Install:-iMager Musi install

Upgrade:-Ujinghujinghuaupdatejinghujinghui Fjingwuqichen

Uninstall:-eJing Musicerase

Query:-QMAT PULICULING

Check:-VMagne Mustang

Database maintenance:-- builddb,--initdb

Installation:

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

Rpm-ivh PACKAGE_FILE...

GENERAL OPTIONS:

-v:verbose, details

-vv: more detailed output

[install-options]

-h:hash marks output progress bar; each # represents the progress of% 2

-- test: test installation, check and report dependencies and conflict messages, etc.

-- nodeps: ignore dependencies; not recommended

-- replacepkgs: reinstall

Note: rpm can have its own script.

Four categories:

Preinstall: script run before the installation process starts,% pre

Postinstall: script run after the installation process is complete,% post

Preuninstall: the uninstall process actually starts to execute the script that was run before,% preun

Postuninstall: script run after the uninstall process is complete,% postun

-- nosignature: do not check the signature information or the validity of the source

-- nodigest: do not check package integrity information

Upgrade:

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

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

-U: upgrade or install

-F: upgrade

Rpm-Uvh PACKAGE_FILE...

Rpm-Fvh PACKAGE_FILE...

-- oldpackage: downgrade

-- force: force upgrade

Note:

1. Do not upgrade the kernel

Linux supports the coexistence of multiple kernel versions, so install the new kernel directly

two。 If the configuration file of a source package has been modified after installation, the same configuration file provided by the new version of the program will not overwrite the original version of the configuration file when upgrading, but will be provided after renaming (FILENAME.rpmnew) the new version of the configuration file.

Uninstall:

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

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

-- nodeps: ignore dependencies

-- test: test uninstall, dry run mode

Query:

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

[select-options]

PACKAGE_NAME: query whether the specified package is installed and its version

-AMAL: query all packages that have been installed

-fmam Musi file FILE: query which package the specified file is installed and generated

-pmam Meltel package PACKAGE_FILE: used to perform query operations on uninstalled packages

-- whatprovides CAPABILITY: query which package provides the specified CAPABILITY (capability)

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

[query-options]

-- changelog: query the changelog of the rpm package

-lmaine Meltel list: a list of all files generated by the package installation

-imam murmurinfo: information about the package, version number, size, package group to which it belongs, etc.

-cmaire: query the configuration files provided by the specified package

-dterminal: query the documents provided by the specified package

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

-Rmaine Mustang: query the dependencies of the specified package

-- scripts: view the script snippets that come with the package

-p PACKAGE_FILE: query information about packages that have not yet been installed

Usage:

-qi PACKAGE: query the brief description information of a package

-qf FILE: query which package to install and generate the specified file

-qc PACKAGE: query all configuration files generated after a package is installed

-ql PACKAGE: query the list of files generated by a package installation

-qd PACKAGE: query all the help files generated after the installation of a package

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

Verification of validity and integrity of packet source

Verification of source legitimacy:

Integrity verification:

Obtain and import the keys of the trusted package maker:

For CentOS distributions: rpm--import / etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Validate

1. Verification is performed automatically when you install a program signed by this organization

two。 Manual verification: rpm-K PAVKAGE_FILE

Database Reconstruction:

Rpm Manager database path: / var/lib/rpm/

Query operation: through the database here

Get help:

Centos6:man rpm

Centos7:man rpmdb

Rpm {--initdb |-- rebuilddb}

-- initdb: initializes the database. Currently, there is no database to create a new one. Currently, no operations are performed.

-- rebuilddb: rebuild the build and recreate it by reading all installed packages on the current system

CentOS:yum dnf

URL:ftp://

Yum repository:yum repo

Stores a large number of rpm packages and related metadata files for the package (placed in a specific directory: repodata)

File server:

Ftp://

Http://

Nfs://

File:///

Yum client:

Configuration file:

/ etc/yum.conf: provide common configuration for all warehouses

/ etc/yum/repos.d/*.repo: provides configuration for pointing to the warehouse

The definition of the warehouse point:

[repositoryID]

Name=Some name for this repository

Baseurl=url://path/to/repository/

Enabled= {1 | 0}

Gpgcheck= {1 | 0}

Gpgkey=URL

Enablegroups= {1 | 0}

Failovermethod= {roundrobin | priority}

Default is roundrobin

Cost=

The default is 1000

Usage of the yum command:

Yum [options] [command] [package...]

Command is one of:

* install package1 [package2] [...]

* update [package1] [package2] [...]

* update-to [package1] [package2] [...]

* update-minimal [package1] [package2] [...]

* check-update

* upgrade [package1] [package2] [...]

* upgrade-to [package1] [package2] [...]

* distribution-synchronization [package1] [package2] [...]

* remove | erase package1 [package2] [...]

* autoremove [package1] [...]

* list [...]

* info [...]

* provides | whatprovides feature1 [feature2] [...]

* clean [packages | metadata | expire-cache | rpmdb | plugins | all]

* makecache [fast]

* groups [...]

* search string1 [string2] [...]

* shell [filename]

* resolvedep dep1 [dep2] [...]

(maintained for legacy reasons only-use repoquery or yum provides)

* localinstall rpmfile1 [rpmfile2] [...]

(maintained for legacy reasons only-use install)

* localupdate rpmfile1 [rpmfile2] [...]

(maintained for legacy reasons only-use update)

* reinstall package1 [package2] [...]

* downgrade package1 [package2] [...]

* deplist package1 [package2] [...]

* repolist [all | enabled | disabled]

* repoinfo [all | enabled | disabled]

* repository-packages [package2] [...]

* version [all | installed | available | group-* | nogroups* | grouplist |

Groupinfo]

* history [info | list | packages-list | packages-info | summary | addon-info | redo | undo | roll-

Back | new | sync | stats]

* load-transaction [txfile]

* updateinfo [summary | list | info | remove-pkgs-ts | exclude-updates | exclude-all

| | check-running-kernel]

* fssnapshot [summary | list | have-space | create | delete]

* fs [filters | refilter | refilter-cleanup | du]

* check

* help [command]

Display a list of warehouses:

Repolist [all | enabled | disabled]

Display the package:

List

# yum list [all | glob_exp1] [glob_exp2] [...]

Yum list {available | installed | updates} [glob_exp1] [...]

All available; all installable; all upgradeable

Install the package:

Install package1 [package2] [...]

Reinstall package1 [package2] [...] (reinstall)

Upgrade the specified package:

Update [package1] [package2] [...]

Downgrade package1 [package2] [...] (downgrade)

Check the available upgrade packages:

Check-update

Uninstall the package:

Remove | erase package1 [package2] [...]

View the information of the package:

Info [...]

Check that the specified feature (which can be a file) is provided by that package:

Provides | whatprovides featurel [feature2] [...]

Clean up the local cache:

Clean [packages | metadata | expire-cache | rpmdb | plugins | all]

Build the cache:

Makecache

Search for:

Search string1 [string2] [...]

Search for packages and summary information with specified keywords

View the capabilities on which the specified package depends:

Deplist package1 [package2] [...]

View yum transaction history:

History [info | list | packages-list | packages-info | summary | addon-info | redo | undo | roll-

Back | new | sync | stats]

Install and upgrade local packages:

* localinstall rpmfile1 [rpmfile2] [...]

(maintained for legacy reasons only-use install)

* localupdate rpmfile1 [rpmfile2] [...]

(maintained for legacy reasons only-use update)

Commands related to package group management:

Groups [...]

Groupinstall group1 [group2] [...]

Groupupdate group1 [group2] [...]

Grouplist [hidden] [groupwildcard] [...]

Groupremove group1 [group2] [...]

Groupinfo group1 [...]

* search string1 [string2] [...]

How to use the CD as a local yum repository:

(1) Mount the CD to a directory, such as / media/cdrom

# mount / dev/cdrom / media/cdrom

(2) create a configuration file

[CentOS7]

Name=

Baseurl=

Gpgcheck=

Enabled=

Command line options for yum:

-- nogpgcheck: gpgcheck is prohibited

-y: automatic answer is "yes"

-Q: silent mode

-- disablerepo=repoidglog: temporarily disable the repo specified here

-- enablerepo=repoidglob: temporarily enable the repo specified here

-- noplugins: disable plug-ins

The variables available in the repo configuration file of yum:

$releasever: the major version number of the current OS release

$arch: platform

$basearch: basic platform

$YUM0-$YUM9

Http://mirrors.magedu.com/centos/$releasever/$basearch/os

Create a yum repository

Createrepo [options]

Package compilation and installation:

After testapp-VERSION-release.src.rpm-- > installation, use the rpmbuild command to make the rpm package in binary format, and then install it

Source code-- > preprocessing-- > compile-- > assemble-- > link-- > execute

Source code organization format:

Multiple files: there are likely to be cross-file dependencies between the code in the file

C, C++:make (configure-- > Makefile.in-- > makefile)

Java:maven

There are three steps to compile and install:

. / configure:

1. Pass parameters through the option, specify the enabled feature, installation path, etc., and generate makefile with reference to the user's assignment and the Makefile.in file.

two。 Check the dependent external environment

Make:

Build the application based on the makefile file

Make install

Development tools:

Autoconf: generate configure script

Automake: generate Makefile.in

Note: check INSTALL,README before installation

Access to source code of open source programs:

Official self-built site:

Apache.org

Mariadb.org

...

Code hosting:

SourceForge

Github.com

Code.google.com

C/c++:gcc (GNU C Complier)

Compile the C source code:

Premise: provide development tools and development environment

Development tools: make gcc, etc.

Development environment: development libraries, header files

Glibc: standard library

Provide development components through "package groups"

CentOS 6: "Development Tools

Compilation and installation

Step 1: configure script

Options: specify installation location, specify enabled features

-- help: get the options it supports

Option classification:

Installation path setting:

-- prefix=/PATH: specify the default installation location. Default is / usr/local/.

-- sysconfdir=/PATH: configuration file installation location

System types: support for cross-compilation

Optional Features: optional featur

-- disable-FEATURE

-- enable-FEATURE [= ARG]

Optional Packages: optional package

-- with-PACKAGE [= ARG], dependent package

-- without-PACKAGE, disable dependencies

Step 2: make

Step 3: make install

Configuration after installation:

(1) Import the binary program directory into the PATH environment variable

Edit file / etc/profile.d/NAME.sh

Export PATH=/PATH/TO/BIN:$PATH

(2) Import library file path

Edit / etc/ld.so.conf.d/NAME.conf

Add the directory where the new library file is located to this file

Have the system regenerate the cache:

Ldconfig [- v]

(3) Import header file

A link-based approach to:

Ln-sv

(4) Import help manual

Edit / etc/man.config | man_db.conf file

Add a MANPATH

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