Rpm command details (2)

Source: Internet
Author: User
Tags gpg

Rpm is a RedHat Package Manager (RedHat package management tool) similar to "Add/delete programs" in windows"

Run the RPM installation package
Binary and source packages. The binary package can be directly installed 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.

Common command combinations:

-IVH: the installation progress is displayed. -- install -- verbose -- hash-uvh: upgrade software package -- Update;-qpl: list file information in the RPM Software Package [query package list];-QPI: list the RPM package description [query package install package (s)];-QF: Find the RPM package that the specified file belongs to [query file];-va: Check all RPM packages, find the lost file [view lost];-E: Delete the package

 

Rpm-Q Samba // check if the program is installed with rpm-IVH/Media/CDROM/RedHat/RPMS/samba-3.0.10-1.4E.i386.rpm // install by path and display progress rpm-IVH -- relocate/=/OPT /Gaim gaim-1.3.0-1.fc4.i386.rpm // specify the installation directory rpm-IVH -- Test gaim-1.3.0-1.fc4.i386.rpm // used to check dependencies; it is not a real installation; rpm-uvh -- oldpackage gaim-1.3.0-1.fc4.i386.rpm // The new version is downgraded to the old version rpm-Qa | grep httpd # [search for whether the specified RPM package is installed] -- all search * httpd * rpm-QL httpd #[ search RPM packages] -- list all File Installation directories rpm-QPI Linux-1.4-6.i368.rpm # [view RPM packages] -- Query -- package -- install package info rpm-qpf Linux-1.4-6.i368.rpm # [view RPM packages] -- filerpm -QPR file. rpm # [View package] dependency rpm2cpio file. rpm | cpio-Div # [Extract files] rpm-IVH file. rpm # [install new RPM] -- install -- verbose -- hashrpm-ivhrpm-uvh file. rpm # [upgrade an RPM] -- upgraderpm-e file. rpm # [delete an RPM package] -- Erase

 

Common parameters:

Install/upgrade/Erase options:

-I, -- install package (s)-V, -- verbose provide more detailed output-h, -- hash print hash marks as package instals (good with-V)-E, -- Erase erase (uninstall) package-u, -- upgrade = <packagefile> + upgrade package (s) -- replacepkge forcibly installs the package regardless of whether the package has been installed. -- test installation test, not actually installed -- nodeps ignores dependencies of software packages forcibly installed -- force ignores conflicts between software packages and files query options (with-Q or -- Query):-, -- All query/verify all packages-P, -- package query/verify a package file-L, -- list files in package-D, -- docfiles list all documentation files-F, -- file query/verify package (s) Owning File

 

Rpm source code packaging and Installation

Files ending with. SRC. RPM are packaged from the source code of the Software. to install such RPM packages, you must run the following command:

Rpm -- recompile vim-4.6-4.src.rpm # This command unpacks the source code and compiles and installs it if the user uses the command: rpm -- rebuild vim-4.6-4.src.rpm # After the installation is complete, the compiled executable files will be repackaged into an i386.rpm RPM package.

 I don't like to write complicated things. If you are in trouble, 'but as a reference,' I also turned to a cool person '. The writing is really comprehensive'

 

North South
From:Linuxsir. org
Abstract:Rpm is the abbreviation of Red Hat package manager. It was originally intended to manage the Red Hat software package. This article introduces rpm and describes the applications such as manual installation and query of rpm in combination with instances;


++ ++
Body:
++ ++

Rpm is the abbreviation of Red Hat package manager. It is intended to manage Red Hat software packages. As the name suggests, it is the software package management contributed by red hat; mainstream Release versions such as fedora, RedHat, mandriva, Suse, and yellowdog, as well as the release versions developed on the basis of these versions;

What are included in the RPM package? There are other files besides the hosts file;

The application in an RPM package sometimes requires files of other specific versions in addition to the additional files it carries to ensure its normality. This is the dependency of the software package; the dependency is not exclusive to Linux, and exists in the Windows operating system. For example, if we run 3D games in windows, a prompt may be prompted during installation, to install direct 9; Linux and Windows are similar;

Software Installation flowchart:

 


Scope of use:

1. This document describes the rpmmanaged software. The software installed with make and make install is invalid for the file.tar.gz or file.tar.bz2 source code package;
2. When installing software, it is best to use the system software package management tools provided by the respective releases. For fedora/RedHat, you can refer to the following articles;

1) fedora system management software package Tool System-config-packages to conveniently add and remove the software packages provided by the system installation disk. For details, see fedora Software Package Manager System-config-packages.

2) RedHat system management software package tool. The new system should be RedHat-config-packages, which is used in the same way as fedora Software Package Manager System-config-packages;

3) Online installation, removal, and upgrade of apt + synaptic software package. Usage: install or upgrade Fedora Core 4.0 software package online with apt + synaptic
4) install, upgrade, and remove Yum software package online. Usage: fedora/RedHat online installation and update software package, yum

5) All Yum and APT tutorials apt and yum

At present, apt and Yum are very mature. We recommend that you use apt or yum when installing the software. If you install the software package provided by the system disk, you can use system-config-packages or RedHat-config-packages;


1. Usage of RPM package management;

1. You can install, delete, upgrade, and manage software. Of course, you can also install and upgrade software online;
2. You can use RPM to check which files are included in the software package and which software package the file belongs;
3. check whether or not the software package in the query system is installed and its version;
4. As a developer, You can package your program as an RPM package for release;
5. Import, verify, and release of the software package signature GPG and MD5
6. Check the dependency to see if any software package has disrupted the system due to incompatibility;


2. RPM usage permission;

Only root permissions can be used to install, delete, and update RPM software. Any user can perform operations on the query function. If a common user has the permission to install directories, the RPM software can also be installed;


Iii. Simple RPM usage;

In addition to the Software Package Manager, we can also use RPM commands to install software packages. Can all software packages be installed using RPM commands? No, the file ends with a. RPM suffix. Sometimes we find file. rpm on some websites and install it with RPM;

1) initialize the RPM database;

Run the RPM command to check whether an RPM package is installed. The RPM database is also used. Therefore, we often use the following two commands to initialize the RPM database;

[[Email protected] beinan] # rpm -- initdb
[[Email protected] beinan] # rpm -- rebuilddb Note: This takes a long time;

Note: These two parameters are extremely useful. Sometimes the RPM system has a problem and cannot be installed or queried. Most of them have a problem here;

2) 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:

 

[[email protected] 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, will output the information that Gaim has not been installed;

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

[[email protected] RPMS]# rpm -qa


If you view it by PAGE, add another pipeline | and more commands;

[[email protected] RPMS]# rpm -qa |more

Find a software in all installed software packages, such as Gaim. You can use grep to extract the software;

 

[[email protected] 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 must be specified.

 

Example:

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

 

[[email protected] RPMS]# rpm -ql lynx
[[email protected] RPMS]# rpmquery -ql lynx

4) query the information of an installed software 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 the installation location of a software installation document:

 

Syntax format: rpm-Qd software name

Example:

 

[[email protected] RPMS]# rpm -qd lynx

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

 

Syntax: rpm-QR software name

Example:

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

[[email protected] RPMS]# rpm -qil lynx


2. View uninstalled software packages:

The premise is that you have a. RPM file, that is, you can view the file. RPM of the existing software;

1) view the purpose and version of a software package;

 

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

 

Syntax: rpm-qpl file. rpm

Example:

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

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

[[email protected] RPMS]# rpm -qpc lynx-2.8.5-23.i386.rpm

4) view the dependency of a software 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


3) installation, upgrade, and deletion of software packages;


1. Install and upgrade an 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 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 the 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

Example application:

[[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 again with the installed software. Sometimes it is not necessary too much;

Test the installation parameter -- test, which is used to check the dependency. It is not a real installation;

 

[[email protected] 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;

 

[[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: 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;

 

[[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: 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;


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

 

[[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 an RPM package;

First, you must learn to query the RPM package. Please refer to the previous instructions;

[[Email protected] beinan] # rpm-e package name

For example, if I want to remove the lynx package, the complete operation should be:

[[email protected] 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;

 

[[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 about the RPM signature function, see man rpm

5. the RPM Management Package Manager supports network installation and query;

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

Address:
Http://mirrors.kernel.org/fedora/core/4/i386/ OS /Fedora/RPMS/

Example:

Command Format:

 

The HTTP or FTP address of the RPM parameter 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

Let's look at the opposite;


6. supplement the query of installed software packages;

[[Email protected] RPMs] # updatedb
[[Email protected] RPMs] # locate software name or file name

Through updatedb, we can use locate to query where some software has been installed. When the system is first installed, it needs to execute updatedb and run it 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 must install slocate;

Example:

 

[[email protected] RPMS]# locate gaim



VII. Extraction of files from the RPM software package;

Command Format: rpm2cpio file. RPM | cpio-Div


Example:

[root[email protected] RPMS]# rpm2cpio gaim-1.3.0-1.fc4.i386.rpm |cpio -div

The extracted files are stored in USR and etc;

In fact, it is better to specify the installation directory to install software. You can also Extract files;

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;

 

[[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

In this way, all the Gaim files are installed in/opt/Gaim. We just back up the Gaim directory and then unload the Gaim. This is actually a usage of extracting files;


8. RPM configuration file;

For RPM package management, the configuration file is rpmrc, which can be found in our system. For example, the rpmrc file in Fedora Core 4.0 is located;

[[email protected] RPMS]# locate rpmrc
/usr/lib/rpm/rpmrc
/usr/lib/rpm/redhat/rpmrc

You can view the details through rpm -- showrc. Oh... Don't ask me, I don't understand either. As long as you read this article and think it is useful to you, your level is similar to mine. Our level is the same, so I cannot help you. Please understand;

9. Usage of SRC. RPM:

Introduction to file. SRC. RPM usage


Postscript:
I have already written many software package management articles in the ora/RedHat getting started tutorial. At present, there is still a lack of my methods for installing software through the source code package and a summative document; I want to complete these two articles in the last two days. I have written them before. Just repeat them and paste them out;

From my perspective, it is extremely effort-consuming to write a ora getting started tutorial, which can only be improved and supplemented by 1.1 points. What I wrote was to be a newbie who knew nothing about Linux; in the tutorial, most examples of applications are used. If no instance is available, it is better for a newbie to look at man. If man is available, it is certainly not a newbie;

I often read some brothers' questions on the Forum. Although I can handle some questions in the past, it is better to write a system getting started tutorial to make it easier for everyone; although it takes a little longer;

Reference: http://www.cnblogs.com/xiaochaohuashengmi/archive/2011/10/08/2203153.html

Rpm command details (2)

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.