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

How to realize Software package Management on CentOS system

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to achieve software package management on the CentOS system, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Software package management

Using rpm commands to manage packages on CentOS systems

Installation, uninstallation, upgrade, query, inspection, database maintenance

Rpm installation:

Rpm {- I |-- install} [installation-option] package; package

-h indicates the progress of installation with a # symbol

-v displays details during installation

-vv

-vvv

Use combinations frequently:-ivh,ivvh

For example, rpm-ivh package file

Options for installation:

-- test tests the installation, but does not actually perform the installation, reporting only dependencies, conflict information, etc.

-- nodeps ignores the dependency. The side effect is that it can be installed successfully, but it may not run successfully.

-- replacepkgs overwrite installation-- reinstall and overwrite the original files

-- nosignature is not monitored for source legality.

-- nodigest does not check package integrity

-- snippets where noscipts does not execute the package script

-- foree forced installation

Rpm package upgrade:

Rpm {- U |-- upgrade} [installation-option] package; package

-U upgrade or install

Upgrade: upgrade if a legacy package is installed. If no legacy package exists, upgrade

Rpm {- F |-- freshen} [installation-option] package; package

-F upgrade

Freshen: if a legacy package is installed, upgrade will not be performed if the legacy package does not exist

Common combination:-Uvh,Fvh

For example, rpm-Uvh package file

Upgrade options:

-- oldpackage downgrade

-- force mandatory upgrade

Note when upgrading:

1 do not upgrade the kernel. Linux supports the coexistence of multiple kernels, so you can directly install a new version of the kernel or different versions of the kernel.

2 if the configuration file of the package is modified after installation, the new version of the file will not overwrite the old version of the configuration file when upgrading. Instead, the new version of the file is renamed and suffixed (.rpmnew).

Rpm package query:

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

Installation option ~] # rpm-Q tree to find the exact package name after

-an all packages, ~] # rpm-qa queries all packages installed on the current system ~] # rpm-qa | grep "^ tr" pipe looks for keywords, and the package name that begins with tr

-f check which program installs and generates the specified file ~] # rpm-qf / etc/issue query file is generated by which package

-p rpmfuile queries the uninstalled package files; ~] # rpm-qp tree-1.6.0-10.el7.x86_64.rpm

-- whatprovides performance process query which package is provided by the specified performance process ~] # rpm-Q tree-- whatprovides query which package provides this function

-- whatrequires performance process queries which package the specified performance process depends on ~] # rpm-Q bash-- whatrequires query which package this function depends on

Rpm2cpio package files | cpio-itv preview files in the package ~] # rpm2cpio tree-1.6.0-10.el7.x86_64.rpm | cpio-itv

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

Query options:

-- changelog queries the change log of rpm package ~] # rpm-qc tree-- changelog

-c the configuration file of the query program

-d query program documentation ~] # rpm-qd tree

-I information ~] # rpm-qi tree

-l View all files generated after the specified package is installed ~] # rpm-ql tree

-- script snippet included in the scripts package ~] # rpm-Q bash-- scripts

-R query the performance process on which the specified package depends ~] # rpm-qR bash

-- provides; lists the performance processes provided by the specified package ~] # rpm-Q bash-- provides

Rpm uninstall:

Rpm {- e |-- erase}

-- allmatches removes all matching packages (if not more than one package is specified, it often results in an error)

-- nodeps does not verify package dependencies

-- noscripts does not execute package scripts

-- notriggers does not execute any scripts triggered by this package

-- test is not really installed, just to determine whether it can be installed.

Package inspection: rpm {- V |-- verify}

-- nofiledigest does not verify file summary

-- nofiles does not verify files in the package

-- nodeps does not verify package dependencies

-- noscript does not execute validation scripts

Import the required public key:

~] # rpm-K tree-1.6.0-10.el7.x86_64.rpm checks the integrity and signature of the package

Rpm database:

Database Reconstruction: / var/lib/rpm

Rpm {--initdb |-- rebuilddb}

Initdb initialization

If the time does not exist, create a new database, otherwise no action will be performed

Rebuilddb rebuilds the database whether it currently exists or not, directly recreate the database

Rpm command to realize the main core commands of program management

Installation:-vih,--nodeps,--replacepkgs

Uninstall:-emaine Mushwi nodeps

Upgrade:-Uvh,-Fvh,--nodeps,--oldpackage

Query:-QQ scripts QA chanlog-- QC scripts,-QMAE-QQ,-QMAE-QQ,-QFLY-QFLY

Check:-V

Import GPG key:-- import,-K,--nodigest,--nosignature

Database Reconstruction:-- initdb,--rebuilddb

=

Yum

Yum is the front-end program of rpm, which is used to resolve package-related dependencies and locate software packages among multiple libraries.

Repository: stores a large number of rpm packages and related metadata files (placed in a specific directory repodata)

File server: ftp:

Http://

File:///

Yum profile:

/ etc/yum.conf main configuration file provides data for all warehouses

/ etc/yum.repos.d/*.repo provides configuration for the direction of the warehouse

Create the definition of the library to point to:

The file ends with .repo

Root@Compro ~] # cat / etc/yum.repos.d/base.repo

[base] provide configuration information

Name of the current warehouse in name=CentOS 7

Yum sources in the baseurl= http://10.1.0.1/cobbler/ks_mirror/CentOS-7-x86_64/ classroom

Enabled=1 whether this warehouse is available

Does gpgcheck=0 check the package?

Gpgkey= file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 indicates the path to the access key path

[warehouse ID] for the yum of the current system, this warehouse ID is used to uniquely identify this warehouse point, so it must be unique

Name=name current warehouse description information name

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

Enabled= {1 | 0} whether this warehouse can be used 1 is disabled and 0 can be left unwritten is the default

Gpgcheck= {1 | 0} whether to verify the package

Gpgkey= indicates the path to the gpgkey file

Cost= defaults to 1000

If you use the CD as the local yum repository:

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

# mount / dev/cdrom / media/cdrom

Create a profile:

[CentOS7]

Name= customizes the current warehouse description information

Baseurl= indicates the access path to the repository, which is usually the output of a repository on a file server. Supported type: ftp://;http://;file:///

Gpgcheck= {1 | 10} whether to verify the package

Enabled= {1 | 10} whether it is available on this warehouse. Default is available.

Syntax of the yum command: yum [options] [commands] [packages]

Yum displays a list of warehouses:

Yum repolist [all | enabled | disabled]

Display the package:

Yum list

Yum list [all | glob_ exp1] [glob_exp2]...

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

Install the package:

Yum install package 1 [package 2].

Yum reinstall package 1 [package 2]. Reinstall

Upgrade package:

Yum update [package 1] [package 2].

Yum downgrade package 1 [package 2]. Downgrade

Uninstall the package:

Yum remove | erase package 1 [package 2].

View the information for the package:

Yum info name

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

Yum provides | whatprovides feature 1 [feature 2].

Clean up the local cache:

Yum clean [package | metadata | expire-cache | rpmdf | plugins | all]

Build the cache:

Yum makecache

Search for:

Yum search string 1 [string 2]

Search for package name and summary information with specified keywords

View the capabilities on which the specified package depends

Yum deplist package 1 [package 2].

View yum transaction history

Yum history

Log:

/ var/log/yum.log

Install and upgrade local packages

Yum install rpmfile1 [rpmfile2]...

Yum update rpmfile1 [rpmfile2]...

Commands related to package group management:

Yum groupinstall group1

Yum groupupdate group1

Yum grouplist [hidden] [groupwildcard]

Yum groupremove group1

Yum groupinfo group1

How to use CD as a local yum repository

Mount the CD to a directory

For example, / media/crom # mount / dev/cdrom / media/crom

Create a profile

[CentOS7]

Name=name

Baseurl= file:///

Gpgcheck=0

Enabled=1

Command line options for yum

Yum [options] package

-- nogpgcheck prohibits gpgcheck

-y automatically answers "yes"

-Q silent mode

-- disablerepo=repoidglob temporarily disables the repo specified here

-- enablerepo=repoidglob temporarily starts the repo specified here

-- noplugins disables all plug-ins

=

Source code compilation

Package compilation and installation:

Application-VERSION-release.src.rpm-- >

After 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 (Project Manager, configure-- >

Makefile.in-- > makefile)

Java: maven

C code compilation and installation three steps:

. / configure

Pass parameters through options, specify startup characteristics, installation path, etc.

The makefile is generated with reference to the user's specification and the makefile.in file during execution.

Check the dependent external environment, such as dependent software packages

[cdrom]

Name=centos 7 cdrom

Baseurl= file:///mnt/cdrom

Gpgcheck=0

Enabled=0

Make builds applications based on makefile files

Make install copies files to the appropriate path

Development tools:

Autoconf: generate configure script

Automake: generate Makefile.in

Note: check the installation documentation before installation

Access to source code of open source programs:

Official self-built site:

Apache.org (ASF:Apache Software Foundation)

Mariadb.org

...

Code hosting:

SourceForge.net

Github.com

Code.google.com

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

Compile and install:

Step 1: configure script

Options: specify installation location, specify enabled features

Installation path setting:. / configure-- prefix=/usr/local/http2-- sysconfdir=/etc/http2/

Optional properties:

-- disable-FEATURE

-- enable-FEATURE [= ARG]

Optional package:

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

-- without-PACKAGE, disable dependencies

Configuration after installation:

Import the binary program directory into the PATH environment variable

Edit the file:

[root@Compro ~] # vim / etc/profile.d/http2.sh

PATH=$PATH:/usr/local/http2/bin

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]

Import header file

A link-based approach to:

Ln-sv

Import help manual

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

Add a MANPATH

[root@Compro ~] # vim / etc/man_db.conf

MANDATORY_MANPATH / usr/local/http2/ma

Thank you for reading this article carefully. I hope the article "how to implement Software package Management on CentOS system" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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