UNIX – Extract RedHat/CentOS/Fedora RPM File

| | | | |

I love to find RPM files that someone has compiled so that I don’t have to do the manual work but when I find one at a questionable location or one I’m simply not familiar with it’s nice to know what is in it.

Recently I did a search on RPMFind.net for Redis (https://www.rpmfind.net/linux/rpm2html/search.php?query=redis)

I found what I was looking for but it it has an IP instead of a domain.

Doing a quick lookup on the IP I didn’t get much more than that it’s a French IP address block.

I found a nice article on nixCraft (http://www.cyberciti.biz/tips/how-to-extract-an-rpm-package-without-installing-it.html) that described how to extract the RPM.

cd ~/
wget -O RedHat_Redis.rpm ftp://195.220.108.108/linux/remi/enterprise/7/remi/x86_64/redis-3.0.7-1.el7.remi.x86_64.rpm

rpm2cpio RedHat_Redis.rpm | cpio -idmv

The command will output something like this

$ rpm2cpio RedHat_Redis.rpm | cpio -idmv
./etc/logrotate.d/redis
./etc/redis-sentinel.conf
./etc/redis.conf
./etc/systemd/system/redis-sentinel.service.d
./etc/systemd/system/redis-sentinel.service.d/limit.conf
./etc/systemd/system/redis.service.d
./etc/systemd/system/redis.service.d/limit.conf
./usr/bin/redis-benchmark
./usr/bin/redis-check-aof
./usr/bin/redis-check-dump
./usr/bin/redis-cli
./usr/bin/redis-sentinel
./usr/bin/redis-server
./usr/bin/redis-shutdown
./usr/lib/systemd/system/redis-sentinel.service
./usr/lib/systemd/system/redis.service
./usr/lib/tmpfiles.d/redis.conf
./usr/share/doc/redis-3.0.7
./usr/share/doc/redis-3.0.7/00-RELEASENOTES
./usr/share/doc/redis-3.0.7/BUGS
./usr/share/doc/redis-3.0.7/CONTRIBUTING
./usr/share/doc/redis-3.0.7/MANIFESTO
./usr/share/doc/redis-3.0.7/README
./usr/share/licenses/redis-3.0.7
./usr/share/licenses/redis-3.0.7/COPYING
./var/lib/redis
./var/log/redis
./var/run/redis
2366 blocks
$

Now I can go and nano or vi each file to to compare to to the files that I have from building from source.

References: http://www.cyberciti.biz/tips/how-to-extract-an-rpm-package-without-installing-it.html

All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.