CentrioHost Blog

Stories and News from IT Industry, Reviews & Tips | Technology Blog


Using the Red Hat Package Manager (RPM)

Red Hat Package Manager:

The Red Hat distribution of Linux, including kernel, libraries, and applications are provided as RPM files. An RPM file, also known as a “package” is a way of distributing software so that it can be easily installed, upgraded, queried, and deleted. RPM files contain information on the package’s name, version, other file dependency information (if applicable), platform (such as Intel or Alpha, etc.), as well as default file install locations.

The RPM utility was first developed by Red Hat Package Manager and provided as an Open Source product as is common in the Linux community. Other developers picked it up and added extra functionality. The Red Hat Package Manager method of packaging files has become popular and is used not only on Red Hat’s but on some other distributions as well.

Popular Linux applications are almost always released as Red Hat Package Manager files, usually in fairly short order. However, in the Unix world the defacto-standard for package distribution continues to be by way of so-called “tarballs”. Tarballs are simply files that are readable with the “tar” utility. Installing from tar is usually significantly more tedious than using RPM. So why would people choose to do so? Unfortunately, sometimes it takes a few weeks for developers to get the latest version of a package converted to RPM (many developers first release them as tarballs).

If you start installing or upgrading your system or applications with tar, your Red Hat Package Manager database will become out-of-date and inconsistent. This isn’t really a big deal (when I used Slackware, I used tar exclusively — there was no other choice — without too much discomfort), but wherever possible I try to be patient and wait until an RPM becomes available, or perhaps send a polite request to the developer of the package. (You can also build your own RPM files and distribute them to others, which is sometimes helpful to developers who don’t have the ability or time to produce such files themselves.)

A really good place to check if a piece of software is available in RPM form is the RPM repository at http://rufus.w3.org/linux/RPM/. The repository provides indexed categories which can be helpful to locate a given RPM file, and contains pointers to thousands of such files.

To query a package, use “rpm -q pkg-name” (eg. “rpm -q pine”). RPM will either tell you what version of the package is already installed, or that the package is not installed.

Assuming the package is installed already, and is an earlier version than the update package you downloaded (which it should be), then you should be able to apply the update with “rpm -Uvh pkg-name”. If all goes well, the package will be automatically installed and immediately ready for use. If not, RPM will give you a pretty good reason (for example, perhaps a supporting package needs to be upgraded first). This may require a bit of thinking, but problems such as these are very straightforward to figure out.

If, on the other hand, the package is not yet installed, and you decide you wish to install it, type “rpm -ivh pkg-name”. If there are any supporting packages that are required, RPM will tell you.

Sometimes, you will want to install a Red Hat Package Manager that is only available in source format. In fact, unless you are installing packages from a trusted source (such as the Red Hat FTP site), you probably should install from source in case the binaries contain a trojan horse or other nasty thing (of course, a source RPM could also contain such a thing, but they are unlikely to because they would probably be exposed in short order by another developer).

The way to install a package from source is to specify the “rebuild” switch to the RPM utility. For example:

rpm -ivh --rebuild foo.src.rpm

The above command would configure and compile the “foo” package, producing a binary RPM file in the “/usr/src/redhat/RPMS/i386/” directory (assuming you are using Linux on the Intel platform). You can then install the package as you normally would.

Finally, if you are having problems getting a source package to compile (perhaps you need to modify a makefile, or change a configuration option, etc.) you can use the following steps (again, illustrating our ficticious “foo” package example) to compile the source, build a new binary package, and then install from the binary package:

rpm -ivh foo.src.rpm
cd /usr/src/redhat/SPECS
pico -w foo.spec

Make whatever changes you feel are needed to the “.spec” file, and then type:

rpm -ba foo.spec

This will rebuild Red Hat Package Manager package using whatever changes you have made to the “.spec” file. As above, the resultant binary RPM file will be located in “/usr/src/redhat/RPMS/i386/”, and can be installed as you normally would.

You should look at the Red Hat documentation for more information on RPM. It is an extremely powerful tool that is worth learning in finer detail. The best source of information on RPM is “Maximum RPM”, which is available in both book form, as well as in postscript format at http://www.rpm.org/maximum-rpm.ps.gz. (If you decide to print the postscript document, be advised that you’ll need a lot of paper to do so!) There is a smaller guide, the “RPM-HOWTO”, at http://www.rpm.org/support/RPM-HOWTO.html available as well.

Subscribe Now

10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!

Archive Calendar

SatSunMonTueWedThuFri
 12345
6789101112
13141516171819
20212223242526
27282930 

Over 20000 Satisfied Customers!

  • web hosting reviewer
    Valerie Quinn
    CTO, Acteon Group

    Centriohost staff were fantastic, I had a concern with a domain and they got back to me very quickly and they helped me to resolve the issue! ~ . . . Read more

  • Joomla hosting reviewer
    Collin Bryan
    Photographer, Allister Freeman

    I'm using centrio for my portfolio since 2006. The transition was seamless, the support was immediate, and everything works perfectly. ~ . . . Read more

  • dedicated server reviewer
    Harry Collett
    Actor, A&J Artists

    Very easy to understand & use even though I am not very technologically minded. No complications whatsoever & I wouldn't hesitate to recommend it to all. ~ . . . Read more

  • vps web hosting reviewer
    Porfirio Santos
    Technician, Diageo PLC

    Centrio support team have been amazingly responsive and helpful to any of my queries, thank you so much to the Centriohost have been amazingly responsive and helpful to any of my queries 👍👍👍 ~ . . . Read more

  • wordpress hosting plans reviewer
    Catherine Auer
    Doctor, SmartClinics

    Anytime I've had a problem I can't solve, I've found Centriohost to be diligent and persistent. They simply won't let an issue go until the client is happy. ~ . . . Read more

  • reseller hosting reviewer
    Effectivo Social
    Freelancer, Fiverr

    Recommend their shared hosting for all my SME web design clients. Their cloud or VME offerings are too great to deal with. Pricing is perfect and suitable for all users (͠≖ ͜ʖ͠≖) 👌 ~ . . . Read more

Top