Have you ever wondered how to query the architecture (32bit or 64bit) or rpm version that is installed on your Linux system? Has a DBA ever come to you and asked the following: “Why is my Oracle Linux server missing Libraries?” – but I had remembered I installed them?
32bit libraries – duh?
This is often the case with Oracle’s installer – It won’t install without the proper libraries. What happened was the previous sysadmin had installed the 32bit versions of the libraries and Oracle was looking for the 64bit version. However, Redhat’s rpm -qa command by default only displays the package name but doesn’t tell you the architecture of the package. Here’s a neat command that would give you the architecture of the installed package.
Display rpm version and Architecture (i386,x64,noarch)
rpm -qa --queryformat "%{NAME}-%{VERSION}.%{RELEASE} (%{ARCH})\n"
Sample output:
authconfig-gtk-5.3.21.7.el5 (i386) systemtap-1.6.7.el5_8 (i386) system-config-bind-4.0.3.5.el5.centos (noarch) oddjob-libs-0.27.12.el5 (i386) oddjob-0.27.12.el5 (i386) ...
Give this a try the next time you install a 64bit Redhat system.
How to set this as the default query?
echo "%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}" >> ~/.rpmmacros