Library Technology - Reviews, Tips, Giveaways, Freeware

Library Technology – Reviews, Tips, Giveaways, Freeware

5 Tips and Tricks for Using Yum

Posted In Linux - By Techtiplib on Tuesday, March 6th, 2012 With No Comments »

If you’re using one of the Fedora/Red Hat derived Linux distributions, odds are you spend some time working with Yum. You probably already know the basics, like searching packages and how to install or remove them. But if that’s all you know, you’re missing out on a lot of features that make Yum interesting. Let’s take a look at a few of the less commonly used Yum features.

Yum comes with a lot of different distributions, but I’m going to focus on Fedora here. Mainly becausethat’s what I’m running while I’m writing this piece. I believe most, if not all, of this should apply to CentOS, Red Hat Enterprise Linux, etc., but if not, you may need to check your man pages or system documentation.

Working with Groups

If you use the PackageKit GUI, you can view and manage packages by groups. This is pretty convenient if you want to install everything for a MySQL database or all packages you should need for RPM development.

But, what if you (like me) prefer to use the command line? Then you’ve got the group commands.

To search all groups, use yum group list. This will produce a full list of available groups to install or remove. (Yum lists the groups by installed groups, installed language groups, and then available groups and language groups.)

To install a group, use yum group install “group name”. Note that you may need quotes because most group names are two words. If you need to remove the group, just use yum group remove “group name”.

Want to learn more about a group? Just use yum group info with the group name.

Love the Yum Shell

If you’re going to be doing a lot of package management, you want to get to know the Yum shell.

Just run yum shell and you’ll be dumped in the Yum shell. (Which makes sense. It’d be weird if you got a DOS prompt or something…) Now you can run whatever Yum commands you need to until you’re ready to exit the Yum shell.

For instance, want to search packages? Just type search packagename.

Here’s the primary difference, when running things like install or remove, Yum will not complete the transaction immediately. You need to issue the run command to tell Yum to do it. This gives you the advantage of being able to tell Yum to do several things, and then actually run the transactions.

The Yum shell does have a few commands that aren’t available at the command line. For instance, you can use config to set configuration options, and ts will show you the transaction set or reset it. The repo command will let you list, enable, and disable repos.

If you’re not sure what commands the shell has, run help and check the yum-shellman page.

You can exit the Yum shell with exit or quit.

Use Yum Plugins

Yum isn’t a one-size-fits-all tool. It’s actually extensible, and has a plugin system that allows developers to create added functionality that doesn’t have to be added to the core of Yum.

This helps contribute to Yum’s performance by not including all functionality by default. If the user doesn’t need the plugin’s functionalty, why bog Yum down with it?

Different distributions have different plugins available, but the fastest way to see which Yum plugins available is to run yum search yum-plugin or yum search yum | grep plugin. (Note that a few plugins might not turn up with the first search, like yum-presto or yum-langpacks.)

Most likely, plugins are enabled by default. To be sure, though, open/etc/yum.conf and check that you have this line:


If it says plugins=0 you’ll need to change it.

View Changelogs

One of the plugins I’m fond of is the changelog plugin. If you have this installed you can view the changelogs for packages, even if they’re not installed.

To view a changelog just run yum changelog packagename or just changelog packagename if you’re in the Yum shell.

Yum Downgrade

Sometimes upgrades aren’t all they’re cracked up to be. If an upgrade has you down (sorry), you might want to try downgrading to the previous version.

To do this, just use yum downgrade name where “name” is either the package, group or other target that Yum will work with. (See the man page for the full list.

The caveat here is that it doesn’t work with some packages, like kernel packages. But if you’re in a pinch, give it a shot.

Via Linux

More contents in: , ,

About - Hey, this blog belongs to me! I am the founder of TechTipLib and managing editor right now. And I love to hear what do you think about this article, leave comment below! Thank you so much...