RPM command Detailed (installation, uninstall, upgrade)

Source: Internet
Author: User
Tags documentation
0, rpm commonly used commands1. Install a Package
# RPM-IVH

2. Upgrade a Package
# RPM-UVH

3. Uninstall a Package
# RPM-E

First through the RPM-Q < keyword > can be queried to the name of the RPM package,

Then call the RPM-E < package name > remove the specific RPM package.

If you encounter dependencies that cannot be deleted, use the RPM-E--nodeps < package name > do not check dependencies, directly delete the RPM package.

If you happen to have multiple packages called the same name, use the RPM-E--allmatches--nodeps < package name > Remove all packages of the same name and ignore dependencies. 4. Installation Parameters
--force forced to install even if files that belong to other packages are overwritten
--nodeps if the installation of the RPM package relies on other packages, it is forced to install even if other packages are not installed.

5. Query whether a package is installed
# Rpm-q < RPM package name>

6. Get the information of the package being installed
# Rpm-qi < RPM package name>

7. List what files are in the package
# RPM-QL < RPM package name>

8. List which RPM package a file on the server belongs to
#rpm-QF

9. A combination of several parameters can be used
# Rpm-qil < RPM package name>

10. List all the installed RPM package
# RPM-QA

11. List which files are included in the RPM package file that is not installed into the system.
# RPM-QILP < RPM package name>


First, installation
Command format:

Rpm-i (or--install) options file1.rpm ... filen.rpm

Parameters:

file1.rpm ... filen.rpm the name of the RPM package that will be installed

Detailed options:

-H (or--hash) output hash mark (' # ') at installation
The--test is only tested for installation and is not actually installed.
--percent the progress of the installation as a percentage.
--excludedocs does not install document files in the package
--includedocs Installation Documentation
--replacepkgs forced reinstallation of installed packages
--replacefiles replace files that belong to other packages
--force ignores package and file conflicts
--noscripts does not run preinstallation and post-Setup scripts
--prefix installs the package to the specified path
--ignorearch does not verify the structure of the package
--ignoreos does not check the operating system on which the package runs
--nodeps does not check dependency relationships
--ftpproxy used as an FTP agent
--FTPPORT specifies that the port number for FTP is

Common options

-V Display additional information
-VV Display Debugging Information
--root lets rpm make the specified path "root" so that the installer and the post-Ann
The installer will be installed in this directory
--rcfile set RPMRC file as
--dbpath the path to set the RPM data inventory is

Second, delete
Command format:

RPM-E (or--erase) options pkg1 ... pkgn

Parameters

Pkg1 ... pkgn: packages to be removed

Detailed options

--test only test for deletion
--noscripts does not run pre-installation and post-Setup scripts
--nodeps does not check dependencies

Common options

-VV Display Debugging Information
--root lets rpm make the specified path "root" so that the installer and the post installation
The program will be installed in this directory
--rcfile set RPMRC file as

--dbpath the path to set the RPM data inventory is
Third, upgrade
Command format

Rpm-u (or--upgrade) options file1.rpm ... filen.rpm

Parameters

FILE1.RPM the name of the FILEN.RPM software package

Detailed options

-H (or--hash) output hash mark (' # ') at installation
--oldpackage allows "Upgrades" to an older version
--test only for upgrade testing
--excludedocs does not install document files in the package
--includedocs Installation Documentation
--replacepkgs forced reinstallation of installed packages
--replacefiles replace files that belong to other packages
--force ignores package and file conflicts
--percent the progress of the installation as a percentage.
--noscripts does not run preinstallation and post-Setup scripts
--prefix installs the package to the specified path
--ignorearch does not verify the structure of the package
--ignoreos does not check the operating system on which the package runs
--nodeps does not check dependency relationships
--ftpproxy used as an FTP agent
--FTPPORT specifies that the port number for FTP is

Common options

-V Display additional information
-VV Display Debugging Information
--root lets rpm make the specified path "root" so that both the preinstallation program and the post installer are installed in this directory
--rcfile set RPMRC file as
--dbpath the path to set the RPM data inventory is

Four, inquiries
Command format:

Rpm-q (or--query) options

Parameters:

Pkg1 ... PKGN: Querying Installed Packages

Detailed options

-P (or '-') to query the package's files
Which package the-F query belongs to
-A query for all installed packages
--whatprovides Query provides a functional package
-G query for packages that belong to a group
--whatrequires query All software packages that require functionality

Information options

Displays the full identity of the package
-I display the package's summary information
-L displays a list of files in the package
-C Display profile list
-D displays a list of document files
-S Displays the list of files in the package and displays the status of each file
--scripts display installation, uninstall, verify scripts
--queryformat (or--QF) displays query information in a user-specified manner
--dump displays all verified information for each file
--provides displays the functionality provided by the package
--requires (or-r) Displays the functionality required by the package

Common options

-V Display additional information
-VV Display Debugging Information
--root lets rpm make the specified path "root" so that both the preinstallation program and the post installer are installed in this directory
--rcfile set RPMRC file as
--dbpath the path to set the RPM data inventory is

v. Verify installed packages
Command format:

Rpm-v (or--verify, or-y) options

Parameters

Pkg1 ... pkgn the package name that will be validated

Package options

-P Verify against package file
-F Checksum belongs to the package
-a Verify verifies all packages
-G verifies all packages that belong to the group

Detailed options

--noscripts does not run validation scripts
--nodeps Non-checksum dependency
--nofiles does not verify file properties

Common options

-V Display additional information
-VV Display Debugging Information
--root lets rpm make the specified path "root" so that both the preinstallation program and the post installer are installed in this directory
--rcfile set RPMRC file as
--dbpath the path to set the RPM data inventory is

verify the files in the package
Grammar:

Rpm-k (or--checksig) options file1.rpm ... filen.rpm

Parameters:

file1.rpm. filen.rpm software package file name

checksig--Detailed Options

--NOPGP not verifying PGP signature

Common options

-V Display additional information
-VV Display Debugging Information
--rcfile set RPMRC file as


Vii. other RPM options
--REBUILDDB Rebuild RPM Database
--INITDB Create a new RPM database
--quiet as much as possible to reduce output
--help Display Help files

--version shows the current version of RPM


Viii. repair of the RPM database

Sometimes, our RPM database will be corrupted for some reason, so that when you execute the RPM related commands, you will report an error similar to the following:

Rpmdb:fatal region error detected; Run recovery
ERROR:DB4 error ( -30982) from Dbenv->open:db_runrecovery:fatal error, run database recovery
Error:cannot Open Packages Index

The consequence is that you will not be able to use RPM to add deletes, update your system's RPM software package, in fact, as long as the following steps can restore your RPM database without the need to reinstall the system

# Cd/var/lib
# mv RPM Rpm.old
# mkdir rpm
# Rpmdb--initdb
# CP Rpm.old/packages rpm
# Rpmdb--REBUILDDB

It's okay.
These are the practices for REDHAT8 and REDHAT9 if the previous version or other version of Linux
Follow the steps below to

# Cd/var/lib
# mv RPM Rpm.old
# mkdir rpm
# RPM--INITDB
# CP Rpm.old/packages rpm
# RPM--REBUILDDB

Another article Repair RPM database

When the package installation, upgrade, uninstall, and other operations, may damage the RPM db, you need to use the--rebuild parameter to repair RPM db, but sometimes encountered this problem:

[root@tiv125 lib]# rpm-v--REBUILDDB
Rpmdb:fatal region error detected; Run recovery
ERROR:DB4 error ( -30982) from Dbenv->open:db_runrecovery:fatal error, run database recovery
Error:cannot Open Packages Index

At this point, you need to manually delete the/var/lib/rpm directory of __db.* files, such as __db.001, __db.002, etc.
Then run Rpm-v--rebuilddb.

If it helps, please click on the referral to more people who need it
Recommended

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.