A tutorial that explains Mandriva's specific tool, URPMI.

Mar 7, 2007 10:47 GMT  ·  By

One of the tools that made modern Linux so much easier to use is - without a doubt - the package manager. A package manager enables you to install a piece of software, a driver or a library in a matter of seconds. The secret consists in the way software packages are distributed via repositories: they are already compiled and ready to use. This way, you don't have to go through the lengthy process of downloading the source code archive, compile and install it. Nowadays, every modern Linux distribution has its own package manager, either specific or borrowed, it doesn't matter. It's there and it works. Just like Fedora has yum and Ubuntu has apt-get, Mandriva has URPMI. This tool allows a better and easier package management and helps you find a way out of the dependency problems many inexperienced users complain about during the specific Linux install process, installation from sources. This guide will explain the most used functions of URPMI and how to use them efficiently.

urpmi.addmedia

This command enables you to add urpmi repositories. The Mandriva Linux ftp mirrors must contain:

. main, which contains most programs . contrib, which contains optional programs . update, which fixes program's security and functionality problems

A lot of mirrors and hdlists for the mentioned packages are available on the Internet; however, the best way is to use forms like these ones: EasyURPMI , smart-URPMI or Mandriva Module Finder. Choosing other media than the tree mentioned is totally up to you, but at least read the info for each additional media you're planning to add just to make sure it's what you really want or need.

After following the wizard on one of the websites, you will be presented with an output like:

urpmi.addmedia main ftp://mirr.or/MandrivaLinux/official/2007.0/i586/media/main/release with media_info/hdlist.cz urpmi.addmedia contrib ftp://mirr.or/MandrivaLinux/official/2007.0/i586/media/contrib/release with media_info/hdlist.cz

Simply open a terminal, switch to user root ($ su -) and copy/paste each line, one at a time. Moreover, if you have added a few custom or unknown repositories, check the urmi.removemedia command to see how to clear the repositories list.

urpmi.removemedia

After using the repositories for a while, it's possible to dislike one of them because of the software it's offering or the low connection it's on. Therefore, to remove a media, use the command:

# urpmi.removemedia media-name

Moreover, if you're adding the sources for the second, third or 63rd time, it's recommended to use the following command before adding the sources so you'll have a nice and clean URPMI setup:

# urpmi.removemedia -a

urpmi.update

This command will update the media sources and fetch the latest version available of your installed programs. The urpm.update command should be used right after a fresh Mandriva installation but also, once in a while, using a cron job.

To update ALL media: [CODE=0] # urpmi.update -a [CODE=

To add the command in a cron job:

- Make sure you're logged in as root. - Create a new file:

# vi /etc/cron.daily/auto-update

- Paste the following lines in it and save it:

#!/bin/bash urpmi.update -a urpmi urpmi urpmi --auto --auto-select

(if you don't know how to use vi, after you've ran the command, press the INSERT key, to paste the lines press Shift + INSERT, press ESCAPE, to write file to disk press Shift + ; then press wq and ENTER)

- Now make the file executable:

# chmod 755 /etc/cron.daily/auto-update

Other useful commands:

- Update all packages but don't remove any, just show what went wrong:

# urpmi --keep --auto --auto-select

- Search for what needs to be updated and prompt for yes or no:

# urpmi --auto-select

urpmi

This command is the main package management command which is used to install the packages. It will search through the sources for the package you specified and will prompt you for any additional dependencies it needs. If you accept, the program and its eventual dependencies will be automatically downloaded and installed. You can specify one or more packages to be installed:

# urpmi ncftp

or

# urpmi wget elinks gaim liferea

urpme

This is the command used for removing the packages, including all their dependencies. The package.name must have one of the forms name, name-version, name-version-release, or name-version-release.architecture. You will also have the change to abort the process.

# urpme gaim

You can also specify package names more broadly. For example, you can uninstall all programs that start with gnome- (not recommended, though).

# urpme -a kde

urpmf

This command is used to find any files you might want. For example, when compiling a source package, it's possible to receive a dependency error and the compilation to abort with message libfile.h missing. You can install that file using urpmf:

# urpmf libfile.h

urpmq

This command is used to query the RPM database. You can use this command to find various info about the packages you have installed. There's also the --fuzzy option which will return the default package, as well as other packages which include the same name also:

# urpmq kernel --fuzzy

will output: kernel-2.6.21 kernel-source-2.6.21 kernel-legacy-2.6.21