Monday

RPM Tip - Determining the architecture of an installed package.

As many of you are aware, one of the first steps prior to installing Oracle is to determine which operating system packages are required. On 64bit systems you are required to have both the 32bit and 64bit versions installed for some.

For example, one such required package is libstdc++-devel. If you execute rpm with the -qa options (q for query mode, a for all installed packages) you will see the following if it is installed:


[oravis@myserver~]$ rpm -qa | grep libstdc++-devel
libstdc++-devel-3.4.6-10


If your on a 64bit OS how do you know if this is the 32bit or 64bit version? You need specify a query format in the rpm command. In the following example I extract the name, version, release and architecture information for the libstdc++-devel package.

[oravis@myserver ~]$ rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}_%{ARCH}.rpm \
%{INSTALLTIME:date}\n" | grep libstdc++

libstdc++-devel-3.4.6-10_x86_64.rpm Mon 06 Oct 2008 07:46:50 PM EDT
libstdc++-devel-3.4.6-10_i386.rpm Mon 06 Oct 2008 07:46:50 PM EDT


So based on this output I have both of the required packages and I can quickly identify which package I need to install if one is missing. Note: I always pipe rpm to grep because if you don't specify the package name properly you won't get any results. ie:

[oravis@myserver ~]$ rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}_%{ARCH}.rpm \
%{INSTALLTIME:date}\n" libstdc

[oravis@myserver ~]$

3 comments:

Anonymous said...

How do you get both 64bit and 32bit installed? I seem to be stuck in the "el5_x86_64_latest" channel when using up2date.

Unknown said...

Did you register that server for the 32bit channel as well?

Anonymous said...

Awesome! I've glossed over the query format parameter a dozen times while looking for this.

Thanks