RPM Tit-Bits ;-)


The -U qualifier is used for updating an RPM to the latest version, the -h qualifier gives a list of hash # characters during the installation and the -v qualifier prints verbose status messages while the command is run. Here is an example of a typical RPM installation command to install the MySQL server package:

[root@localhost rajesh]# rpm -Uvh mysql-server-5.1.52-1.el6_0.1.x86_64
Preparing...        ####################### [100%]
  1:mysql-server   ####################### [100%]


Installing Source RPMs :-

Compiling and installing source RPMs with Fedora can be done simply with the rpmbuild command

[root@localhost rajesh]# rpmbuild --rebuild filename123.src.rpm

[root@localhost rajesh]# rpm -qi openssh
Name        : openssh                      Relocations: (not relocatable)
Version     : 5.3p1                             Vendor: Red Hat, Inc.
Release     : 70.el6                        Build Date: Wed 07 Sep 2011 05:44:30 PM MYT
Install Date: Fri 14 Dec 2012 04:24:53 AM MYT      Build Host: x86-002.build.bos.redhat.com
Group       : Applications/Internet         Source RPM: openssh-5.3p1-70.el6.src.rpm
Size        : 679713                           License: BSD
Signature   : RSA/8, Wed 21 Sep 2011 02:02:33 PM MYT, Key ID 199e2f91fd431d51
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL         : http://www.openssh.com/portable.html
Summary     : An open source implementation of SSH protocol versions 1 and 2
Description :
SSH (Secure SHell) is a program for logging into and executing

-i = Information

RPM Failed Dependencies:-

[root@localhost rajesh]# rpm -Uvh mysql-server-5.1.52-1.el6_0.1.x86_64.rpm
error: Failed dependencies:
        libmysqlclient.so.10 is needed by mysql-server-5.1.52-1.el6_0.1
        mysql = 5.1.52-1 is needed by mysql-server-5.1.52-1.el6_0.1


Signature Keys:-

[root@localhost rajesh]# locate RPM-GPG-KEY
/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta
/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-legacy-former
/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-legacy-release
/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-legacy-rhx
/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release


[root@localhost rajesh]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta
[root@localhost rajesh]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release



If you don't install the keys you'll get a DSA signature warning that alerts you to the fact that the RPM file might be bogus:

[root@localhost rajesh]# rpm -Uvh dhcp-common-4.1.1-25.P1.el6.x86_64.rpm
warning: dhcp-common-4.1.1-25.P1.el6.x86_64.rpm: V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...           #################################### [100%]
   1:dhcp              #################################### [100%]
[root@localhost rajesh]#


RPM listing:-
[root@localhost rajesh]# rpm -qa
cyrus-sasl-2.1.23-13.el6.x86_64
openssl-1.0.0-20.el6.x86_64
eog-2.28.2-4.el6.x86_64
libuser-python-0.56.13-4.el6_0.1.x86_64
tzdata-2011l-4.el6.noarch
rhn-check-1.0.0-73.el6.noarch
qt-4.6.2-20.el6.x86_64
...
...
...

    -q query operation
    -a queries all installed packages


[root@localhost rajesh]# rpm -qa |grep -i ssh
openssh-clients-5.3p1-70.el6.x86_64
openssh-askpass-5.3p1-70.el6.x86_64
openssh-server-5.3p1-70.el6.x86_64
openssh-5.3p1-70.el6.x86_64
libssh2-1.2.2-7.el6_1.1.x86_64

Description :- In this example we are looking for all packages containing the string ssh in the name, regardless of case (-i means ignore case)

Note: rpm -q package-name command to find an installed package it is quick;but you have to have an exact package match.If not sure about case sensitivity, than -qa switch is better.

[root@localhost rajesh]# rpm -q ssh
package ssh is not installed

[root@localhost rajesh]# rpm -q openssh
openssh-5.3p1-70.el6.x86_64

[root@localhost rajesh]# rpm -qa |grep ssh
openssh-clients-5.3p1-70.el6.x86_64
openssh-askpass-5.3p1-70.el6.x86_64
openssh-server-5.3p1-70.el6.x86_64
openssh-5.3p1-70.el6.x86_64
libssh2-1.2.2-7.el6_1.1.x86_64
[root@localhost rajesh]#

RPM Installed: Listing all associated files

[root@localhost rajesh]# rpm -ql openssh
/etc/ssh
/etc/ssh/moduli
/usr/bin/ssh-keygen
/usr/libexec/openssh
/usr/libexec/openssh/ssh-keysign
/usr/share/doc/openssh-5.3p1
/usr/share/doc/openssh-5.3p1/CREDITS
/usr/share/doc/openssh-5.3p1/ChangeLog
...
...
...

/usr/share/man/man1/ssh-keygen.1.gz
/usr/share/man/man8/ssh-keysign.8.gz
[root@localhost rajesh]#

Listing Files in RPM :-
[root@localhost rajesh]# rpm -qpl dhcp-3.0pl1-23.i386.rpm
/etc/rc.d/init.d/dhcpd
/etc/rc.d/init.d/dhcrelay
/etc/sysconfig/dhcpd
/etc/sysconfig/dhcrelay
...
...
...
/usr/share/man/man8/dhcrelay.8.gz
/var/lib/dhcp
/var/lib/dhcp/dhcpd.leases


    q : query the rpm file
    l : list the files in the package
    p : specify the package name



RPM that was used to install a particular file??

[root@localhost rajesh]# rpm -qf /etc/my.cnf
mysql-libs-5.1.52-1.el6_0.1.x86_64
[root@localhost rajesh]#

-f : file name

Removing RPM:-
1) list the rpm, using rpm -qa;
i.e:-[root@localhost rajesh]# rpm -qa |grep -i cvs
                              cvs-1.11.23-11.el6_0.1.x86_64

2) rpm -e exact name as stated.
i.e.:-[root@localhost rajesh]# rpm -e cvs-1.11.23-11.el6_0.1.x86_64


  • List the Dependency Packages using rpm -qRP <package-name>;
  • Find out the state of files in a package using rpm -qsp <package-name>;
  • Verify a Particular RPM Package using rpm -Vp <package-name>;


Comments

Popular posts from this blog

Xmanager RHEL 6 xclock :command not found -- Resolved

Racktable on ubuntu installation