RPM Software Packages and Yum

Two Utilities are Used to Manage the Software in Linux ..

  1. RPM – Redhat Package Manager.
  2. YUM – Yellowdog Updater Modified.

PART1: Redhat Package Manager (RPM)

RPM is a package managing tool. It is used for installing, uninstalling, querying, verifying and updating software packages.

Features:

  • It verify which files were installed by the software package.
  • Information about installed packages is stored in a local RPM database.
  • RPM can be served as a powerful search engine to search for software’s.
  • Installing and reinstalling can be done with RPM is ease

RPM package files are named as shown below

name-version-release.architecture.rpm
For Example: rsync-3.0.9-17.el7.x86_64.rpm
  • name is a name describing the packaged software (rsync).
  • version is the version number of the original software (3.0.9).
  • release  is the number of times this version of the software has been packaged(17.el7).
  • architecture is the processor architecture. “norach” indicates that this package’s contects are not architecture-specific (x86_64).

1.) Check all installed packages in the system.

#rpm -qa (Where q stands for query and a stands for all)

[root@ittroubleshooter ~]# rpm -qa 
perl-Digest-1.17-245.el7.noarch
selinux-policy-targeted-3.13.1-60.el7.noarch
filesystem-3.2-20.el7.x86_64
perl-ExtUtils-MakeMaker-6.68-3.el7.noarch
sudo-1.8.6p7-16.el7.x86_64
linux-firmware-20150904-43.git6ebf5d5.el7.noarch
perl-CPAN-1.9800-286.el7.noarch
checkpolicy-2.1.12-6.el7.x86_64

2.) Check particular package is installed or not.

#rpm -qa <packagename>

[root@ittroubleshooter ~]# rpm -qa tftp-server
tftp-server-5.2-12.el7.x86_64
[root@ittroubleshooter ~]#

3.) Check rpm packages update history.

#rpm -q <package name> –last

[root@ittroubleshooter ~]# rpm -q kernel --last
kernel-2.6.18-371.4.1.el5                     Thu 13 Feb 2014 12:23:42 PM IST
kernel-2.6.18-371.el5                         Mon 14 Oct 2013 02:08:33 PM IST
kernel-2.6.18-238.el5                         Fri 06 May 2011 02:54:16 AM IST
[root@ittroubleshooter ~]#

4.) Check complete packages update history.

#rpm -qa –last

[root@ittroubleshooter ~]# rpm -qa --last
strace-4.5.18-18.el5                          Fri 17 Jun 2016 03:31:43 PM IST
rgmanager-2.0.52-47.el5                       Wed 01 Jun 2016 11:40:59 AM IST
ntfs-3g-2011.4.12-5.el5                       Mon 30 May 2016 07:08:05 PM IST
ntfs-3g-2011.4.12-5.el5                       Mon 30 May 2016 07:08:01 PM IST
gpg-pubkey-217521f6-45e8a532                  Mon 30 May 2016 07:07:05 PM IST
OB2-OR8-A.07.00-1                             Wed 27 Apr 2016 12:05:27 PM IST
OB2-MA-A.07.00-1                              Wed 27 Apr 2016 12:05:25 PM IST
freetype-devel-2.2.1-32.el5_9.1               Fri 22 Apr 2016 12:02:26 PM IST
libgcc-4.1.2-55.el5                           Fri 22 Apr 2016 12:02:21 PM IST
krb5-devel-1.6.1-80.el5_11                    Wed 29 Apr 2015 11:53:20 AM IST
krb5-devel-1.6.1-80.el5_11                    Wed 29 Apr 2015 11:53:19 AM IST
libselinux-devel-1.33.4-5.7.el5               Wed 29 Apr 2015 11:53:18 AM IST
krb5-workstation-1.6.1-80.el5_11              Wed 29 Apr 2015 11:53:17 AM IST

5.) Check whether a Package consistent or not, Before installing it.

# rpm -ivh –test <Package name> (Where “i” is for install, “v” is for verbose and “h” is for hash process).

[root@ittroubleshooter ~]#rpm -ivh --test epel-release-7-7.noarch.rpm
Preparing...                          ################################# [100%]
[root@ittroubleshooter ~]#

If the installation status shows 100%, then the package is consistent.

6.) Install a Package.

#rpm -ivh <packagename>

[root@ittroubleshooter ~]# rpm -ivh epel-release-7-7.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:epel-release-7-7                 ################################# [100%]
[root@ittroubleshooter ~]#

7.) Check the information of installed package.

#rpm -qip <package name> (Where “q” is for query, “i” is for install and “p” is for package)

[root@ittroubleshooter ~]# rpm -qi epel-release
Name        : epel-release
Version     : 7
Release     : 7
Architecture: noarch
Install Date: Fri 16 Sep 2016 07:34:25 PM IST
Group       : System Environment/Base
Size        : 24746
License     : GPLv2
Signature   : RSA/SHA256, Sat 04 Jun 2016 11:55:41 PM IST, Key ID 6a2faea2352c64e5
Source RPM  : epel-release-7-7.src.rpm
Build Date  : Fri 03 Jun 2016 07:24:35 PM IST
Build Host  : buildvm-13.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://download.fedoraproject.org/pub/epel
Summary     : Extra Packages for Enterprise Linux repository configuration
Description :
This package contains the Extra Packages for Enterprise Linux (EPEL) repository
GPG key as well as configuration for yum.
[root@ittroubleshooter ~]#

8.) Check the configuration files of the installed package.

#rpm -qc <package name> (Where, “c”  shows the list of configuration files)

[root@ittroubleshooter ~]#  rpm -qc puppet
/etc/logrotate.d/puppet
/etc/puppet/auth.conf
/etc/puppet/puppet.conf
/etc/tmpfiles.d/puppet.conf
[root@ittroubleshooter ~]#

9.) To remove a Package.

#rpm -e <Package name> (Where “e” is for erase)

[root@ittroubleshooter ~]#  rpm -e epel-release
[root@ittroubleshooter ~]# rpm -q epel-release
package epel-release is not installed
[root@ittroubleshooter ~]#

10.) To see the documentation files of particular package.

#rpm  -qld <Package name> (Where “l” is for list and “d” shows the list of documentation files)

[root@ittroubleshooter ~]#  rpm -qld puppet
/usr/share/doc/puppet-3.8.7/LICENSE
/usr/share/doc/puppet-3.8.7/README.md
/usr/share/doc/puppet-3.8.7/examples/hiera/README.md
/usr/share/doc/puppet-3.8.7/examples/hiera/etc/hiera.yaml
/usr/share/doc/puppet-3.8.7/examples/hiera/etc/hieradb/common.yaml
/usr/share/doc/puppet-3.8.7/examples/hiera/etc/hieradb/dc1.yaml
/usr/share/doc/puppet-3.8.7/examples/hiera/etc/hieradb/development.yaml
/usr/share/doc/puppet-3.8.7/examples/hiera/etc/puppet.conf
/usr/share/doc/puppet-3.8.7/examples/hiera/modules/data/manifests/common.pp
/usr/share/doc/puppet-3.8.7/examples/hiera/modules/ntp/manifests/config.pp
/usr/share/doc/puppet-3.8.7/examples/hiera/modules/ntp/manifests/data.pp
/usr/share/doc/puppet-3.8.7/examples/hiera/modules/ntp/templates/ntp.conf.erb

11.) Check the addition information of a Package.

# rpm -qlv <Package name> (Where, “l” is for list, “v” is for display addition information)

[root@ittroubleshooter ~]#   rpm -qlv rsync-3.0.9-17.el7.x86_64
-rw-r--r--    1 root    root                      458 Nov 21  2015 /etc/rsyncd.conf
-rw-r--r--    1 root    root                       12 Nov 21  2015 /etc/sysconfig/rsyncd
-rwxr-xr-x    1 root    root                   448296 Nov 21  2015 /usr/bin/rsync
-rw-r--r--    1 root    root                      237 Nov 21  2015 /usr/lib/systemd/system/rsyncd.service
-rw-r--r--    1 root    root                      138 Nov 21  2015 /usr/lib/systemd/system/rsyncd.socket
-rw-r--r--    1 root    root                      220 Nov 21  2015 /usr/lib/systemd/system/rsyncd@.service
drwxr-xr-x    2 root    root                        0 Nov 21  2015 /usr/share/doc/rsync-3.0.9
-rw-r--r--    1 root    root                    35147 Jul  7  2007 /usr/share/doc/rsync-3.0.9/COPYING
-rw-r--r--    1 root    root                     1859 Sep 23  2011 /usr/share/doc/rsync-3.0.9/NEWS
-rw-r--r--    1 root    root                   144242 Sep 23  2011 /usr/share/doc/rsync-3.0.9/OLDNEWS
-rw-r--r--    1 root    root                     4170 Apr 15  2008 /usr/share/doc/rsync-3.0.9/README
drwxr-xr-x    2 root    root                        0 Sep 23  2011 /usr/share/doc/rsync-3.0.9/support

12.) To Update a Particular Package.

#rpm -Uvh <Package name> (Where, “U” is for upgrade)

[root@ittroubleshooter ~]#  rpm -qa vsftpd
vsftpd-3.0.2-10.el7.x86_64
[root@pidgin ~]# rpm -Uvh vsftpd-3.0.2-11.el7_2.x86_64.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:vsftpd-3.0.2-11.el7_2            ################################# [ 50%]
Cleaning up / removing...
   2:vsftpd-3.0.2-10.el7              ################################# [100%]
[root@ittroubleshooter ~]#

13.) Find out which package a command came from.

#rpm -qf $(which <Command name>)  (Where, “f” is query package owning file).

[root@ittroubleshooter ~]#   rpm -qf $(which cat)
coreutils-8.22-15.el7.x86_64
[root@pidgin ~]# rpm -qf $(which yum)
yum-3.4.3-132.el7.centos.0.1.noarch
[root@pidgin ~]# rpm -qf $(which cd)
bash-4.2.46-19.el7.x86_64
[root@pidgin ~]# rpm -qf $(which uname)
coreutils-8.22-15.el7.x86_64
[root@ittroubleshooter ~]#

14.) Check an RPM Signature Package.

#rpm –checksig <Package name>

[root@ittroubleshooter ~]# rpm --checksig vsftpd-3.0.2-11.el7_2.x86_64.rpm
vsftpd-3.0.2-11.el7_2.x86_64.rpm: rsa sha1 (md5) pgp md5 OK
[root@ittroubleshooter ~]#

15.) Check dependencies of RPM Package before Installing.

# rpm -qpR <Package name> (Where “R” shows the list capabilities on which this package depends)

[root@ittroubleshooter ~]#  rpm -qpR  vsftpd-3.0.2-11.el7_2.x86_64.rpm
/bin/bash
/bin/sh
/bin/sh
/bin/sh
config(vsftpd) = 3.0.2-11.el7_2
libc.so.6()(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.15)(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)
libc.so.6(GLIBC_2.7)(64bit)

16.) Check the changes are made after installation of package.

First let’s make some changes in the configuration file of a package say vsftpd.

# vim /etc/vsftpd/vsftpd.conf

# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
######### Please see vsftpd.conf.5 for all compiled in defaults.
#

Now run the following command and check for the result.

[root@ittroubleshooter ~]#  vim /etc/vsftpd/vsftpd.conf
[root@ittroubleshooter ~]# rpm -Vp  vsftpd-3.0.2-11.el7_2.x86_64.rpm
S.5....T.  c /etc/vsftpd/vsftpd.conf
[root@ittroubleshooter ~]#

It is showing that some changes have been made.!!!!

Read also PART2: YUM (Yellowdog Updater Modified)

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz