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 package Management rpm yum compilation

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

Share

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

Rpm command: rpm [OPTIONS] [PACKAGE_FILE]

Install:-I,-- install

Upgrade:-U,-- update,-- F,-- freshen

Uninstall:-e,-- erase

Query:-Q,-- query

Check:-V,-- verify

Database maintenance:-- builddb,-- initdb

Install: 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 2% progress

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

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

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

Preuninstall: the uninstall process actually starts executing the script that was run before,% preun,-- nopreun

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

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

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

(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 configuration file of the original version, but will be provided after renaming (FILENAME.rpmnew) the configuration file of the new version.

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

-a,-- all: query all installed packages

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

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

-- whatprovides CAPABILITY: query which package provides the specified CAPABILITY

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

[query-options]

-changelog: query the changlog 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 PACKAGE,-qf FILE,-qc PACKAGE,-ql PACKAGE,-qd PACKAGE

-qpi PACKAGE_FILE,-qpl PACKAGE_FILE,-qpc 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

Package source legality verification and integrity verification:

Legal verification of the source:

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

Correction:

(1) when the program signed by this organization is installed, correction will be performed automatically.

(2) Manual correction: rpm-K PACKAGE_FILE

Database rebuild: 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 DIRECTORY]

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

CentOS: yum, dnf

YUM: yellow dog, Yellowdog Update Modifier

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}

The default is: roundrobin, which means random selection

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] [...]

* check-update

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

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

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

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

* list [...]

* info [...]

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

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

* makecache

* groupinstall group1 [group2] [...]

* groupupdate group1 [group2] [...]

* grouplist [hidden] [groupwildcard] [...]

* groupremove group1 [group2] [...]

* groupinfo group1 [...]

* search string1 [string2] [...]

* shell [filename]

* resolvedep dep1 [dep2] [...]

* 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]

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

* history [info | list | packages-list | packages-info | summary | addon-info | redo | undo | rollback | new | sync | stats]

* check

* help [command]

Display warehouse list: repolist [all | enabled | disabled]

Display the package:

List

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

# yum list {available | installed | updates} [glob_exp1] [...]

Installation package: install package1 [package2] [...]

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

Upgrade package: update [package1] [package2] [...]

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

Check for available upgrades: check-update

Uninstall the package: remove | erase package1 [package2] [...]

Check the package information: info [...]

See which package the specified feature (which can be a file) is provided by: provides | whatprovides feature1 [feature2] [...]

Clean the local cache: clean [packages | metadata | expire-cache | rpmdb | plugins | all]

Build cache: makecache

Search: search string1 [string2] [...]

Search for package name and summary information with specified keywords

View the capabilities:deplist package1 [package2] [...] on which the specified package depends

View yum transaction history: history [info | list | packages-list | packages-info | summary | addon-info | redo | undo | rollback | 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:

* groupinstall group1 [group2] [...]

* groupupdate group1 [group2] [...]

* grouplist [hidden] [groupwildcard] [...]

* groupremove group1 [group2] [...]

* groupinfo group1 [...]

How to use CD as a local yum repository:

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

# mount-r-t iso9660 / 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=repoidglob: temporarily disable the repo specified here

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

-- noplugins: disable all 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]

There are three steps to code compilation and installation:

. / configure:

(1) pass parameters through options to specify the enabled feature, installation path, etc. During execution, you will refer to the user's assignment and Makefile.in file to generate makefile.

(2) check the external environment on which it depends

Make: build applications based on makefile files

Make install

Development tools:

Autoconf: generate configure script

Automake: generate Makefile.in

Recommendation: check INSTALL,README before installation

Access to source code of open source programs:

Official self-built site:

Apache.org (ASF)

Mariadb.org

...

Code hosting:

SourceForge

Github.com

Code.google.com

C _ blank: 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", "Server Platform Development"

Step 1: configure script

Options: specify installation location, specify enabled features

-- help: get the options it supports

Option classification:

Installation path setting:

-- prefix=/PATH/TO/SOMEWHERE: specify the default installation location; default is / usr/local/

-- sysconfdir=/PATH/TO/SOMEWHERE: configuration file installation location

System types:

Optional Features: optional featur

-- disable-FEATURE

-- enable-FEATURE [= ARG]

Optional Packages: optional package

-- with-PACKAGE [= ARG]

-- without-PACKAGE

Step 2: make

Step 3: make install

Configuration after installation:

(1) Export the binary program directory to the PATH environment variable

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

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

(2) Export the path of the library file

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) Export header file

A link-based approach to:

Ln-sv

(4) Export help manual

Edit / etc/man.config 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