yum list installed including version of all installed packages CentOS 5.4

I have a list of packages installed with yum on CentOS 5.4

[root@server ~]# yum list installed
...
Installed Packages
GConf2.x86_64             2.14.0-9.el5           installed
ImageMagick.x86_64        6.2.8.0-4.el5_1.1      installed
MAKEDEV.x86_64            3.23-1.2               installed
MySQL-python.x86_64       1.2.1-1                installed

I would like to download these rpms locally using

yumdownloader --resolve MySQL-python-1.2.1-1.x86_64 etc.

However the package formatting is different (MySQL-python.x86_64 1.2.1-1 vs MySQL-python-1.2.1-1.x86_64) so I am unable to download them using the above command.

I don't want to have to parse the output of yum list installed, and I also don't want to use the contents of /var/log/yum.log* as I'll have to account for erased packages and version discrepancies. However /var/log/yum.log* does have the formatting I require...

May 25 14:58:15 Installed: groff-1.18.1.1-11.1.x86_64
May 25 14:58:15 Installed: bzip2-1.0.3-4.el5_2.x86_64

Any suggestions?


Solution 1:

You can use rpm to list the installed rpms and format the output:

rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n"