Linux_RPM method to solve the dependency of the installation package

1. The basics of linux applications

The relationship between applications and system commands

Character System command application
File location Generally in the /bin and sbin directories or internal shell commands Usually in /usr/bin, /usr/sbin and /usr/local/bin, /usr/local/sbin
The main purpose Complete the basic management of the system, such as IP configuration tools Complete other relatively independent auxiliary tasks, such as web browsing
Applicable environment Generally only run in the character operation interface According to actual needs, this program can be run in the graphical interface
Run format Generally include command words, command options and command parameters Usually there is no fixed execution format, which is defined by the program developer

Directory structure of a typical application

file type Save directory Description
Ordinary executable program file /usr/bin Executable by all users
Server program, management program file /usr/sbin Only the administrator can execute
Application configuration file /etc Applications installed via rpm or yum
Log file / var / log System log
Application Reference Document File /usr/share/doc Reference documents and other data about the application
Application man page file /usr/share/man Man pages for executable files and configuration files

2. Common package types

file type Save directory
RPM package The extension is ".rpm", suitable for RHEL, CentOS and other systems
DEB software package The extension is ".deb", suitable for Ubuntu, Debian and other systems
Source code package Generally, it is a compressed package in the format of ".tar.gz", ".tar.bz2", etc., which contains the original code of the program and needs to be compiled and installed
Package with installer The extension of the software package is mostly in TarBall format, and the executable program or script file for installation will be provided in the software package. Such as install.sh, setup, etc. Just run the installation file during installation to complete the installation operation according to the prompts of the wizard program

3. RPM package management tool

1) RPM package manager Red-Hat Package Manager

由Red Hat公司提出,被众多Linux发往行版所采用
建立统一的文件数据库
详细记录软件包安装、卸载、升级等变化信息
自动分析软件包依赖关系

2) RPM software package

①软件素材参考:http://www.rpm.org
 ②一般命名格式

Insert picture description here

Four. Mounting and unmounting methods

Mount command: mount /dev/cdrom /mnt
mnt: directory to be mounted temporarily

1. Check whether the CD icon is lit
Insert picture description here2. In the setting, click Connect

Insert picture description here
3.df -h view mount

[root@localhost ~]# df -h
文件系统        容量  已用  可用 已用% 挂载点
/dev/sda3        36G  4.7G   31G   14% /
devtmpfs        978M     0  978M    0% /dev
tmpfs           993M     0  993M    0% /dev/shm
tmpfs           993M  9.0M  984M    1% /run
tmpfs           993M     0  993M    0% /sys/fs/cgroup
/dev/sda1       497M  151M  346M   31% /boot
tmpfs           199M   12K  199M    1% /run/user/42
tmpfs           199M     0  199M    0% /run/user/0
[root@localhost ~]# 

4. Enter the mount command: mount /dev/cdrom /mnt to
view the mount command: df -h

Insert picture description here
5.
Unmount the command: umount /mnt
mnt: is the mount point
Insert picture description here

Five. The format of the rpm command
rpm命令能够实现几乎所有对RPM软件包的管理功能
执行“man rpm”命令可以获得关于rpm命令的详细帮助信息
    rpm命令功能:
    查询、验证RPM软件包的相关信息
    安装、升级、卸载RPM软件包
    维护重建RPM数据库信息等综合管理操作
6. **Query the installed RPM software information
      rpm -q[子选项] [软件名]**
rpm -qi Software name Display the detailed information of the specified software installed
rpm -ql Software name Display the file list of the specified software installed
rpm -qc Software name List the configuration files of the specified software installed
rpm -qd Software name List the location of the software package documentation that has installed the specified software
rpm -qR Software name List dependent software packages and files that have installed the specified software
rpm -qF File or directory Query which installation package the specified software has been installed belongs to
rpm -qa Software name Display a list of all software installed in rpm mode in the current system

rpm -qa |grep -i postfix (Mailbox software) #Query whether the software postfix has been installed

Seven. Query the information in the RPM software package file
  rpm -qp [子选项] rpm软件包

Query the information in the RPM package file that is not installed

rpm -qpi rpm package file name Query the detailed information of the specified software package
rpm -qpl rpm package file name Query the file list of the specified software package
rpm -qpc rpm package file name Query the configuration file of the specified software package
rpm -qpd rpm package file name Query the location of the software package documentation of the specified software package
8. Install, upgrade, uninstall, RPM software package
rpm [选项] RPM包文件
rpm -ivh RPM软件包
[root@localhost Packages]# rpm -ivh zip-3.0-11.el7.x86_64.rpm 
警告:zip-3.0-11.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY
准备中...                          ################################# [100%]
	软件包 zip-3.0-11.el7.x86_64 已经安装
[root@localhost Packages]# 

Common options:

-i Install a new RPM package
-U Upgrade a software package, if it has not been installed, install it
-F Upgrade a software package, if it has not been installed, then abandon the installation
-h In the process of installing or upgrading the software package, the installation progress will be displayed with "#"
-v Display detailed information during software installation
–force Mandatory installation of a certain package, such as installing an older package
-e Uninstall the package with the specified name
–nodeps When installing or upgrading or uninstalling a software package, do not check the dependencies with other software packages

Insert picture description here

Nine. Maintain RPM data
 重建 RPM 数据库

  当 RPM 数据库发生损坏,可通过重建RPM数据库修复
  rpm --rebuilddb		或者		rpm --initdb
10. Import the verification public key

Before importing the public key file for digital signature verification, an error will be reported when installing some of the RPM software packages in the CD. Need to import the public key file located in the root directory of the CD into the RPM database
mount /dev/sr0 /mnt/
rpm --import /mnt/RPM-GPG-KEY-CentOS-7

Insert picture description here

Eleven. Solve the installation package dependency method

1. When installing multiple software with dependencies: the
dependent software package needs to be installed first, and multiple .rpm package files can be installed at the same time

2. When uninstalling multiple software with
dependencies : software packages that depend on other programs need to be uninstalled, and multiple software can be designated for uninstallation at the same time

3. Ignore dependencies,
combined with the "-nodeps" option, but may cause software exceptions

Guess you like

Origin blog.csdn.net/Wsxyi/article/details/113602705