First Time Linux

This section deals with using the urpmi and related tools to manage packages. Note that the urpmq and urpmf commands can be run by anyone, but root privileges are required to run urpmi.

Setting up urpmi

Before you can use all the benefits of urpmi, you have to tell it where the repositories are. There are dozens of repositories around the world, and usually it's a good idea to choose one geographically near you for quicker access. The easiest way to add repositories is directly using the "Add/Remove software gui", which prompts the first time you run it whether to add repositories or not. You can reconfigure at any time using the Media Manager under "Options". The main and contrib repositories are essential, and come with main_updates and contrib_updates for the associated fixes. The other good ones to know are the plf_free and plf_nonfree repositories which, although unofficial, provide a recognised way of adding patent-encumbered software (like libdvdcss or lame) which Mandriva cannot officially provide.

One disadvantage of using this automatic configuration is that it doesn't give you the opportunity to specify the full list (hdlist) or the smaller, compressed list (synthesis). If you want such finer control, you can use a web-based tool such as the ones at or - these use step-by-step instructions to choose the configuration and give you commands to copy/paste into a console.

Listing media

You can list the media currently being used with urpmq --list-url or see the list in the gui's media manager.

Updating packages

To keep up-to-date, it's worth checking the lists every now and again. From the gui, you can refresh the lists with the File->update media command, or from the console urpmi.update -a to update all the lists. It will only download a new list if the checksum indicates it has changed.

To update the packages based on the new lists, you can do this from the console with a fairly simple command: urpmi --auto-select --update. You can also do this from the gui but it's not intuitive.

Installing a new package

To find a new package, you can search for it in the gui or browse by category. From the console you can use the urpmq command to find the name of the package: urpmq packagename. If there are several packages which match the given name then a list will be shown.

To install a package or packages from the gui, just select the checkboxes and press "Apply"; from the console use the urpmi command: urpmi packagename. It could be that installing one package requires one or more other ones, in which case the additional selections will be confirmed. It could also be that a choice is required, when several packages offer the same dependency.

Removing a package

In the gui, just use the checkboxes and the "Apply" button. From the console, use the urpme command: urpme packagename. It could be that removing one package requires that other packages (which rely on it) also be removed, in which case the additional operations will be confirmed.

Listing installed packages

To check which rpms are already installed, you can use the rpm command to list all packages: rpm -qa but of course normally this list is very long. To search for a certain package, pipe the output of rpm into grep, for example: rpm -qa | grep -i office

Which package does a file belong to?

Sometimes you have a file but aren't sure to which package it belongs. Here the command is urpmf, so to find the package responsible for a given file you would do either urpmf kcalc (which will return a lot of results because it finds all files which begin with "kcalc"), or urpmf /usr/bin/kcalc which returns a single result. Note that if you have synthesis lists (rather than hdlists), the file information is missing from those compressed lists so it won't work. In this case the best way to find out is via a website like

Getting the information about a package

To get a package description, use urpmq -i, for example urpmq -i stellarium. This relies on having hdlists for the full description, if you're using synthesis lists then only basic information will be shown.

If you have downloaded an rpm file, you can also use the same trick, just giving the path to the rpm, like this: urpmq -i rpms/skype-

You can also see what files are inside the package with urpmi -l, for example urpmq -l barrage. Again, this requires either hdlists or a downloaded rpm file.

Downloading without installing

urpmi has the option --no-install which downloads all the rpms but doesn't install them. For example urpmi --no-install freemind. However this doesn't just get the package you ask for, it also gets the dependencies as well. If you just want to download a single rpm without its dependencies then see the following two entries "Where is a package located" and "Downloading single packages".

Where is a package located

To find the url which urpmi would use to download a package, use urpmq --sources, for example urpmq --sources inkscape. This won't download anything, just display the url where the package lives.

Downloading single packages

The easiest way to download a single package without its dependencies is to use wget and give it the url obtained from "Where is a package located" above. You can either copy-and-paste the result of the urpmq command into the wget command, or do the whole thing in one step with a bit of bash trickery: wget $(urpmq --sources freemind) - this does the urpmq and feeds the result into wget, downloading the url into the current directory.

Thanks to Steve Scrimpshire for this tip!

Extracting a file from a package

Having downloaded an rpm, you can extract the whole contents using the rpm2cpio and the cpio commands. The first converts the rpm into a cpio archive, and then the second extracts files from it. Using it like this: rpm2cpio package.rpm | cpio -div pipes the result of the first into the second, creating the tree of directories as it is in the rpm. You can then just select individual files without installing the rpm.

See also

The official Mandriva wiki has a very comprehensive page all about urpmi: Tools/urpmi. Also, Mandriva users have got a wiki page about this subject: Installing software using Urpmi.