Linux rpm command parameters using detailed _linux shell

Source: Internet
Author: User
Tags documentation gpg hash

RPM Execution Installation package

Binary package (Binary) as well as source code package (sources) two. The binary package can be installed directly on the computer, and the source code package will be automatically compiled and installed by RPM. Source code packages often use src.rpm as the suffix name.

Common command combinations:

-IVH: Installation shows installation progress--install--verbose--hash
-UVH: Upgrade package--update;
-QPL: List the file information in the RPM software package [Query Package list];
-QPI: Lists the description information for the RPM package [Query Package install Package (s)];
-QF: Find out which RPM package the specified file belongs to [Query file];
-va: Check all RPM packages, find missing files [View Lost];
-E: Deleting packages

Rpm-q Samba//query program is installed
RPM-IVH/MEDIA/CDROM/REDHAT/RPMS/SAMBA-3.0.10-1.4E.I386.RPM//Installation and display progress by path
RPM-IVH--relocate/=/opt/gaim gaim-1.3.0-1.fc4.i386.rpm//Specify installation directory
RPM-IVH--test gaim-1.3.0-1.fc4.i386.rpm//for checking dependencies; not real installation;
RPM-UVH--oldpackage gaim-1.3.0-1.fc4.i386.rpm//New version degraded to previous version
Rpm-qa | grep httpd #[Search Specifies whether the RPM package is installed]--all search *httpd*
RPM-QL httpd #[Search RPM Package]--list all file installation directories
Rpm-qpi linux-1.4-6.i368.rpm #[View RPM Package]--query--package--install package Information
RPM-QPF linux-1.4-6.i368.rpm #[View RPM Package]--file
RPM-QPR file.rpm #[View Package] Dependencies
Rpm2cpio file.rpm |cpio-div #[extract file]
RPM-IVH file.rpm #[Install a new Rpm]--install--verbose--hash
Rpm-ivh
RPM-UVH file.rpm #[Upgrades a rpm]--upgrade
Rpm-e file.rpm #[Delete an RPM package]--erase

Common parameters:

Install/upgrade/erase options:

-I,--install install package (s)
-V,--verbose provide more detailed output
-H,--hash print hash marks as package installs (good with-v)
-E,--erase Erase (Uninstall) package
-U,--upgrade=<packagefile>+ upgrade package (s)
--replacepkge Install packages Regardless of whether the package has been installed
--test installation test, not actually installed
--nodeps Ignore package dependencies forced installation
--force ignores package and file conflicts
Query options (With-q or--query):
-A,--all query/verify all packages
-P,--package query/verify a package file
-L,--list list files in package
-D,--docfiles list all documentation files
-F,--file query/verify package (s) owning file

RPM Source Code Packaging installation

. src.rpm end of the file, these files are packaged by the source code of the software, the user to install such RPM software package, you must use the command:

RPM--recompile vim-4.6-4.src.rpm # This command will unpack the source code and 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 is also repackaged into the i386.rpm RPM package.

I do not like to write more complex dongdong, trouble words ' but as a reference ' I have turned a person's ' written really very comprehensive '

RPM is the abbreviation for Red Hat Package manager, which is intended to be the Red Hat package management, as the name suggests is the package management contributed by Red Hat, and in mainstream releases such as Fedora, Redhat, Mandriva, SuSE, Yellowdog, etc. , as well as two developed distributions on the basis of these editions;
What is included in the RPM package? that contains the executable binary program, This program is similar to the. exe file in the Windows package, and the RPM package also includes files that are required for the program to run, and similar to Windows packages, Windows programs run with other files besides the. exe file;
An application in an RPM package that sometimes requires other specific versions of files in addition to their own attached files, which is the dependency of the software package; the dependencies are not Linux-specific, as are the Windows operating systems. For example, we run 3D games in Windows, and when installed, he may be prompted to install direct 9; Linux and Windows are the same;

Software Installation Flowchart:

This article uses the scope:

1, this article is the RPM management software description, the use of file.tar.gz or file.tar.bz2 source code package make, make install installed software is invalid;

2. When installing software, it is best to use the System software package management tools provided by the respective distributions, for Fedora/redhat you can refer to the following articles;

1 Fedora System Management software package tool system-config-packages, easy to add and remove the system installation tray provided by the package, please see "Fedora Package Manager System-config-packages"

2 Redhat System Management software Package tool, the new point of the system should be redhat-config-packages, usage and "Fedora Package Manager System-config-packages";

3) Apt + synaptic software package online installation, removal, upgrade tools; Usage: Install or upgrade Fedora Core 4.0 packages online with apt+synaptic

4 Yum Package online installation, upgrade, removal tool; Usage: Fedora/redhat Online installation update package, yum Chapter

5 all Yum and apt tutorials "apt and yum"

At present, APT and Yum have been extremely mature, it is recommended that we install the software, using apt or yum; if the package provided by the installation system disk can be used system-config-packages or redhat-config-packages;

First, the use of RPM package management;

1, can install, delete, upgrade and management software, of course, also support the online installation and upgrade software;
2, through the RPM package management can know what the package contains files, but also know the system in which a file belongs to which package;
3, can be in the query System package is installed and its version;
4, as a developer can package their own program for the RPM package release;
5, Package signature GPG and MD5 import, verification and signature release
6. Dependency checking to see if there are any software packages that disrupt the system because of incompatibility;

Second, the use of RPM permissions;

RPM Software Installation, deletion, update only root permission to use, for the query function any user can operate, if ordinary users have permissions to install the directory, can also be installed;

Three, a simple use of RPM;

In addition to the Package Manager, we can use the rpm command to install, is not all software packages can be installed through the RPM command? No, the file ends with an. rpm suffix; sometimes we find file.rpm on some websites, we have to use RPM to install;

Initialization of the RPM database;

Through the RPM command to query whether an RPM package is installed, but also through the RPM database to complete; 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: These two parameters are extremely useful, sometimes the RPM system out of the question, can not install and query, mostly is here out of the question;

Second, the RPM Package management query function:

Command format

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

RPM Query function is extremely powerful, is one of the most important functions; For a few common examples, more detailed specific, please refer to #man rpm

1, the system has installed the software query;

1 Query the system has installed software;

Syntax: RPM-Q software name

Example:

[Root@localhost beinan]# rpm-q Gaim
Gaim-1.3.0-1.fc4
Q is--query, the Chinese meaning is "ask", this command indicates that the system is not installed Gaim, if the installation will have information output, if not installed, will output Gaim not installed information;
View all installed packages in the system, plus a parameter;
[Root@localhost rpms]# Rpm-qa
If paging view, add a pipe | and more command;
[Root@localhost rpms]# Rpm-qa |more
Find a software in all installed packages, such as Gaim, which can be extracted using grep;

[Root@localhost rpms]# Rpm-qa |grep Gaim
The above function is the same as the result of rpm-q gaim output;

2 Query a file that has been installed to which package;

Syntax RPM-QF file name
Note: The absolute path to the filename is indicated

Example:
[Root@localhost rpms]# rpm-qf/usr/lib/libacl.la
Libacl-devel-2.2.23-8

3 Find out where the installed 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 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 to view a document installation location where the software has been installed:

Syntax format: RPM-QD software name

Example:

[Root@localhost rpms]# RPM-QD Lynx

7 Check the software packages and files that have been installed;

Syntax format: RPM-QR software name

Example:

[Root@localhost beinan]# RPM-QR Rpm-python

A summary of the query installed software: For a package has been installed, we can combine a series of parameters, such as Rpm-qil, such as:

[Root@localhost rpms]# Rpm-qil Lynx

2, for the installation of the package is not installed view:

The prerequisite for viewing is that you have a. rpm file, that is, a view of the existing software file.rpm;

1) To view the use of a package, version and other information;

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 package;

Syntax: RPM-QPL file.rpm

Example:

[Root@localhost rpms]# RPM-QPL lynx-2.8.5-23.i386.rpm

3 View the location of the package's documentation;

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 package;

Syntax: RPM-QPC file.rpm

Example:

[Root@localhost rpms]# rpm-qpc lynx-2.8.5-23.i386.rpm

4 View the dependencies of a 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

(iii) Package installation, upgrade, deletion, etc.;

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 there are dependencies, please resolve the dependencies, in fact, the package Manager is a good solution to the dependencies, see the previous Package Manager introduction, if you can not find a dependency in the Package Manager package, it can only by compiling the package he relies on to resolve dependencies, or forced 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 man rpm

Example application:

[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 with the installed software once again, sometimes not too much necessary;
Test installation parameters--test to check dependencies; not real installation;

[Root@localhost rpms]# RPM-IVH--test gaim-1.3.0-1.fc4.i386.rpm
Preparing ... ########################################### [100%]
Demote to old version from new version, add--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: To add the-relocate parameter, the following example is to install the gaim-1.3.0-1.fc4.i386.rpm specified 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: To add the-relocate parameter, the following example is to install the lynx-2.8.5-23.i386.rpm specified in the/opt/lynx directory;

[Root@localhost rpms]# rpm-ivh--relocate/=/opt/lynx--badreloc
Preparing ... ########################################### [100%]

1:lynx ########################################### [100%]

How do we call programs that we install in the specified directory? General execution procedures are placed in the bin or sbin directory of the installation directory; Look at the example below; if there is error output, do the corresponding link, with 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 have to learn to query the RPM package, please see the previous description;
[Root@localhost Beinan] #rpm-E package Name

For example: 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 dependency checks to remove them. But as far as possible do not do so, it is best to use Package Manager systerm-config-packages to remove or add software;

[root@localhost beinan]# rpm-e Lynx--nodeps

Iv. Import Signatures:

[Root@localhost rpms]# rpm--import signature file

Example:

[Root@localhost fc40]# rpm--import Rpm-gpg-key
[Root@localhost fc40]# rpm--import Rpm-gpg-key-fedora
For more information on the signature features of RPM, please see man rpm

Five, RPM Management Pack Manager support network installation and query;

For example, we want to use a mirror of Fedora Core 4.0 to query, install package;

Address:

http://mirrors.kernel.org/fedora/core/4/i386/os/Fedora/RPMS/

Example:

Command format:

RPM parameter the HTTP or FTP address of the RPM package file
# 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
Extrapolate it;

Vi. a supplement to the installed package query;

[Root@localhost rpms]# UpdateDB
[root@localhost rpms]# Locate software name or file name

Through UpdateDB, we can use locate to inquire about where the software is installed, perform the updatedb at the initial installation, and perform it once at a time; to keep the installed software library up to date; UpdateDB is the slocate package all ; If you do not have this command, you will have to install slocate;

Example:

[Root@localhost rpms]# Locate Gaim

Extract files from the RPM package;

Command format: Rpm2cpio file.rpm |cpio-div
Example:
[Root@localhost rpms]# Rpm2cpio gaim-1.3.0-1.fc4.i386.rpm |cpio-div
The extracted files are in the USR and etc in the operation directory;
In fact, the file is not as good as the installation directory to install the software to facilitate the installation, the same can be extracted documents;
Specify the installation directory for the package: To add the-relocate parameter, the following example is to install the gaim-1.3.0-1.fc4.i386.rpm specified 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
This also can be at a glance; Gaim all files are installed in the/opt/gaim, we just back up the Gaim directory, and then unload Gaim, this is actually a bit of the use of extracting files;

Eight, RPM configuration file;

RPM package Management, the configuration file is RPMRC, we can find in our own system, such as Fedora Core 4.0 in the RPMRC file is located;
[Root@localhost rpms]# Locate RPMRC
/usr/lib/rpm/rpmrc
/usr/lib/rpm/redhat/rpmrc
We can see through the RPM--SHOWRC, we have to learn the specific. Oh... Do not ask me, I do not understand, as long as you read this article, think that useful to you, your level is similar to mine, we are the same level, so I can not help you, please understand;

Ix. Use of src.rpm:

Introduction to the use of file.src.rpm

PostScript: Package Management chapter in the Fedora/redhat introductory tutorial, I've written a lot; there is still a lack of software to install through the source package I method and a summary of the document; I would like to be filled in the last two days, these two articles I have written before, to rearrange the post on the line;
In my level of view, writing fedora introductory tutorials is extremely laborious and can only be perfected and supplemented by 1.1 points; The tutorial I'm writing is about beginners who don't know anything about Linux; I found that there were no instances where beginners were better than man; Of course not a novice;
often in the forum to see some of the brother's questions, although a questioning of the past can be dealt with; but to make it easier for everyone, it's better to write a tutorial on the system, although it takes a little longer;

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.