Linux RPM Command Parameters use detailed

Source: Internet
Author: User
Tags gpg




Freeeim Linux rpm Command parameter usage [introduction and application]



RPM is a "Add/Remove Program" in Windows like Redhat Package Manager (Redhat Packages management tool)

RPM Execution Installation package
Binary packages (binary) and source code packages (sources) are two types. Binary packages 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: Lists the file information in the RPM package [Query packages list];
-QPI: Lists the description information for RPM packages [Query Package Install pack (s)];
-QF: Find which rpm package the specified file belongs to [Query file];
-va: Check all RPM packages to find the missing files [View Lost];
-E: Remove Package


Copy Code

Rpm-q Samba//query program is installed

RPM-IVH/MEDIA/CDROM/REDHAT/RPMS/SAMBA-3.0.10-1.4E.I386.RPM//install by Path and show progress
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//used to check dependencies; not a real installation;
RPM-UVH--oldpackage gaim-1.3.0-1.fc4.i386.rpm//new version degraded to old version

Rpm-qa | grep httpd #[Search Specifies whether RPM packages are installed]--all search *httpd*
RPM-QL httpd #[Search rpm Package]--list All files installation directory

Rpm-qpi linux-1.4-6.i368.rpm #[View RPM Packages]--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 #[Installing the new Rpm]--install--verbose--hash
Rpm-ivh

RPM-UVH file.rpm #[Upgrade a Rpm]--upgrade
Rpm-e file.rpm #[Delete an RPM package]--erase

Copy Code

Common parameters:

Install/upgrade/erase options:


Copy Code

-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 they have been installed
--test installation test, not actually installed
--nodeps ignoring dependencies of packages forcibly installed
--force ignoring 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

Copy Code

RPM Source Code Packaging installation

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


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

I do not like to write more complex things, trouble words ' but as a reference ' I also turn a person's ' write really very comprehensive '


North-South and north-south
From: linuxsir.org
Summary: RPM is the Red Hat Package manager abbreviation, the original is Red Hat packages management, this article introduces RPM, and combined with examples to explain the RPM manual installation, query and other applications;


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Body:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


RPM is an abbreviation for Red Hat Package Manager and is intended to be managed by Red Hat packages, as the name implies in the package management that Red Hat has contributed, and in mainstream releases such as Fedora, Redhat, Mandriva, SuSE, Yellowdog, etc. , as well as the two-time releases that were developed on the basis of these editions;

What is included in the RPM package? It contains an executable binary program, This program is similar to the. exe file in the Windows package, and the RPM package also includes the files required for the program to run, which is similar to the Windows package, where Windows programs run with other files besides the. exe file.

A RPM package of applications, and sometimes in addition to their own additional files to ensure that other specific version of the file, which is the dependencies of the package, dependencies are not unique to Linux, Windows operating system also exists in the same , for example, we run 3D games in Windows, and during installation, he may be prompted to install direct 9; Linux and Windows are similar in principle;

Software Installation Flowchart:


This article uses the scope:

1, this article is the RPM management software description, to pass file.tar.gz or file.tar.bz2 source package make;
2, when installing the software, it is best to use the respective distribution of the system software package management tools, for fedora/redhat you can refer to the following articles;

1) Fedora System Management Package tool System-config-packages, easy to add and remove software packages provided by the system installation disk, see Fedora Package Manager system-config-packages for details

2) Redhat System Management software Package tool, the new point of the system should be redhat-config-packages, the use of the same as the Fedora Package Manager system-config-packages;

3) Apt + synaptic 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 install update package online, yum"

5) all Yum and apt tutorials "apt and yum"

Now that apt and Yum are very mature, it is advisable to use apt or yum when installing the software, or system-config-packages or redhat-config-packages if the packages provided by the system disk are installed;


One, the use of RPM package management;


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


Second, the use of RPM rights;

RPM Software Installation, deletion, update only the root permission to use, for the query function of any user can operate, if the normal user has the installation directory permissions, can also be installed;


Three, rpm a little simple usage;

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

A) initialize the RPM database;

The RPM command is used to query whether an RPM package is installed and is to be done through the RPM database, so we often use the following two commands to initialize the RPM database;


[Email protected] beinan]# rpm--INITDB
[Email protected] beinan]# RPM--REBUILDDB Note: This will take a long time;

Note: These two parameters are extremely useful, sometimes the RPM system is out of the question, can not be installed and query, mostly there is a problem;

II) the query function of RPM package management:

Command format


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

The RPM query function is extremely powerful and is one of the most important functions; For a few common examples, more 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:

[Email protected] beinan]# rpm-q Gaim
Gaim-1.3.0-1.fc4

-Q is--query, Chinese means "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;

To view all installed packages in the system, add the-a parameter;


[Email protected] rpms]# RPM-QA

If paging is viewed, add a pipe | and more command;

[Email protected] rpms]# Rpm-qa |more

Look for a software in all installed packages, such as Gaim, which can be extracted with grep;

[Email protected] rpms]# Rpm-qa |grep Gaim

The function of the above is the same as the result of rpm-q gaim output;

2) query which package a file is already installed in;

Syntax RPM-QF file name

Note: The absolute path to which the file name is located is indicated

Example:


[Email protected] rpms]# rpm-qf/usr/lib/libacl.la
Libacl-devel-2.2.23-8

3) query where the installed packages are installed;

Syntax: RPM-QL software name or rpm RPMQUERY-QL software name

Example:

[Email protected] rpms]# RPM-QL Lynx
[Email protected] rpms]# RPMQUERY-QL Lynx

4) query information for an installed package

Syntax format: RPM-QI software name

Example:


[Email protected] rpms]# Rpm-qi Lynx

5) Check the configuration file of the installed software;

Syntax format: RPM-QC software name

Example:


[Email protected] rpms]# RPM-QC Lynx

6) View a document where the software has been installed:

Syntax format: RPM-QD software name

Example:

[Email protected] rpms]# RPM-QD Lynx

7) Check the packages and files on which the software is installed;

Syntax format: RPM-QR software name

Example:


[Email protected] beinan]# RPM-QR Rpm-python

Query the summary of installed software: For a package has been installed, we can combine a series of parameters to use, such as Rpm-qil;


[Email protected] rpms]# Rpm-qil Lynx


2. For non-installed packages, view:

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

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

Syntax: Rpm-qpi file.rpm

Example:

[Email protected] rpms]# Rpm-qpi lynx-2.8.5-23.i386.rpm

2) View the files contained in a package;

Syntax: RPM-QPL file.rpm

Example:


[Email protected] 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:


[Email protected] rpms]# RPM-QPD lynx-2.8.5-23.i386.rpm

5) View the configuration file of a package;

Syntax: RPM-QPC file.rpm

Example:


[Email protected] rpms]# RPM-QPC lynx-2.8.5-23.i386.rpm

4) View dependencies for a package

Syntax: RPM-QPR file.rpm

Example:


[Email protected] 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) installation, upgrading and deletion of software packages;


1, install and upgrade a RPM package;


[[email protected] Beinan] #rpm-VIH file.rpm Note: This is used to install a new RPM package;
[[email protected] Beinan] #rpm-UVH file.rpm Note: This is used to upgrade a RPM package;

If there is a dependency, please resolve the dependency, in fact, the package Manager can be a good solution to the dependency, see the previous Package Manager introduction, if you can not find dependencies in the package manager of the package, it can only compile the package he depends on to resolve the dependency, or force installation;

Syntax structure:

[Email protected] beinan]# RPM-IVH file.rpm--nodeps--force
[Email protected] beinan]# RPM-UVH file.rpm--nodeps--force

For more parameters, see man rpm

Examples of applications:


[Email protected] rpms]# RPM-IVH lynx-2.8.5-23.i386.rpm
Preparing ... ########################################### [100%]
1:lynx ########################################### [100%]
[Email protected] rpms]# RPM-IVH--replacepkgs lynx-2.8.5-23.i386.rpm
Preparing ... ########################################### [100%]
1:lynx ########################################### [100%]

Note: The--replacepkgs parameter is installed with the software installed again, sometimes not too much necessary;

Test installation Parameters--test, used to check dependencies; not a real installation;

[Email protected] rpms]# RPM-IVH--test gaim-1.3.0-1.fc4.i386.rpm
Preparing ... ########################################### [100%]

Downgrade to old version by new version, add--oldpackage parameter;

[Email protected] rpms]# Rpm-qa Gaim
Gaim-1.5.0-1.fc4
[Email protected] rpms]# RPM-UVH--oldpackage gaim-1.3.0-1.fc4.i386.rpm
Preparing ... ########################################### [100%]
1:gaim ########################################### [100%]
[Email protected] 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;

[Email protected] rpms]# RPM-IVH--relocate/=/opt/gaim gaim-1.3.0-1.fc4.i386.rpm
Preparing ... ########################################### [100%]
1:gaim ########################################### [100%]
[Email protected] 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;


[Email protected] rpms]# RPM-IVH--relocate/=/opt/lynx--badreloc lynx-2.8.5-23.i386.rpm
Preparing ... ########################################### [100%]
1:lynx ########################################### [100%]


How do the programs we install in the specified directory call? General execution procedures, are placed in the installation directory of the bin or sbin directory; see the following example; If there is an error output, do the corresponding link, with ln-s;

[Email protected] rpms]#/opt/lynx/usr/bin/lynx
Configuration file/etc/lynx.cfg is not available.
[Email protected] rpms]# ln-s/opt/lynx/etc/lynx.cfg/etc/lynx.cfg
[Email protected] rpms]#/opt/lynx/usr/bin/lynx www.linuxsir.org


2, delete a RPM package;


First of all, you have to learn to query the RPM package, please see the previous instructions;

[[email protected] Beinan] #rpm-E package Name

Example: I want to remove the Lynx package, the complete operation should be:


[Email protected] rpms]# RPM-E Lynx

If you have dependencies, you can also remove them with--nodeps ignore dependent checks. But as far as possible not to do so, it is best to use the Package Manager systerm-config-packages to remove or add software;

[Email protected] beinan]# RPM-E Lynx--nodeps


Iv. Import Signature:

[[Email protected] rpms]# rpm--import signature file

Example:

[Email protected] fc40]# rpm--import Rpm-gpg-key
[Email protected] fc40]# rpm--import Rpm-gpg-key-fedora

For more information on the signature function of RPM, see Man rpm

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

For example, we want to query and install packages through a single image of Fedora Core 4.0;

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

Example:

Command format:

RPM parameter RPM package file HTTP or FTP address

# 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 bar;


Vi. add to the query of installed packages;


[Email protected] rpms]# UpdateDB
[[Email protected] rpms]# Locate software name or file name

Through the updatedb, we can use locate to find out where some software is installed, the system will be executed at the initial installation updatedb, once every time, to keep the installed repositories up-to-date; UpdateDB is Slocate package all If you do not have this command, you have to install slocate;

Example:

[Email protected] rpms]# locate Gaim


Extracting files from RPM packages;


Command format: Rpm2cpio file.rpm |cpio-div

Example:

[Email protected] rpms]# Rpm2cpio gaim-1.3.0-1.fc4.i386.rpm |cpio-div

The extracted files are used in USR and etc in the operating directory;

In fact, this is not as easy as specifying the installation directory to install the software, you can also extract files;

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;

[Email protected] rpms]# RPM-IVH--relocate/=/opt/gaim gaim-1.3.0-1.fc4.i386.rpm
Preparing ... ########################################### [100%]
1:gaim ########################################### [100%]
[Email protected] rpms]# ls/opt/
Gaim

This also can be at a glance; Gaim all the files are installed in the/opt/gaim, we just back up the Gaim directory, and then remove the Gaim, which is actually a little 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;


[Email protected] rpms]# Locate RPMRC
/usr/lib/rpm/rpmrc
/usr/lib/rpm/redhat/rpmrc

We can view it through RPM--SHOWRC, and we have to learn it by ourselves. Oh... Do not ask me, I do not understand, as long as you read this article, think that it is useful to you, your level is similar to mine, we are the same level, so I can not help you, please understand;

Nine, the use of src.rpm:

Introduction to the file.src.rpm use method


PostScript: Fedora/redhat The package management in the introductory tutorial, I have written a lot of; there is still a lack of software through the source package to install my method and a summary of the document; I want to make up in the last two days, these two articles I have written before;

At my level, writing the Fedora Introductory tutorial is extremely laborious and can only be perfected and supplemented by 1.1 points; The tutorial I wrote was faced with a novice who knew nothing about Linux, and the majority of instances in the tutorial; I found that without an instance, a novice would look man; Certainly not a novice;

Often in the forum to see some of the brother's questions, although an explanation of the past can be dealt with, but want to make it easier for everyone, rather than write the system to get started tutorial, although the time spent a bit longer;

Linux RPM Command Parameters use detailed

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.