5. Package Management through the Command Line

Rpmdrake applications are merely graphical interfaces to the powerful urpmi command line tools. For those wishing to control their packages via the command line (useful if you are working remotely, for example) we quickly present the most useful commands. Note that most commands require root privileges.

5.1. Installing and Removing Packages

This is done with two simple commands:

urpmi <package_name>

Will install package package_name if it exists or the package whose name contains the package_name string in it. If more than one package matches, you'll be presented a numbered list of matches: just type the number of the one you are interested in and tap Enter.

urpme <package_name>

Will remove the package package_name.

Consult the urpmi(8) and urpme(8) man pages to learn about the many options and behaviors of these two commands.

5.2. Media Management

Adding and removing media is easy on the command line but the syntax must be strictly respected.

5.2.1. Adding New Media

urpmi.addmedia <name> <url>

This command allows you to add a new medium either from a local drive, a removable device (CD-ROM), or from the network through the HTTP, FTP, NFS, ssh or rsync protocols. The syntax varies for each of these methods so you are encouraged to consult the urpmi.addmedia(8) man page before using it.

[Tip]Tip

If you are declaring a new update medium, use the --update option on your urpmi.addmedia command line.

[Tip]Tip

You don't know where to find new media containing useful applications specially packaged for your Mandrakelinux system? You can find some at the Easy Urpmi page. The Mandrakeclub also provides Urpmi media for test and contribution packages.

5.2.2. Removing Media

urpmi.removemedia <name>

This command will simply remove the medium name. If you cannot remember the medium's name, issuing urpmi.removemedia alone on the command line will list all defined media.

5.2.3. Updating Media

urpmi.update <name>

This command will scan the named medium and update the package list associated to it. This is useful for update media. If you wish to rescan all defined media you can simply run urpmi.update -a.

5.3. Tricks and Recipes

5.3.1. Finding the Package which Contains a Specific File

You know you need a specific file on your system but you do not know which package provides it... The urpmf utility will scan all media and find it for you[1]. Just run urpmf <filename> and any package(s) which contain it will be displayed.

You can even provide only a partial name. For example urpmf salsa will return a list of all packages which contain a file whose name contains the salsa name in it. Please note that this will only work for media that does not use synthesized hdlists.

[root@test queen]# urpmf salsa
	  kaffe:/usr/lib/kaffe/lib/i386/libtritonusalsa-1.1.2.so
	  kaffe:/usr/lib/kaffe/lib/i386/libtritonusalsa.la
	  kaffe:/usr/lib/kaffe/lib/i386/libtritonusalsa.so

5.3.2. Updating Packages

This command will automatically update all the packages that need it as Mandrakeupdate would do it:

urpmi.update -a; urpmi --update --auto-select --auto


[1] This is only true if you use the full hdlist files. If you use synthesis files, urpmf can only search for files on already installed packages