Silly Yum Tricks: whatprovides, groups & repolist

Oh Dear monitors your entire site, not just the homepage. We crawl and search for broken pages and mixed content, send alerts when your site is down and notify you on expiring SSL certificates.

Start your free 10 day trial! »

Profile image of Mattias Geniar

Mattias Geniar, February 07, 2011

Follow me on Twitter as @mattiasgeniar

These are a few I’ve only learned recently.

yum (what)provides

Ever needed to find out in which package a certain binary or file resides? The whatprovides option lets you do so. Let’s assume you’re looking for the package that contains ‘ab’ (the Apache Benchmark).

[root@dev ~]# yum whatprovides */ab
httpd-2.2.3-43.el5.centos.x86_64 : Apache HTTP Server
Repo        : base
Matched from:
Filename    : /usr/bin/ab

It’s important to do the search for ‘*/ab’ (including the star & dash), or you won’t find anything. Now you know you need to install the ‘httpd-2.2.3-43’ package to get it.

This one gets all credits to Rackerhacker!

yum grouplist, groupinfo & groupinstall

Say you’re preparing a system to build your own RPM packages or compile your own tools. I previously just ran a “yum install ” for each package that I would need, but you can make this easier.

Via grouplist you list all grouped packages provided by yum.

[root@dev ~]# yum grouplist
Installed Groups:
[snip]

Available Groups:
[snip]
Development Libraries
Development Tools
...

If your’re interested to know what’s in the “Development Tools” group, you can run a yum groupinfo.

[root@dev ~]# yum groupinfo "Development Tools"
Group: Development Tools
Description: These tools include core development tools such as automake, gcc, perl, python, and debuggers.
Mandatory Packages:
autoconf
automake
binutils
[snip]

Default Packages:
automake14
automake15
automake16
[snip]

Optional Packages:
ElectricFence
ccache
clips
[snip]

And if that’s what you need, you install it.

[root@dev ~]# yum groupinstall "Development Tools"

yum repolist

Knowing which repositories are enabled for yum, could mean checking out the files in /etc/yum.repos.d/*.repo, or it could be as simple as this.

[root@dev ~]# yum repolist
repo id                 repo name                                          status
addons                  CentOS-5 - Addons                                  enabled:     0
base                    CentOS-5 - Base                                    enabled: 3,434
epel                    Extra Packages for Enterprise Linux 5 - x86_64     enabled: 6,192
extras                  CentOS-5 - Extras                                  enabled:   297
updates                 CentOS-5 - Updates                                 enabled: 1,135

repolist: 11,069

Feels easier that running through those files, personally.



Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.