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

Software package management (rpm and yum)

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

Share

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

In the system management of software packages, the management of software packages is the most important and the foundation of system management; only when we learn the management of software packages can we talk about other applications; in this paper, in the format of bibliographic documents, list the relative documents of installation, update and query of software packages faced by novice brothers, as well as several commonly used software package management tools.

Package Management:

First, RPM package management

Second, yum package management

First, RPM package management:

The RPM command management package on centos systems:

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

RPM command: rpm [OPTIONS] [PACKAGE_FILE]

Install:-I,-- install

Upgrade:-U _ Jing _ talk _ update,-_

Uninstall:-eJing Musicerase

Query:-QMAT PULICULING

Check:-v.jingle murmur

Database maintenance:-- builddb,--initdb

(1) an transfer:

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

GENERAL OPTIONS:

-v: verbose, details

-vv: more detailed output

[install-options]

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

-- test: test transfer, check and report dependency and conflict messages, etc.

-- nodeps: ignore dependencies and are not recommended

-- replacepkgs: reinstall

-- nosignature: do not check package signature information or source validity

-- nodigest: do not check package integrity information

-- noscripts:

Preinstall: script that was run before the transfer process started,% pre,--nopre

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

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

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

Note: rpm can have its own script.

(2) 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 transfer to the new version of the kernel directly

2. If the configuration file of an original package has been modified after installation, when upgrading, the same configuration file provided by the new version of the program will not overwrite the original version of the configuration file, but will be renamed (FILENAME.rpmnew) and retained.

(3) 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, dry run mode

(4) Enquiry:

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

[select-options]

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

-a,-- all: query all installed packages

-f,-- file FILE: query all specified files for which package is installed and generated

-p,-- package PACKAGE_FILE: used to perform query operations on packages that are not installed

-- whatprovides CAPABILITY: which package is used to query the specified CAPABILITY

-- whatrequires CAPABILITY: the CAPABILITY specified by the query is dependent on that package

[query-options]

-- changelog: query the changelog of the rpm package

-l,-- list: list of all files generated by the program installation

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

-c,-- configfiles: query the configuration file provided by the specified package

-d,-- docfiles: query the documents provided by the specified package

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

-R,-- requires: query the dependencies of the specified package

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

Usage:

-qi PACKAG,- qf FILE.-qc PACKAG,- ql PACKAG,- qd PACKAG,-qpl PACKAG_FILE.

(5) 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

Package source validity verification and integrity verification:

Verification of Source legitimacy: RSA

Integrity verification: SHA256

Get and import the secret key of the trusted package maker:

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

Verify:

(1) when a program signed by this organization is installed, verification is performed automatically.

(2) Manual verification: rpm-k PACKAGE_FILE (source legality and integrity)

(6) Database reconstruction:

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

Query operation: through the database here

Get help:

Centos 6:man rpm

Centos 7:man rpmdb

Rpm {--initdb |-- rebuilddb} [--dbpath DIRECTORY] [--root DIREC-TORY]

-- initdb: initializes the database. Currently, no database can be instantiated to create a new one; currently, sometimes no action is performed

-- rebuilddb: rebuild, recreate by reading all packages that have been installed on the current system

Second, yum package management:

(1) yum configuration file

1Jing yum client profile:

/ 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] (warehouse ID)

Name=Some name for this repository (warehouse name)

Baseurl=url://path/to/repository/ (address)

Enabled= {1 | 0} (whether enabled or not)

Gpgcheck= {1 | 0} (whether to check)

Gpgkey=URL

File server (URL):

Ftp://

Http://

File:///

2, how to use CD as the local yum repository:

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

# mount / dev/cdrom / media/cdrom

Create a configuration file, vim / etc/yum.repos.d/centos-local.repo

[CentOS7]

Name=

Baseurl=

Gpgcheck=

Enabled=

3. How to use network sources as yum repositories:

Create a configuration file, vim / etc/yum.repos.d/bash.repo

[CentOS7]

Name=

Baseurl=

Gpgcheck=

Enabled=

(2) Command management of yum:

Command line options for yum:

-y: automatic answer is "yes"

-Q: silent mode

-- nogpgcheck: gpgcheck is prohibited

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

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

-- noplugins: disable all plug-ins

Display a list of warehouses:

Yum repolist [all | enabled | disabled] [all | enabled | disabled]

Display the package:

Yum list

Yum list [all]

Yum list [available | installed | updates] [available | installed | upgraded]

Install the package:

Yum install package1

Yum reinstall package1 (reinstall)

Upgrade package:

Yum update package1

Yum downgrade package1 (downgrade)

Check for available upgrades:

Yum check-update

Uninstall the package:

Yum [remove | erase] package1 [uninstall | erase]

View the details of the package

Yum info package

To see which package the specified feature (which can be a file) is provided:

Yum provides feature1

Clean up the local cache:

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

[package | metadata | expired cache | rpmdb | plug-in | all]

Build the cache:

Yum makecache

Search: search for package name and summary (brief) information with specified keywords

Yum search string1

View yum transaction history:

Yum history

Yum history list # (can display a process)

Yum history info # (you can display details of a historical installation package)

Yum history redo # (all installation packages of a history can be reinstalled)

Yum history undo # (you can uninstall all installation packages for a certain history, just like uninstalling them (package groups are not applicable))

Install and upgrade local packages:

Yum install rpmfile (install local packages)

Yum update rpmfile (upgrade local package)

Commands related to package group management:

Yum grouplist (View package Group)

Yum groupinfo group (view the details of the package group)

Yum groupinstall group (installation package group)

Yum groupupdate group (upgrade package group)

Yum groupremove group (uninstall package group)

(3) compile and install:

C _ blank + compiler: gcc (GNU C Complier)

Compile the C source code:

Preparation: provide development tools and development environment

Development tools: make, gcc, etc.

Development environment: development libraries, header files

Glibc: standard library

Implementation: provide development components through "package groups"

CentOS 6:

Development Tools

Server Platform Development

CentOS 7:

Development Tools

Development and Creative Workstation

(the get command is to put directories or files on the desktop.)

Step 1:. / configure script

Options: specify the installation location, specify the enabled feature-- 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: build the application based on the makefile file

Step 3: make install: copy the file to the appropriate path

Configuration after installation:

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

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

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