Article From:https://www.cnblogs.com/7q4w1e/p/9967349.html

I. Introduction

RPMIt is the abbreviation of Redhat Package Manager. It is a package installation and management program developed by RedHat Company. It is similar to Uninstaller on Windows platform. With RPM, users can install and manage Linux on their own.Applications and system tools. RPM allows users to install packages directly in binary mode, and queries users whether the relevant library files have been installed; when deleting programs with RPM, it wisely asks users if they want to delete the relevant programs. If RPM is used to upgradeSoftware, RPM will retain the original configuration file, so that users do not need to reconfigure the new software. RPM maintains a database that contains all the package information. Through this database, users can query the package. RPM is designed for Linux, thoughBut it has moved to other UNIX systems such as SunOS, Solaris, AIX, Irix and so on. RPM complies with GPL copyright agreement. Users can use and propagate RPM freely under the conditions of GPL agreement.

 

Two, configuration

RPMThe configuration file for package management is rpmrc, which can be found using the following commands

# locate rpmrc

You can view it by following commands

rpm --showrc

 

Three, function

1、Initialize RPM database function;

Query whether an RPM package is installed or not through the RPM database through the rpm command, so we often use the following two commands to initialize the rpm database;

[root@localhost beinan]# rpm --initdb
[root@localhost beinan]# rpm --rebuilddb Note: This will take a long time.

Note: The above two parameters are extremely useful. Sometimes the RPM system has problems and can not be installed and queried. Most of them are problems here.

[root@localhost beinan]# updatedb
[root@localhost beinan]# locate Software name or file name
Tip: Through updatedb, we can use location to query where some software has been installed; when the system is first installed, updatedb should be executed every other time; in order to keep the installed software library up to date; updatedb is sloca.Te package all; if you do not have this command, you have to install slocate;
 


2、RPMSoftware package management function

1)Query function:

rpm {-q|--query} [select-options] [query-options]

Using examples

1)Query which package an installed file belongs to

rpm -qf file name

2)Query where installed packages are installed

rpm -ql Software nameorRPM rpmquery-ql software name

3)Check the configuration file for the installed software

rpm -qc Software name

4)View a document installation location for installed software

rpm -qd Software name

5)Check the packages and files on which the installed software depends

rpm -qR Software name

6)View the files contained in a package

rpm -qpl file name

7)Check whether a package is installed

rpm -qa file name

8)View the installation status of a package

rpm -q file name

 

 

2)Installation, Upgrade and Delete of Software Packages

1)Conventional package installation

-ivh:Installation Displays Installation Progress -- install -- verbose -- hash- Uvh: Update upgrade package;- Va: Check all RPM packages and find lost files [View Lost].-e: delete packets

2)Source package installation

rpm --recompile vim-4.6-4.src.rpm   #This command unpacks the source code and compiles and installs it if the user uses the command:RPM -- rebuild vim-4.6-4.src.rpm # will repackage the compiled executable file into R of i386.rpm after installation.PM software package.

Refer to http://ftp.tsingpost.com/index.php/archives/379/

 

3)Network packet installation

# rpm -qpi http://mirrors.kernel.org/fedora/core/4/i386/os/ Fedora/RPMS/gaim-1.3.0-1.fc4.i386.rpm
# rpm -ivh http://mirrors.kernel.org/fedora/core/4/i386/os/ Fedora/RPMS/gaim-1.3.0-1.fc4.i386.rpm

4)Specify the installation directory: To add the – relocate parameter

rpm -ivh --relocate /=/opt/gaim gaim-1.3.0-1.fc4.i386.rpm  #gaim-1.3.0-1.fc4.i386.rpmSpecify installation in directory: / opt / GAIM

 

3、Import signature function

rpm –import Signature file

 

4、rpmSoftware Package Extraction File Function

rpm2cpio file.rpm |cpio -div

Tip: The extracted files are in the current directory under usr and etc

 

Reprinted: https://www.cnblogs.com/274914765qq/p/4448930.html

Later available website: http://www.cnblogs.com/tswhq/p/7868314.html

Link of this Article: Linux command rpm

Leave a Reply

Your email address will not be published. Required fields are marked *