A simple usage of rpm

Source: Internet
Author: User
A simple usage of rpm-general Linux technology-Linux technology and application information. The following is a detailed description. I. query functions of RPM software package management:

Command Format
Rpm {-q | -- query} [select-options] [query-options]
The query function of RPM is extremely powerful and one of the most important functions. For more details, refer to # man rpm.

1. query the software installed in the system;
1) query the installed software;
Syntax: rpm-q software name
Example:
[Root @ localhost beinan] # rpm-q gaim
Gaim-1.3.0-1.fc4
-Q is -- query, which means "q" in Chinese. This command indicates whether gaim is installed in the system. If gaim is installed, information is output. If gaim is not installed, the uninstalled gaim information is output. To view all installed packages in the system, add the-a parameter;
[Root @ localhost RPMS] # rpm-qa

If you view it by PAGE, add another pipeline | and more commands;
[Root @ localhost RPMS] # rpm-qa | more
Find a software in all installed software packages, such as gaim. You can use grep to extract the software;
[Root @ localhost RPMS] # rpm-qa | grep gaim
The above function is the same as that output by rpm-q gaim; 2) query the software package of an installed file;
Syntax rpm-qf file name

Note: the absolute path of the file name should be pointed out as an example:
[Root @ localhost RPMS] # rpm-qf/usr/lib/libacl. la
Libacl-devel-2.2.23-8
3) query where all installed software packages are installed;
Syntax: rpm-ql software name or rpm rpmquery-ql software name
Example:
[Root @ localhost RPMS] # rpm-ql lynx
[Root @ localhost RPMS] # rpmquery-ql lynx
4) query the information of an installed software package
Syntax format: rpm-qi software name
Example:
[Root @ localhost RPMS] # rpm-qi lynx
5) Check the configuration file of the installed software;
Syntax format: rpm-qc software name
Example:
[Root @ localhost RPMS] # rpm-qc lynx
6) view the installation location of a software installation document:
Syntax format: rpm-qd software name
Example:
[Root @ localhost RPMS] # rpm-qd lynx
7) Check the software packages and files on which the software is installed;
Syntax: rpm-qR software name
Example:
[Root @ localhost beinan] # rpm-qR rpm-python
Query the summary of installed software: for a software package that has been installed, we can combine a series of parameters, such as rpm-qil. For example:
[Root @ localhost RPMS] # rpm-qil lynx

2. View uninstalled software packages:

The premise is that you have a. rpm file, that is to say, to view the existing software file. rpm, etc.; 1) view the purpose and version of a software package;
Syntax: rpm-qpi file. rpm
Example:
[Root @ localhost RPMS] # rpm-qpi lynx-2.8.5-23.i386.rpm
2) view the files contained in a software package;
Syntax: rpm-qpl file. rpm
Example:
[Root @ localhost RPMS] # rpm-qpl lynx-2.8.5-23.i386.rpm
3) view the document location of the software package;
Syntax: rpm-qpd file. rpm
Example:
[Root @ localhost RPMS] # rpm-qpd lynx-2.8.5-23.i386.rpm
5) view the configuration file of a software package;
Syntax: rpm-qpc file. rpm
Example:
[Root @ localhost RPMS] # rpm-qpc lynx-2.8.5-23.i386.rpm
4) view the dependency of a software package
Syntax: rpm-qpR file. rpm
Example:
[Root @ localhost archives] # rpm-qpR yumex_0.42-3.0.fc4_noarch.rpm
/Bin/bash
/Usr/bin/python
Config (yumex) = 0.42-3.0.fc4
Pygtk2
Pygtk2-libglade
Rpmlib (CompressedFileNames) <= 3.0.4-1
Rpmlib (PayloadFilesHavePrefix) <= 4.0-1
Usermode
Yum> = 2.3.2

2. Installation, upgrade, and deletion of software packages;

1. Install and upgrade an rpm package;
[Root @ localhost beinan] # rpm-vih file. rpm note: this is used to install a new rpm package;
[Root @ localhost beinan] # rpm-Uvh file. rpm note: this is used to upgrade an rpm package;
If dependency exists, resolve the dependency. In fact, the software package manager can solve the dependency well. See the previous introduction of the Software Package Manager; if you cannot find the dependency package in the package manager, you can only compile the dependent package to solve the dependency or force installation. syntax structure:
[Root @ localhost beinan] # rpm-ivh file. rpm -- nodeps -- force
[Root @ localhost beinan] # rpm-Uvh file. rpm -- nodeps -- force
For more parameters, see the example application of man rpm:
[Root @ localhost RPMS] # rpm-ivh lynx-2.8.5-23.i386.rpm
Preparing... ######################################## ### [100%]
1: lynx ####################################### #### [100%]


[Root @ localhost RPMS] # rpm-ivh -- replacepkgs lynx-2.8.5-23.i386.rpm
Preparing... ######################################## ### [100%]
1: lynx ####################################### #### [100%]
Note: The -- replacepkgs parameter is installed again with the installed software. Sometimes it is not necessary to install it too much. The test and installation parameter -- test is used to check dependencies;
[Root @ localhost RPMS] # rpm-ivh -- test gaim-1.3.0-1.fc4.i386.rpm
Preparing... ######################################## ### [100%]
Downgrade from the new version to the old version, and add the -- oldpackage parameter;
[Root @ localhost RPMS] # rpm-qa gaim
Gaim-1.5.0-1.fc4

[Root @ localhost RPMS] # rpm-Uvh -- oldpackage gaim-1.3.0-1.fc4.i386.rpm
Preparing... ######################################## ### [100%]
1: gaim ####################################### #### [100%]

[Root @ localhost RPMS] # rpm-qa gaim
Gaim-1.3.0-1.fc4
Specify the installation directory for the package: add the-relocate parameter; the example below is to specify the gaim-1.3.0-1.fc4.i386.rpm to install in the/opt/gaim directory;
[Root @ localhost RPMS] # rpm-ivh -- relocate/=/opt/gaim gaim-1.3.0-1.fc4.i386.rpm
Preparing... ######################################## ### [100%]
1: gaim ####################################### #### [100%]
[Root @ localhost RPMS] # ls/opt/
Gaim
Specify the installation directory for the package: add the-relocate parameter; the example below is to specify the installation of the lynx-2.8.5-23.i386.rpm in the/opt/lynx directory;
[Root @ localhost RPMS] # rpm-ivh -- relocate/=/opt/lynx -- badreloc lynx-2.8.5-23.i386.rpm
Preparing... ######################################## ### [100%]
1: lynx ####################################### #### [100%]
How can we call a program installed in a specified directory? Generally, the execution programs are stored in the bin or sbin directory of the installation directory. Take a look at the example below. If there is an error output, make the corresponding link and use ln-s;
[Root @ localhost RPMS] #/opt/lynx/usr/bin/lynx

Configuration file/etc/lynx. cfg is not available.

[Root @ localhost RPMS] # ln-s/opt/lynx/etc/lynx. cfg/etc/lynx. cfg
[Root @ localhost RPMS] #/opt/lynx/usr/bin/lynx www.linuxsir.org

2. delete an rpm package;
First, you must learn to query the rpm package. Please refer to the previous instructions. [root @ localhost beinan] # rpm-e Software Package name example: If I want to remove the lynx package, the complete operation should be:
[Root @ localhost RPMS] # rpm-e lynx
If there is a dependency, you can also use -- nodeps to ignore the dependency check to delete it. But do not do this as much as possible. It is best to use the software package manager systerm-config-packages to delete or add software;
[Root @ localhost beinan] # rpm-e lynx -- nodeps
Http://softbbs.pconline.com.cn/topic.jsp? Tid = 7835826? Ad = 1256
Related Article

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.