Basics of URPMI in Mandriva

If you’ve ever used apt-get in Debian or Ubuntu, yum in Fedora, or zypper in Suse, you’ll know that the killer feature makes software installation and upgrades amazingly easy. What we need is a tool built on top of RPM that does all the automatic dependency stuff for you like apt does. The Mandriva distribution contains just such a tool: URPMI. This is probably Mandriva’s most under-advertised feature, and easily the most important feature. With it, RPM package management is as easy as apt-get under Debian.

Setting up URPMI sources

Before you can use URPMI productively, you need to set up some package sources. Each URPMI repository contains a whole bunch of packages and an index file; URPMI needs to know where both are.

For the “usual” Mandriva sources, there is the helpful command generator at EasyURPMI that will tell you exactly what command to type in to add a source. If you just want to add the usual sources and be done with it, you need look no further. What follows is helpful if you want to understand a bit better what is going on under the hood and exactly what those magical incantations do.

As an example, let’s add a source for the Mandrake contribs for 9.2. One location is at ftp://ftp.phys.ttu.edu/pub/mandrake/9.2/contrib/i586 and the hdlist is in the same place. We wish to name this source “contrib-ttu” The command is:

urpmi.addmedia contrib-ttu ftp://ftp.phys.ttu.edu/pub/mandrake/9.2/contrib/i586 with hdlist.cz

Most commands will look just like the above, with different ftp/http locations and possibly different paths. There are a few interesting but less commonly used options:

–distrib
Add all media from an installation medium
–update
Add an “update” medium (for MandrakeUpdate)
–from url
Use the url for a mirror list of possible locations

If you browse (via ftp or otherwise) some repository that you’d like to add, but you’re not sure what command you need to type in, it’s pretty easy to figure out what goes where:

  1. Look for the directory that contains a whole bunch of packages. This is the location
  2. Look for the corresponding hdlist file(s). These have names like hdlist.cz or similar. Typically this is in the same directory or reasonably nearby. The path must be a relative path. This is the hdlist
  3. Issue the command (as root):
    urpmi.addmedia mysource location with hdlist

Sometimes you have to hunt a level up or so in the tree to find a matching hdlist; the location for the updates hdlist is usually at ../base/hdlist.cz

The corresponding urpmi.removemedia command removes media.

Sources You Should Add

Every Mandriva/Mandrake user should have at least the following sources:

  • Original Installation CDs
    These should have been added automatically
  • Updates
    MandrakeUpdate should have added this for you
  • Mandriva/Mandrake Contribs
    This contains extra user-contributed packages and goodies. Most mirrors will carry contribs as well
  • PLF
    PLF contains various packages that were not included in Mandrake for various stupid legal reasons, such as DVD decryption (necessary for watching store-bought DVDs).
  • MandrivaClub Commercial
    If you are a member of MandrivaClub, you should also add the commercial software repository, for commercial products like Acrobat Reader.

Querying URPMI

With the right incantations, you can ask URPMI about your packages. The urpmq command lets you query the RPM database. The most useful commands are the following:

urpmq packagename
Asks whether URPMI has ever heard of packagename
urpmq –fuzzy name
Lists all known packages that sound vaguely like name
urpmq -i packagename
Displays summary and description of packagename
urpmq –list-media
Lists all known media

Installing Things

This is the easiest part: to install mypackage, we type:

urpmi mypackage

URPMI will automatically download and install mypackage, as well as anything that mypackage depends on. This is roughly equivalent to apt-get install mypackage

There are a number of advanced options worth knowing:

–update
Use only update media. Usually used for restricting the upgrades to security updates and the like.
–auto
Automatically installs dependencies without asking
–auto-select
Automatically upgrade all packages for which there are newer versions. In conjunction with –auto and –update, this allows you to automatically apply patches nightly and whatnot.
–noclean
Do not flush the RPM cache. You will find the RPMs in /var/cache/urpmi/rpms/
–allow-nodeps, –allow-force
If a dependency cannot be filled or there is a conflict, ask the user if he wants to shoot himself in the foot instead of refusing to go along with the insanity.
–fuzzy
Allow fuzzy search on the package name. If I mistype the package name, try to guess what I meant and ask me.

Keeping in Sync

URPMI works by maintaining a local index of all packages available on remote locations. This local list can get out of date and should be refreshed periodically by redownloading the remote list. This is easy:

urpmi.update -a

This will query every remote source and fetch the new lists if necessary.

Source

Related Posts

  • No Posts Found

Tags:

Leave a Reply