Get To Know Linux: Lesser Known RPM Options

Jack Wallen
Mar 19, 2009
Updated • Dec 28, 2012
Linux
|
1

Using Linux, in one form or another, then you have dealt with one package manager or another. Be it apt, urpmi, dpkg, or rpm, they all have the same goal: Make package management consistent and easy. Each of those tools even have a front-end (or two) to make the job even easier. But there are times when you simply can't beat the ol' tried and true command line. And when you do have to turn to the command line, it's nice to know you have the skills to tackle the task at hand.

I have touched on this topic before in my article "Installing From the Command Line". That was just grazing the surface. In this article you will learn a bit more about the rpm command line package management system.

As you may (or may not know) the structure of the RPM command is:

rpm {ARGUMENTS} [OPTIONS] filename

both ARGUMENTS and OPTIONS will depend upon what you are doing. The possibilities are:

  • Install: For installation you lead with the i argument (e.g. -ivh)
  • Upgrade: For upgrade you lead with the U argument (e.g. -Uvh)
  • Remove: For removal you lead with with the e argument (e.g. -evh)
  • Query: For querying if a package is installed lead with the (e.g. -q)

RPM also has some very important other tools and arguments that I want to focus on. Some of these arguments should only be used as a last resort and some of them could become necessary over time.

Special Upgrade or Install Arguments

There are some lesser known arguments for upgrading or installing worth mentioning. The first of these I want to mention is:

--oldpackage This argument allows you to replace a newer package with an older package. This can come in handy when a newer version of a package comes with bugs or removes features that you liked.

--nodeps This argument tells rpm to not do a dependency check before installing or upgrading a package. Use this wisely and sparingly or you will have packages that will not run. I take advantage of this argument when installing packages that have features (which depend upon packages not installed) that I do not want or need. But before using this I make sure my system meets all other dependencies.

--force This argument will force an install even if it conflicts with another package (the same package or another package). Using this argument can be dangerous and should be used only if you know for sure it will not break your system.

--test This will run a test transaction. No packages will actually be installed and all conflicts will be reported.

--nosignature This will not verify a package or package header signature before installing.

--excludedocs This will tell rpm to install the package but not the package included (if any) documentation.

Erasing Options

Here are some helpful erasing options.

--nodepsThis is the same as the installation version

--repackage This will repackage the application you are removing. Very handy if you decide you want to re-install the package.

Updating rpm database

One very important use of rpm is to rebuild the rpm database. I have had the rpm database become corrupt for one reason or another. At that point rpm will have trouble doing anything. When you find rpm not being able to execute tasks, one of the reasons will be a corrupt database. You will most likely see some sort of warning referencing a problem with the database. To fix this issue use the --rebuilddb option. This is used like so:

rpm --rebuilddb -v

and will take some time to complete.

Final Thoughts

And there you have it. A closer look at the rpm package manager with regards to lesser known arguments and options. I hope this helps you get to know the rpm system a little better.

Advertisement

Previous Post: «
Next Post: «

Comments

  1. Tobey said on March 19, 2009 at 11:04 pm
    Reply

    Thumbs up for the *.nix articles.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.