Friday, January 18, 2008

HowTo: Display RPM Packages Installed Last Month

I have been posting rpm samples but have not posted anything about rpm description, so here goes the man page.

rpm is a powerful Package Manager, which can be used to build, install, query, verify, update, and erase individual software packages. A package consists of an archive of files and meta-data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package. Packages come in two varieties: binary packages, used to encapsulate software to be installed, and source packages, containing the source code and recipe necessary to produce binary packages.

Now the scenario comes in.

You went on leave for about a month leaving your co-sysads working with your server. Later on, you came back to report on duty. Without asking too much questions and reading too much documented emails and files, the questions in your mind of what rpm package was installed during the time that you were out and enjoying the vacation?

The scenario could be accomplished by querying and using the rpm package manager.

List Out and Display RPM Package That Was Installed Recently

Today is January. You wish to know those rpm package name that was installed last December 2007.

Here we go.

First, the basics.

Display the install date and time of every existing rpm package name from the box.
# rpm -qa --qf "%{INSTALLTIME:date} %{NAME}\n"

The above would display all the rpm package available from the rpm database.

Now, here's the catch.

Simply use grep to filter out those packages installed last month. For this case, December 2007.

# rpm -qa --qf "%{INSTALLTIME:date} %{NAME} - ( %{FILESIZES} bytes) \n" | grep 2007 | Dec

The above command displays all rpm packages installed via rpm done last December 2007 including the rpm package file size.

Sample Results:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sat 01 Dec 2007 02:32:15 PM WAT pwgen - ( 19084 bytes)
Wed 05 Dec 2007 08:45:15 AM WAT plotutils - ( 16768 bytes)
Wed 19 Dec 2007 11:47:24 AM WAT hippo-canvas - ( 25 bytes)
Wed 05 Dec 2007 07:52:46 AM WAT thunderbird - ( 2257 bytes)
Wed 05 Dec 2007 08:45:18 AM WAT ImageMagick-c++ - ( 21 bytes)
Wed 19 Dec 2007 11:47:28 AM WAT gnome-python2-gnomedesktop - ( 4096 bytes)
Wed 05 Dec 2007 07:40:28 AM WAT gnome-utils - ( 42438 bytes)
Wed 05 Dec 2007 08:04:33 AM WAT kudzu - ( 1406 bytes)
Wed 05 Dec 2007 08:45:13 AM WAT perl-DateManip - ( 4096 bytes)
Wed 05 Dec 2007 07:09:07 AM WAT flash-plugin - ( 4096 bytes)
Wed 05 Dec 2007 07:52:59 AM WAT fedora-logos - ( 7459 bytes)
Wed 05 Dec 2007 08:45:12 AM WAT perl-XML-DOM - ( 4096 bytes)
Wed 05 Dec 2007 08:45:19 AM WAT perl-XML-XQL - ( 7743 bytes)
Wed 19 Dec 2007 11:46:48 AM WAT gnome-python2-libwnck - ( 47556 bytes)
Mon 03 Dec 2007 12:13:37 PM WAT VirtualBox - ( 3117 bytes)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If the package was installed using yum, you could also take a look at /var/log/yum.log* log files.

Similarly, accomplishing the same task by viewing yum log files would be

# cat /var/log/yum.log* | grep 2007 | grep Dec
Sniffed sample results
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dec 07 22:06:36 Installed: sysstat - 7.0.4-3.fc8.i386
Dec 07 22:06:36 Installed: gamin-devel - 0.1.9-4.fc8.i386
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Remember yum -y update ? Take note that yum can also log any rpm packages being updated via yum like the logs shown below
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dec 07 22:02:40 Updated: tzdata-java - 2007k-1.fc8.noarch
Dec 07 22:02:45 Updated: tzdata - 2007k-1.fc8.noarch
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Hope this helps.

Related Words:
Identify Which RPM Package a Binary, a File or a Folder Belongs To or Owned By

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy