Useful RPM/YUM commands

Sort RPMs by size

rpm -qa --queryformat '%{size} %{name}\n' | sort -rn | more

Extract rpm into current folder instead of installing:

rpm2cpio boost-system-1.53.0-23.el7.x86_64.rpm | cpio -idmv

Trace a binary or file to the RPM that installed it:

yum whatprovides /usr/lib64/

or this:

rpm -qf /usr/lib64/

Yum/dnf revert

If a yum remove wiped out several packages, do this:

  • dnf history # note the id of the bad removal here
  • dnf history undo 96

yum/dnf will reinstall all the packages that were removed in that id.

Dependencies of a package

This command shows what other packages need the queried package:

repoquery --whatrequires libunwind

Another way, without using repoquery:

rpm -q --whatrequires python-ipaddress

This command shows what other packages need to be installed for a queried package:

yum deplist nginx

Some selinux notes

ls -Z file1
-rwxrw-r-- user1 group1 unconfined_u:object_r:user_home_t:s0 file1
  • SELinux contexts follow the SELinux user:role:type:level syntax.
  • Use the ps -eZ command to view the SELinux context for processes
  • and id -Z for users
  • seinfo -r (part of setools-console): shows all available user roles: such as guest, unconfined, webadm, sysadm, dbadm, etc.

also see /etc/selinux/targeted/context/users

Working with Centos sources

Clone their helper repo first:

git clone

Go to their RPM project and select a project to clone. I’m picking coreutils here. This repo has a SPEC file and the patches to the original source.

git clone

The master branch is always empty. Checkout their c7 branch to see the SPECS and SOURCES folders for Centos 7, and run the helper script to fetch the source.

git checkout c7

No-Cost RHEL Developer Subscription now available

 My past two distros at work and home have been RHEL derivatives so I’m happy to see this news:

Today, Red Hat announced the availability of a no-cost Red Hat Enterprise Linux developer subscription, available as part of the Red Hat Developer Program.
Offered as a self-supported, development-only subscription, the Red Hat
Enterprise Linux Developer Suite provides you with a more stable
development platform for building enterprise applications – across
cloud, physical, virtual, and container-centric infrastructures. 

 No-Cost RHEL Developer Subscription now available – Red Hat Developer Blog

rpmerizor – create an RPM package from installed files

I’ve needed something very similar at work, so this was a neat find.
via freshcode.

rpmerizor 2.8

rpmerizor is a script that allows you to create an RPM package from installed files. You simply have to specify files on the command line and answering a few interactive questions to fill rpm meta-dat… – Changes: change shebang to use /usr/bin/env

Playing with OpenShift

Openshift is a Platform As A Service offering from RedHat, and has been there for a while now. It never really came up in my radar for some reason. Fortunately I took a dive into it last week and have really liked the whole service so far.

I chose the free accounts of course, since I’m the only one who visits my own site and I really don’t need to scale to the point where I’ll need the premium offerings. The free plan comes with three small ‘gears’, which is a container that comes with 512 MB RAM and 1 Gig of space. Into this, one can slot a cartridge.. which is basically a stack for a Programming language like Perl, or a DB like MySQL.


I’ve kicked off with just one gear for now: I’ve wanted to try out Perl Dancer and this was just the opportunity I was looking for. There were straightforward instructions in the OpenShift docs, and I had an application deployed and ready in just a few minutes post-signup.

I spent another hour or so figuring out how Dancer did it’s magic, and have made trivial modifications in the router, views and templates to understand things better. I have a PerlBrew setup locally. Together with cpanm, I can install stuff on my laptop that is in sync with what is deployed on OpenShift’s cloud.

Here then is my first foray into web application development. I don’t expect the content or the layout to stay the same for long. Currently I have used Zen::Koans to print a random koan each time a particular page is queried.