Linux rpm package management and yum command

One, rpm package management

(1) Introduction

A packaging and installation tool for Internet download packages, which is included in some Linux distributions. It generates files with a .RPM extension. RPM is the abbreviation of RedHat Package Manager (RedHat package management tool), similar to Windows setup.exe. Although the file format name is marked with the RedHat logo, the concept is universal. Linux distributions are adopted (suse, redhat, centos, etc.), which can be regarded as a recognized industry standard.

(2) Simple query command of rpm package

Query the list of installed rpms

rpm –qa|grep xx
  • Check if firefox is installed in current Linux
    Insert picture description here

The basic format of rpm package name:

一个rpm包名:firefox-45.0.1-1.el6.centos.x86_64.rpm
名称:firefox
版本号:45.0.1-1
适用操作系统: el6.centos.x86_64
表示centos6.x的64位系统
如果是i686、i386表示32位系统,noarch表示通用。

(2) Other query commands of rpm package

  1. rpm -qa: Query all installed rpm packages
    rpm -qa | more [paged display]
    rpm -qa | grep X [rpm -qa | grep firefox]
    Insert picture description here
  2. rpm -q package name: query whether the package is installed
    Insert picture description here
  3. rpm -qi package name: query package information
    Insert picture description here
  4. rpm -ql package name: query files in the package
    Insert picture description here
  5. rpm -qf file full path name to query the software package to which the file belongs
    Insert picture description here

(3) Management of rpm package

1. Uninstall the rpm package

Basic grammar

rpm -e RPM 包的名称

Example to delete the firefox software package
Insert picture description here
Note:

  1. If other software packages depend on the software package you want to uninstall, an error message will be generated when uninstalling.

     如: $ rpm -e foo
     removing these packages would break dependencies:foo is needed by bar-1.0-1
    
  2. If we just want to delete the rpm package foo, we can add the parameter --nodeps to force the deletion, but this is generally not recommended because programs that depend on this package may not run.

     如:$ rpm -e --nodeps foo
     带上 --nodeps 就是强制删除。
    

2. Install the rpm package

Basic grammar

rpm -ivh RPM 包全路径名称

Parameter Description

i=install 安装
v=verbose 提示
h=hash 进度条

Example: install firefox browser

First find the installation rpm package of firefox, you need to mount the iso file where we installed centos, and then go to /media/ to find rpm.
Insert picture description here
Insert picture description here

Two, yum command

(1) Introduction

Yum is a Shell front-end package manager. Based on RPM package management, it can automatically download and install RPM packages from a specified server, automatically handle dependencies , and install all dependent software packages at once. The premise of using yum is that it can be connected to the Internet.

(2) The basic instructions of yum

Query whether the yum server has software that needs to be installed

yum list|grep xx 软件列表

Install the specified yum package

yum install xxx 下载安装

yum application example: use yum to install firefox

1. First check whether the firefox rpm is on the yum server
Insert picture description here
2. Installation
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44630656/article/details/113065788