How to use the rpm command parameter in Linux

Source: Internet
Author: User
Tags locale rpmbuild


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;

An application in RPM package, sometimes in addition to its own additional files to ensure its normal, but also need other specific version of the file, this is the dependency of the package, that is, to install a RPM package requires the so dynamic link library (also known as shared library) environment. In fact, like the living environment of people, if a person wants to survive must give this person to provide his survival needs of the environment simple including clothing, food, live, and the same software survival needs to survive the environment, these environments include 1, the kernel support, 2, shared library support, these two indispensable. The General software installation is not successful mostly because the shared library is missing or cannot find these library files, which can be solved by yum very little, but now I introduce you to the old RPM command:


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 *.rpm on some websites, we have to use RPM to install;


1) 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] ~]# rpm--initdb[[email protected] ~]# rpm--REBUILDDB

Note: This will take a long time, these two parameters are extremely useful, and sometimes the RPM system is out of the question, can not be installed and query, mostly there is a problem; just now I have a problem with Yum, I rebuilt the database with RPM, so I think to everyone to write this blog, I hope to be helpful. Oh


Four, RPM Package management query function:


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] ~]# rpm-q net-toolsnet-tools-2.0-0.17.20131004git.el7.x86_64

-Q is--query, Chinese means "query", this command indicates that the system is not installed Net-tools, if the installation will have information output, if not installed, will output net-tools not installed information;

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


#如果分页查看, add one more pipe | and less command;

[Email protected] ~]# RPM-QA

#在所有已经安装的软件包中查找某个软件, such as net-tools, can be extracted with grep;

[Email protected] ~]# Rpm-qa |less


The function of the following command is the same as the result of rpm-q net-tools output;

[Email protected] ~]# Rpm-qa |grep net-toolsnet-tools-2.0-0.17.20131004git.el7.x86_64


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

Syntax RPM-QF file name


The following is the RPM package file for the specified file using the RPM-QF query.

[Email protected] ~]# rpm-qf/usr/lib/rpm/check-files rpm-build-4.11.3-17.el7.x86_64


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


3) query where the installed packages are installed;

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

Example:

[Email protected] ~]# RPM-QL net-tools/bin/netstat/sbin/arp/sbin/ether-wake/sbin/ifconfig/sbin/ipmaddr/sbin/ Iptunnel/sbin/mii-diag/sbin/mii-tool/sbin/nameif/sbin/plipconfig/sbin/route ...

[Email protected] rpm]# RPMQUERY-QL net-tools/bin/netstat/sbin/arp/sbin/ether-wake/sbin/ifconfig/sbin/ipmaddr/ Sbin/iptunnel/sbin/mii-diag/sbin/mii-tool/sbin/nameif/sbin/plipconfig/sbin/route/sbin/slattach ...

4) query information for an installed package

Syntax format: RPM-QI software name

Example:

# rpm -qi net-toolsname        : net-toolsversion      : 2.0Release     :  0.17.20131004git.el7architecture: x86_64install date: thu 03 mar 2016  10:32:36 pm estgroup       : system environment/ basesize        : 938653license     :  gplv2+signature   : rsa/sha256, thu 03 jul 2014 11:56:18  PM EDT, Key ID 24c6a8a7f4a80eb5Source RPM  :  net-tools-2.0-0.17.20131004git.el7.src.rpmbuild date  : tue 10 jun 2014  12:15:04 am edtbuild host  : worker1.bsys.centos.orgrelocations :   (not relocatable) Packager    : centos buildsystem 



5) Check the configuration file of the installed software;

Syntax format: RPM-QC software name

Example:

[Email protected] ~]# RPM-QC net-tools


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

Syntax format: RPM-QD software name

Example:

[[email protected] ~]# rpm -qd net-tools/usr/share/doc/net-tools-2.0/copying/usr/ Share/man/de/man5/ethers.5.gz/usr/share/man/de/man8/arp.8.gz/usr/share/man/de/man8/ifconfig.8.gz/usr/share/man /de/man8/netstat.8.gz/usr/share/man/de/man8/plipconfig.8.gz/usr/share/man/de/man8/route.8.gz/usr/share/man/de/ man8/slattach.8.gz/usr/share/man/fr/man5/ethers.5.gz/usr/share/man/fr/man8/arp.8.gz/usr/share/man/fr/man8/ ifconfig.8.gz/usr/share/man/fr/man8/netstat.8.gz/usr/share/man/fr/man8/plipconfig.8.gz/usr/share/man/fr/man8/ route.8.gz/usr/share/man/fr/man8/slattach.8.gz/usr/share/man/man5/ethers.5.gz/usr/share/man/man8/arp.8.gz/usr/ share/man/man8/ether-wake.8.gz/usr/share/man/man8/ifconfig.8.gz/usr/share/man/man8/ipmaddr.8.gz/usr/share/man/ man8/iptunnel.8.gz/usr/share/man/man8/mii-diag.8.gz/usr/share/man/man8/mii-tool.8.gz/usr/share/man/man8/ nameif.8.gz/usr/share/man/man8/netstat.8.gz/usr/share/man/man8/plipconfig.8.gz/usr/share/man/man8/route.8.gz/ Usr/share/man/man8/slattach.8.gz/usr/share/man/pt/man8/arp.8.gz/usr/share/man/pt/man8/ifconfig.8.gz/usr/share/man/pt/man8/netstat.8.gz/ Usr/share/man/pt/man8/route.8.gz


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

Syntax format: RPM-QR software name

Example:

[[email protected] ~]# RPM-QR net-tools/bin/shlibc.so.6 () (64bit) libc.so.6 (glibc_2.14) (64bit) libc.so.6 (glibc_2.2.5) (64bit) libc.so.6 (glibc_2.3) (64bit) libc.so.6 (glibc_2.3.4) (64bit) libc.so.6 (glibc_2.4) (64bit) libselinux.so.1 () ( 64bit) rpmlib (compressedfilenames) <= 3.0.4-1rpmlib (filedigests) <= 4.6.0-1rpmlib (Payloadfileshaveprefix) < = 4.0-1rtld (Gnu_hash) systemd-unitsrpmlib (PAYLOADISXZ) <= 5.2-1


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] ~]# rpm -qil net-toolsname         : net-toolsVersion     : 2.0Release      : 0.17.20131004git.el7Architecture: x86_64Install Date: Thu 03 Mar  2016 10:32:36 pm estgroup       : system  environment/basesize        : 938653license      : gplv2+signature   : rsa/sha256, thu 03 jul 2014  11:56:18 PM EDT, Key ID 24c6a8a7f4a80eb5Source RPM  :  net-tools-2.0-0.17.20131004git.el7.src.rpmbuild date  : tue 10 jun 2014  12:15:04 am edtbuild host  : worker1.bsys.centos.orgrelocations :   (not relocatable) PACKAGER&NBSP;&NBSP;&Nbsp; : centos buildsystem 


The above is I give you a detailed summary of the RPM package management of the use of the command, we hope to help.

This article is from the "Cowboy" blog, make sure to keep this source http://fangniuwa.blog.51cto.com/10209030/1750663

How to use the rpm command parameter in Linux

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.