Linux Command Summary – RPM Command

1. Introduction to the rpm command

The Linux rpm command is used to manage the package.

Rpm(redhat package manager) was originally a Red Hat Linux distribution program specifically used to manage various Linux packages. Because it follows the GPL rules and is powerful and convenient, it is widely used. popular. Gradually adopted by other distributions. The emergence of RPM package management makes Linux easy to install and upgrade, which indirectly improves the applicability of Linux.

2. Parameter introduction

  • -a  Query all packages.
  • -b+ or -t +  Set the completion stage of the package package and specify the file name of the package file.
  • -c  Only list configuration configuration files, this parameter needs to be used with the “-l” parameter.
  • -d  Only list text files, this parameter needs to be used with the “-l” parameter.
  • -e or –erase   delete the specified package.
  • -f+  Query the package that has the specified file.
  • -h or –hash  List the tags when the package is installed.
  • -i  Display related information of the package.
  • -i or –install  Install the specified package file.
  • -l  Display the file list of the package.
  • -p+  Query the specified RPM package file.
  • -q  Use the query mode. When encountering any problems, the rpm command will first ask the user.
  • -R  Display the relevance information of the package.
  • -s  Display file status, this parameter needs to be used with the “-l” parameter.
  • -U or –upgrade Upgrade the specified package file.
  • -v   displays the instruction execution process.
  • -vv   displays the instruction execution process in detail for easy troubleshooting.
  • -addsign+  Add a new signature certificate to the specified package.
  • –allfiles  Install all files.
  • –allmatches  Delete files that match the specified package.
  • –badreloc  When an error occurs, reconfigure the file.
  • –buildroot  Set the directory to be used as the root directory when generating the package.
  • –changelog  Display the change log of the package.
  • –checksig+  Check the signature certification of the package.
  • –clean  After completing the packaging of the kit, delete the directory created during the packaging process.
  • –dbpath  Set the directory where you want to store the RPM database.
  • –dump   displays the verification information of each file. This parameter needs to be used with the “-l” parameter.
  • –excludedocs  When installing the package, do not install the files.
  • –excludepath  Ignore all files in the specified directory.
  • –force  Forcibly replace the package or file.
  • –ftpproxy  Specify the FTP proxy server.
  • –ftpport  Set the communication port used by the FTP server or proxy server.
  • –help  Online help.
  • –httpproxy  Specify the HTTP proxy server.
  • –httpport  Set the communication port used by the HTTP server or proxy server.
  • –ignorearch  Do not verify the structural correctness of the package file.
  • –ignoreos  Do not verify the structural correctness of the package file.
  • –ignoresize  Do not check whether the disk space is sufficient before installation.
  • –includedocs  When installing the package, install the files together.
  • –initdb   Confirm that the correct database is available.
  • –justdb  Update the database without changing any files.
  • –nobulid  Do not execute any completion stage.
  • –nodeps  Do not verify the interrelationship of package files.
  • –nofiles  Do not verify file attributes.
  • –nogpg  Skip all GPG signature verification.
  • –nomd5  Do not use MD5 encoding calculation to confirm the size and correctness of the file.
  • –nopgp  Skip all PGP signature verification.
  • –noorder  Do not re-arrange the installation order of the packages in order to meet their mutual relevance.
  • –noscripts  Do not execute any installation script files.
  • –notriggers  Do not execute any script files in the package package.
  • –oldpackage  Upgrade to the old version of the package.
  • –percent  Display the percentage of completion when installing the package.
  • –pipe  Create a pipeline and convert the output result into the input data of the execution command.
  • –prefix  If the file is reconfigured, put the file in the specified directory.
  • –provides  Query the compatibility provided by the package.
  • –queryformat  Set the format of the file header.
  • –querytags  List the tags that can be used in the file header format.
  • –rcfile  Use the specified configuration file.
  • –rebulid  Install the original code package and regenerate the binary file package.
  • –rebuliddb  Rebuild a copy of the database based on the existing database.
  • –recompile  The effect of this parameter is similar to specifying the “–rebulid” parameter, when the package file is not generated.
  • –relocate=  Relocate the files that would have been placed in the original directory to the new directory.
  • –replacefiles  Forcibly replace files.
  • –replacepkgs  Forced replacement kit.
  • –requires  Query the compatibility required by the package.
  • –resing+  Delete the existing certificate and regenerate the signature certificate.
  • –rmsource  After completing the package of the kit, delete the original code.
  • –rmsource  Delete the original code and the specified file.
  • –root  Set the directory that you want to be the root directory.
  • –scripts  List the variables of the script of the installation kit.
  • –setperms  Set file permissions.
  • –setugids  Set the owner and group of the file.
  • –short-circuit   directly skip the steps of the designated completion stage.
  • –sign   Generate PGP or GPG signature authentication.
  • –target=+  Set the installation platform of the generated package.
  • –test   is only for testing and does not actually install the package.
  • –timecheck  Set the check time in seconds.
  • –triggeredby  Query the packager of the package.
  • –triggers  Display the packaging script in the package file.
  • –verify  The effect of this parameter is the same as specifying the “-q” parameter.
  • –version  Display version information.
  • –whatprovides  Query the compatibility of the package to the specified features.
  • –whatrequires  Query the compatibility of the package for the specified features. 2. Detailed explanation of rpm parameters
    (1 ) Installation command
    Command format: # rpm -i(or – install) [options] file1.rpm … fileN.rpm
    Parameter list: file1.rpm … fileN.rpm (the file name of the RPM package to be installed)
    Detailed options:< br>-h (or –hash) Output a hash mark (“#”) during installation.
    –test only tests the installation, not the actual installation.
    –percent Output the progress of the installation as a percentage.
    –excludedocs do not install the documentation files in the package
    –includedocs installation documentation
    –replacepkgs force reinstallation of the installed packages
    –replacefiles replace files belonging to other packages
    br>–force Ignore package and file conflicts
    –noscripts Do not run pre-installation and post-installation scripts
    –prefix Install the package to the path specified by
    –ignorearch not check Check the structure of the package
    –ignoreos does not check the operating system the package is running on
    –nodeps does not check the dependencies
    –ftpproxy is used as an FTP proxy
    –ftpport specifies the FTP port The number is
    Common options:
    -v display additional information
    -vv display debugging information
    –root Let RPM use the specified path as the “root directory”, so that pre-installation and post-installation The program will be installed in this directory
    –rcfile set the rpmrc file to
    –dbpath set the path where the RPM data library is located
    < strong>(2) Delete command
    Command format: # rpm -e(or –erase) [options] pkg1 … pkgN
    Parameter list: pkg1 … pkgN (package to be removed)
    Detailed options:
    –test only executes deleted tests
    –noscripts does not run pre-installation And post-installation scripts
    –nodeps does not check dependencies
    Common options:
    -vv displays debugging information
    –root lets RPM use the specified path as the “root directory”, so that Both the installer and the post-installer will be installed in this directory
    –rcfile set the rpmrc file to
    –dbpath set the path where the RPM database is located
    (3) Upgrade command
    Command format: # rpm -U(or –upgrade) [options] file1.rpm … fileN.rpm
    Parameter list: file1.rpm … fileN.rpm (the name of the software package)
    Detailed options:
    -h (or –hash) Output hash mark (“ #”)
    –oldpackage allows “upgrade” to an old version
    –test only upgrade test
    –excludedocs do not install the documentation files in the package
    –includedocs installation documentation
    –replacepkgs force to reinstall already installed packages
    –replacefiles replace files belonging to other packages
    –force ignore conflicts between packages and files
    –percent as a percentage Output the progress of the installation
    –noscripts does not run the pre-installation and post-installation scripts
    –prefix installs the package to the path specified by
    –ignorearch does not verify the structure of the package
    –ignoreos does not check the operating system the package is running on
    –nodeps does not check dependencies
    –ftpproxy is used as an FTP proxy
    –ftpport specifies the port number of FTP as
    Common options:
    -v Display additional information
    -vv Display debugging information
    –root Let RPM use the specified path as the “root directory”, so that the pre-installation program and post-installation program will be installed in this directory< br>–rcfile set the rpmrc file to
    –dbpath set the path where the RPM data inventory is located
    (4)Query command
    Command format: # rpm -q(or –query) [options]
    Parameter list: pkg1 … pkgN (query installed software package)
    Detailed options:
    -p (or “-”) query the file of the software package
    -f query Which package belongs
    -a query all installed packages
    -g query the packages belonging to the group
    –whatprovides query packages that provide functions
    –whatrequires query all required functions Package
    Information option:
    Display all the identifiers of the package
    -i Display the summary information of the package
    -l Display the list of files in the package
    -c Display the list of configuration files< br>-d displays the list of document files
    -s displays the list of files in the package and displays the status of each file
    –scripts displays the installation, uninstallation, and verification scripts
    –queryformat (or – qf) Display query information in the manner specified by the user
    –dump Display all verified information of each file
    –provides Display the functions provided by the software package
    –requires (or -R) Display Functions required by the software package
    Common options:
    -v display additional information
    -vv display debugging information
    –root Let RPM use the specified path as the “root directory” for pre-installation Both the program and the post-installation program will be installed in this directory
    –rcfile set the rpmrc file to
    –dbpath set the path where the RPM data library is located
    (5) Verify installed packages
    Command format: # rpm -V(or –verify, or -y) [options]
    Parameter list: pkg1 … pkgN (The name of the package to be verified)
    Package options:
    -p Verify package file
    -f verify the package belonging to
    -a verify all packages
    -g verify all packages belonging to the group
    Detailed options:
    –noscripts do not run the check Verification script
    –nodeps does not verify dependencies
    –nofiles does not verify file attributes
    Common options:
    -v display additional information
    -vv display debugging information
    – -root Let RPM use the specified path as the “root directory”, so that the pre-installation program and post-installation program will be installed in this directory
    –rcfile set the rpmrc file to
    –dbpath set the location of the RPM database The path is
    (6)Check the files in the software package
    Syntax: # rpm -K(or –checksig) [options] file1. rpm … fileN.rpm
    Parameter: file1.rpm … fileN.rpm (file name of the software package)
    Detailed options:
    –nopgp Do not verify PGP signature< br>Common options:
    -v display additional information
    -vv display debugging information
    –rcfile set rpmrc file to

    (7) Other parameter options
    –rebuilddb to rebuild RPM database< br>–initdb create a new RPM database
    –quiet reduce output as much as possible
    –help show help file
    –version show current version of RPM

3. Function

1. Initialize the rpm database function;

Use the rpm command to query whether a rpm package is installed, also through rpm Database to complete; so we must often use the following two commands to initialize the rpm database;

[[emailprotected] beinan]# rpm –initdb
[[emailprotected] 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 cannot be installed and inquired, most of which are problems here;

< p>[[email Protected] beinan]# updatedb

[[email Protected] beinan]# locate software name or file name

Tip: through updatedb, we can use locate to query Where are some software installed; updatedb must be executed when the system is first installed, and executed once every other time; to keep the installed software library up to date; updatedb is owned by the slocate software package; if you do not have this command, you have to install slocate;

2, RPM package management function

1) Query function:

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

Examples of use

1) Query which software package an installed file belongs to

rpm -qf file name

< p>2) Query where the installed software packages are installed

rpm -ql software name
or
rpm rpmquery -ql software name

3) check it out The configuration file of the installed software

rpm -qc software name

4) View the file installation location of an installed software

rpm -qd software name

p>

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

rpm -qR software name

6) Check the files contained in a software package< /p>

rpm -qpl file name

2) Package installation, upgrade, deletion

1) Regular package installation

-ivh: Installation shows the installation progress –install–verbose–hash
-Uvh: Upgrade package–Update;
-Va: Verify all RPM packages, find the missing File [View Lost];
-e: delete package

2) Source package installation

rpm –recompile vim-4.6-4.src.rpm# This command will unpack the source code, compile and install it. If the user uses the command:

rpm –rebuild vim-4.6-4.src.rpm   # After the installation is complete, the compiled executable file will be repackaged into the RPM software package of i386.rpm.

For detailed usage, please refer to: http://ftp.tsingpost.com/index.php/archives/379/

3) Network package installation

p>

# 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 Installation directory: add -relocate parameter

rpm -ivh –relocate /=/opt/gaim gaim-1.3.0-1.fc4.i386.rpm #gaim-1.3.0-1.fc4 .i386.rpm is designated to be installed in the directory: /opt/gaim

(1)Installation command
Command format: # rpm -i(or –install) [options] file1. rpm … fileN.rpm
Parameter list: file1.rpm … fileN.rpm (the file name of the RPM package to be installed)
Detailed options:
-h (or- -hash) Output the hash mark (“#”) during installation.
–test Only tests the installation, not the actual installation.
–percent Output the progress of the installation as a percentage.
–excludedocs do not install the documentation files in the package
–includedocs installation documentation
–replacepkgs force reinstallation of the installed packages
–replacefiles replace files belonging to other packages
br>–force Ignore package and file conflicts
–noscripts Do not run pre-installation and post-installation scripts
–prefix Install the package to the path specified by
–ignorearch not check Check the structure of the package
–ignoreos does not check the operating system the package is running on
–nodeps does not check the dependencies
–ftpproxy is used as an FTP proxy
–ftpport specifies the FTP port The number is
Common options:
-v display additional information
-vv display debugging information
–root Let RPM use the specified path as the “root directory”, so that pre-installation and post-installation The program will be installed in this directory
–rcfile set the rpmrc file to
–dbpath set the path where the RPM database is located

< strong>(2) Delete command
Command format: # rpm -e(or –erase) [options] pkg1 … pkgN
Parameter list: pkg1 … pkgN (package to be removed)
Detailed options:
–test only executes deleted tests
–noscripts does not run pre-installation And post-installation scripts
–nodeps does not check dependencies
Common options:
-vv displays debugging information
–root lets RPM use the specified path as the “root directory”, so that Both the installer and post-installer will be installed in this directory
–rcfile set the rpmrc file to
–dbpath set the path where the RPM database is located

(3)Upgrade command
Command format: # rpm -U(or –upgrade) [options] file1.rpm … fileN.rpm
Parameter list: file1.rpm … fileN.rpm ( The name of the package)
Detailed options:
-h (or –hash) Output hash mark (“#”) during installation
–oldpackage allows “upgrade” to an old version
–test only upgrade test
–excludedocs do not install the documentation files in the package
–includedocs install the documentation
–replacepkgs force reinstallation of the installed packages
–replacefiles Replace files belonging to other packages
–force ignore conflicts between packages and files
–percent output the installation progress as a percentage
–noscripts do not run pre-installation and post-installation scripts
–prefix install the package to the path specified by
–ignorearch does not verify the structure of the package
–ignoreos does not check the operating system the package is running on
–nodeps does not check dependencies Sexual relationship
–ftpproxy used as FTP proxy
–ftpport Specify the port number of FTP as
Common options:
-v display additional information
-vv display debugging information
– -root Let RPM use the specified path as the “root directory”, so that the pre-installation program and post-installation program will be installed in this directory
–rcfile set the rpmrc file to
–dbpath set the location of the RPM database The path is

(4)Query command
Command format: # rpm -q(or- -query) [options]
Parameter list: pkg1 … pkgN (query installed software packages)
Detailed options:
-p (or “-”) query software Package file
-f query which package it belongs to
-a query all installed packages
-g query package belonging to the group
–whatprovides query packages that provide functions
>–whatrequires Query all software packages that require functions
Information option:
Display all the identification of the software package
-i Display the summary information of the software package
-l Display the file list in the software package< br>-c displays the list of configuration files
-d displays the list of document files
-s displays the list of files in the package and displays the status of each file
–scripts displays the installation, uninstallation, and verification scripts< br>–queryformat (or –qf) displays query information in a user-specified manner
–dump displays all verified information of each file
–provides displays the functions provided by the software package
–requires (or -R) Display the required functions of the package
Common options:
-v Display additional information
-vv Display debugging information
–root Let RPM do the specified path Is the “root directory”, so that the pre-installation program and post-installation program will be installed in this directory
–rcfile set the rpmrc file to
–dbpath set the path where the RPM database is located
p>

(5)Verify the installed software Package
Command format: # rpm -V(or –verify, or -y) [options]
Parameter list: pkg1 … pkgN (the name of the software package to be verified)
Package options:
-p verify the package file
-f verify the belonging software package
-a Verify all packages
-g verify all packages belonging to the group
Detailed options:
–noscripts do not run the verification script
–nodeps do not verify dependencies
–nofiles not Verify file attributes
Common options:
-v display additional information
-vv display debugging information
–root Let RPM use the specified path as the “root directory”, so that the program and The post-installation program will be installed in this directory
–rcfile set the rpmrc file to
–dbpath set the path where the RPM data library is located

(6)Verify the files in the software package
Syntax: # rpm -K(or –checksig) [options] file1.rpm … fileN.rpm
Parameter: file1.rpm. .. fileN.rpm (the file name of the software package)
Detailed options:
–nopgp Do not verify PGP signatures
Common options:
-v display additional information
-vv display debugging Information
–rcfile Set the rpmrc file to

Leave a Comment

Your email address will not be published.