Abstract
Once your server is installed, you may need to install or uninstall software. Mandriva Enterprise Server 5, offers two options to accomplish this task: the graphical Rpmdrake application (see Section 1.4, “Managing Software with Rpmdrake”), and the command-line tools. The latter is comprised of urpmi to install and upgrade software, urpme to remove RPM packages, urpmf and urpmq to search the RPM databases. These are all the underlying programs behind Rpmdrake.
In order to facilitate the installation of software packages, it is possible to create a repository of packages directly on the hard drive of your server.
Here's how to configure a local repository with graphical tools.
An icon representing the media appears on the desktop. Double-click on it to explore the contents of the DVD.
Copy the i586 directory
(or x86_64) on your hard drive to the desired location.
Once the copy is complete, run the Mandriva Linux Control Center.
There are 3 repository to configure :
Medium name : Mandriva - mes5 (Enterprise Server)
Medium path : /data/i586/media/main/
Medium name : Mandriva - mes5 (Enterprise Server) non-free
Medium path : /data/i586/media/non-free/
Medium name : Mandriva - mes5 (Enterprise Server) restricted
Here's how to configure a local repository with command lines.
Copy the i586 (or
x86_64) directory on your hard drive (for example in
/data):
cp -r /media/cdrom/i586 /data/
urpmi.removemedia -a
urpmi.addmedia "Mandriva - mes5 (Entreprise Server) main" file://data/i586/media/main/ urpmi.addmedia "Mandriva - mes5 (Entreprise Server) non-free" file://data/i586/media/non-free/ urpmi.addmedia "Mandriva - mes5 (Entreprise Server) restricted" file://data/i586/media/restricted/
urpmi.update -a
The main purpose of urpmi is to easily download and install RPM packages. RPM software packages often contain dependencies: urpmi recognizes those dependencies, downloads the required missing packages, and removes conflicting packages.
urpmi fetches the list of available RPMs and the RPMs themselves from a source media. Roughly speaking, a source media is described by a name and a location specified by an URL. Currently supported media types include local drives, removable drives (such as CDs), ISO images, and network media via different protocols (http, ftp, ssh and rsync). NFS mounted directories are treated like local drives.
Here's a description of the basic urpmi options:
urpmi <list of package names>
That prompts urpmi to fetch and install all packages and their unmet dependencies from the media you've configured. In the process, urpmi might ask questions. For example, if some packages need to be upgraded, or if some new (unspecified) packages have to be installed, that operation will require confirmation. If some packages need to be removed (due to conflicts with the requested packages), urpmi will also ask for confirmation. In some cases, urpmi will also propose a choice between different alternatives, usually proposing the “best” package as a default.
Another very useful urpmi feature is to upgrade all packages to the latest version found on the media. This is done with the following command:
urpmi --auto-update
urpmi can also install RPM files directly. Instead of using rpm -i foobar.rpm, you can pass the path of the RPM file to urpmi and it will then try to resolve the needed dependencies:
urpmi /home/user/foobar.rpm
Here are some useful options for urpmi :
Automatic mode: urpmi doesn't ask questions and always selects the default choice.
To test the installation of packages without actually installing anything or modifying the system.
This option forces urpmi to only use the specified media, instead of defaulting to all available media. You can also specify a substring of media names for urpmi to select all media containing that substring. For example, urpmi --auto-update --media updates will search updates from all media that have “updates” in their name.
urpmi is only usable when at least one media is defined. Usually, the OS installation procedure configures a predefined set of media, corresponding to the installation method you've selected: installation CDs, an HTTP or FTP server if you've installed from a networked mirror. System administrators often want to add media. To do so, use the urpmi.addmedia program:
urpmi.addmedia [options] <name> <url> [with hdlist]
In this synopsis, <name> is the name of the new media, <url> the URL where the RPMs are to be found, and the “with” parameter optionally specifies where to find the information file that describes the media's contents..
Supported
URLs can be http://,
ftp://, rsync://,
ssh:// (this will use rsync
over ssh), file://, and
removable://. removable://
works like file://, but instructs
urpmi that the directory is mounted from a
removable media, such as a CD or a
DVD. If the media requires authentication, you
can use the usual URL syntax:
<scheme>://<login>:<pass>@host/path
Those credentials will not be stored in any world-readable file.
In some cases, if your media points to an external HTTP or FTP server, you might want to use a proxy to access it. Use the --proxy and --proxy-user options (the second one is needed if your proxy requires authentication.)
This is straight forward. To remove a media named foo, simply use the command:
urpmi.removemedia foo
Some media never change. This is the case, for example, for CD-ROMs. However, other media, typically updates, grow. New RPMs are added and old ones are removed. Therefore, before using them you should instruct urpmi that their contents might have changed.
To do this, use the urpmi.update program. You can either update all media:
urpmi.update -a
You can also update only specifically named media:
urpmi.update updates-one updates-two
The easiest way to create
your own media is to let urpmi.addmedia do
it. However, this will work properly only if you have a small
number of RPMs, stored on disk or on a shared
NFS mount. To do this, assuming that your
RPMs are under a directory like
/var/my-rpms, enter the command below:
urpmi.addmedia my-media /var/my-rpms
To create a media containing a large number of RPMs, or to be put on a shared server, you'll need to use the gendistrib tool. It comes in the rpmtools package. It generates a mirror tree for one or several media.
A typical media repository,
under a root directory /ROOT/, has the
following structure, (we have two media, named
“first” and “second”):
ROOT/ - media/
|- first/
| `- media_info/
|- second/
| `- media_info/
`- media_info/
The RPMs are placed in the first and
second subdirectories. Repository metadata
is contained in the top-level media_info
directory. Per-media metadata is contained in the
first/media_info and
second/media_info subdirectories.
Per-media metadata consists
of an hdlist.cz file that contains the
gzipped headers of the media's RPMs, a
synthesis.hdlist.cz file (much smaller than
the hdlist) containing only the information necessary
for urpmi to resolve dependencies, and
optionally, a pubkey file if the RPMs are
signed (so that urpmi can check that the RPMs it
downloads are signed with the key associated to this
media.)
Before using
gendistrib, you must create a
media_info/media.cfg file to describe this
media repository. The syntax of this file is like that of
.ini files. It contains one section per
media:
[first] hdlist=hdlist_first.cz name=First
supplementary media
In the previous case,
first is the directory name,
hdlist_first.cz is the name of the
hdlist file that will be created (it must end
with .cz), and name= gives
a human-readable description of the media.
Then, you can run
gendistrib. You should pass it the
/ROOT/ directory as parameter. It will then
generate the hdlist and
synthesis files and all other files needed
for proper repository operation.
urpmi-parallel
is a useful add-on to urpmi to install packages on many
network hosts. It runs a urpmi command in parallel on a
specified number of hosts. More precisely, the machine you run the
command on (the server) tests the results on
each machine in the group (the “clients”) one by one,
downloads all necessary packages for all machines in the group,
distributes the appropriate packages to each machine, then calls
urpmi on the machine to do the actual installation.
urpmi must be installed on all client machines, but it's not necessary to have a media defined on client machines.
To use it, follow these steps:
Make sure you can
ssh from the server to each client machine as
root (you can use ssh-add
on the server host to avoid entering your passphrase and/or
password many times).
Install urpmi-parallel-ssh or urpmi-parallel-ka-run on the server machine. The first plugin uses plain ssh to distribute commands to other hosts, while the second one uses ka-run, an efficient parallelization method on top of any remote shell (rsh or ssh), adapted to clusters.
Edit
/etc/urpmi/parallel.cfg to look like
this:
mynetwork:ssh:host1:host2:host3
On this line,
mynetwork is the name of the alias you will
use to specify the network to urpmi,
ssh is the install method (to use
ka-run, look up the entry for
/etc/urpmi/parallel.cfg in urpmi.files(5)),
and hostN are the host names of all clients on your network. You
can put localhost in this list.
Run the urpmi command: for example, to install “package_name”:
urpmi --parallel mynetwork package_name
urpmi has a more
secure counterpart: rurpmi. It is similar to
urpmi, but has a stripped-down set of features. It's
intended to be used by users without root
privileges, but with sudo rights on it,
preventing any abuse of this tool to compromise the system.
Its syntax is similar to urpmi, but it prevents installing arbitrary RPMs. They need to come from a registered media. A number of dangerous options, listed in the rurpmi(8) manpage, are also forbidden.
The tool used to uninstall RPMs is urpme. For example:
urpme <list of package names>
This will attempt to remove all listed packages and the packages that depend on them. It will refuse to uninstall “important” packages (the ones that are part of the base system).
See the urpme(8) pmanpage for the
reference of all options urpme supports.
Note that urpme isn't able to detect packages that are no longer used. For example, libraries not used by applications. To clean them up, a handy tool is rpm-find-leaves. It will list all RPMs on your system that no other package requires.
urpmf is a grep-like tool for the urpmi database (the database of all RPMs in the media). By default, it will search through the file names contained in packages, but a variety of options allows more advanced searches.
For example, to find all packages that begin with
apache- :
urpmf --name '^apache-'
The ^ is the beginning-of-line
anchor used in standard regular expressions.
To find all packages that contain files whose path name
includes
/etc/httpd.conf.d :
urpmf /etc/httpd.conf.d
To find all packages that provide
mail-server with their version and release
number (-f) :
urpmf --provides -f mail-server
See the urpmf(8) manpage for more examples and the list of all options.
The urpmq tool allows you to query the urpmi database. It has several modes of operation. Here are a couple of interesting uses:
urpmq -i package
It lists the information for that package (like rpm -qi would do for an installed package). The --summary option is similar, but only gives one-line, concise information.
urpmq --source package
This returns the URL where the package can be retrieved from.
urpmq -d package
It gives the list of all RPMs that are required by the specified package (recursively).
Inversely, the urpmq -R package returns the list of all RPMs that require the specified package.
The urpmi set of tools is command-line based. You can also use a graphical tool called Rpmdrake. It consists of different components which you access by choosing one of the entries of the ++ menu in the main menu, or by clicking on Software Management in the Mandriva Linux Control Center.
We recommend that you access Rpmdrake via the Mandriva Linux Control Center.
When launched, Rpmdrake searches the database of available packages. Then the Software Packages Installation interface is displayed.
The upper part of the window allows you to manipulate the list of packages you can install. This list is in the middle-left of the window. On its right is an area where the currently selected package is described. At the bottom of the window are two buttons and information about the space required to install the selected packages, as well as how much space is available on your disk.
![]() |
Note |
|---|---|
Additionally, a status bar in the lower part of the window displays messages about actions currently in progress or completed. |
In Figure 5.5, “The Software Package
Installation interface”, the
samba-3.2.7-0.3mdv2009.0 package is
selected in the tree-view. In the package-description are shown
the required disk space, a short summary (“Samba
(SMB) server programs”), as well as a detailed description.
The status bar displays the disk space required by the selected packages, as well as the current free space. Please note that due to dependencies, the disk space required by the selected packages might be greater than the size required by the chosen package itself.
![]() |
Note |
|---|---|
Rpmdrake shows you an alert box if you try to install more software than the available disk space. Delete files you no longer use to proceed with the installation. |
Now you can begin the installation by clicking on the button. A new window appears, showing you a progress bar of how your installation is proceeding. If you prefer to leave without doing anything, click the button.
While selecting applications to install, it may happen that you choose a package which requires dependencies (additional libraries or another tool) to work correctly. In this case, Rpmdrake displays an information window enabling you to choose whether to accept the selected dependencies, or to the operation (Figure 5.6, “Rpmdrake Dependency Alert Box”).
Let's say you want to install a package which requires dependencies, and various packages are capable of providing that dependency. The list of alternatives is then presented. You may read the additional information presented by clicking the button to help you choose the best alternative.
We will now take a closer look at the search and sort functions provided to ease your job as a system administrator:
To search for a specific package, just type its name (or part of the name) in the text area next to the button. Then choose from the pull-down list where you want to look for it (either in the package name, in the description provided with the package or in the names of the files stored in the packages). After clicking on the button, a new list appears (Search results), showing you the results Rpmdrake found while scanning the package databases.
Let's look at the different sort orders:
Shows the list of packages in the four groups you saw during the installation process. This is the easier sort order because it focuses on a selected part of the available packages: those considered to be the most useful.
Displays a flat list of all available packages you can install.
Shows the list of packages grouped by function (e.g. games, system, video, etc.).
Shows a flat list in which all selected packages are displayed first. The other available packages are listed below.
Displays packages alphabetically and under the name of the data medium they belong to (see Section 1.4.4, “The Software Media Manager”).
Might show two groups of packages: one for packages you can install, and a second list of packages for which an older version is already installed.
This interface works like the “Install Software” one, so we won't repeat its basic functions (Section 1.4.1, “Install Software”).
When you launch Mandriva Linux Update, it first asks you to choose an Internet repository to check for updates. You should choose one in a country near you.
A small difference to the “Install Software” interface is the ability to choose the kind of update you want to install by grouping them in certain ways. You may select:
The other difference is a new text section (“Reason for update”) inside the package description area. It tells you why this update was made available. This may help you decide if you want to update certain packages or not. When you have a slow Internet connection or you have to pay per MB when you are downloading, it would be wise to read it.
This part of Rpmdrake is dedicated to the configuration of the package media repositories. As you can see in Figure 5.7, “The Software Media Manager”, some media are configured: “Main”, “Contrib”, etc. With this tool you can add other software media: a CD from a magazine containing RPMs, a Web repository, etc.
The checkboxes in the left-hand column allow you to flag the repositories:
Uncheck this box to temporarily disable the corresponding medium. The packages contained in this medium won't be available for installation until you enable the medium again.
This box must be checked for update media, that is, media that contain updates of packages that are already installed on your machine, but with an older version number. Therefore only update media are taken into account when looking for updates.
Various buttons allow you to perform actions on the selected media.
Allows you to remove a medium which you no longer use. Simply select the medium to be removed in the list and click on .
Enables
you to change the URL or the relative path to the
synthesis/hdlist file.
Click the button to configure a proxy server. Note that you can also define a global proxy for all remote media through the main interface's button.
This option also
allows you to change from using hdlist
files to synthesis files.
Permits you to add all publicly available official package sources from Internet repositories. This is useful if you have a fast Internet connection or you only have the first installation CD at hand. Choosing a mirror geographically near to your location is recommended.
After choosing a mirror and clicking , package information for the source you chose is downloaded and all included packages will be available for you to install and update your system.
Shows a list of already defined media. With it, you can choose the ones from which you want to update the list of available packages. This is useful for remote media to which new packages are being added. Just start the process by clicking on .
It is important that any new package you install is authenticated. To do so, each package can be electronically signed with a “key”, and you can allow/disallow keys on a per-medium basis. In Figure 5.8, “Managing Keys ”, Mandriva Linux key is allowed for medium Installation CD. Click on to allow another key for the selected medium, and on to remove a key from the selected medium.
If you are sitting behind a firewall and you still need to access remote media (especially for package updates), you can do so if you have a proxy server which leads to the Internet (at least in an area where you can find a package server). Normally, it should be enough to fill in the Proxy hostname to get it working (Figure 5.9, “Configuring a Proxy server”). If you need a user/password combination to get through the proxy, you can also specify it here. Just confirm your changes by clicking and you're done.
If you
run a large network of computers, you may want to install a
package on all the computers in parallel. This button opens a
dialog window allowing the configuration of the
“Parallel” mode. See the
urpmi(8) manpage for more
information.
Allows you to configure the program used to download new packages and if the source should be checked against a given key. These choices are used on all installed sources.
Enable you to change the order in which sources are used when installing packages.
By using Rpmdrake's parallel mode, you can
define groups of machines to install the same software packages
on. This greatly simplifies managing a large number of systems,
such as in a LAN. Make sure park-rpmdrake,
urpmi-parallel-ssh and
urpmi-parallel-ka-run are installed.
![]() |
Note |
|---|---|
This tool is accessible only in expert mode. Choose → from the menu and then access the Software Management section of Mandriva Linux Control Center. |
Click on , provide a Name for the group, select the Protocol to use (ssh in our example), check the networks to be scanned for hosts in the list or add other networks. By default, only your local network is listed. Then click on .
Wait a few minutes until the network scan finishes and then check the hosts to be made part of the group.
You are then asked for
root's password on each of the selected hosts to automate
the installation of packages on them.
![]() |
Note |
|---|---|
For package installation or removal in a specific group to succeed, all computers in that particular group must be available. |
Select the group and click the button. You can now install packages on the selected computers group, as you would on a single computer.
You can also install packages on the computers' group from the command line:
urpmi --parallel <group_name> <package_name>
For example, issuing
urpmi --parallel GraphicDesign gimp will
install GIMP on all computers which are part of the
GraphicDesign group.
To remove a package from a computer group, use:
urpme --parallel <group_name> <package_name>
For example, issuing
urpme --parallel GraphicDesign gcc will remove
the C compiler from all computers which
are part of the GraphicDesign group.