1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
|
=head1 NAME
urpmihowto - urpmi Advanced How-To
=head1 Basic notions
=head2 Packages and media
The urpmi suite of tools has for main purpose to download and to install
RPM packages easily.
Software packages often depend on each other; urpmi is able to recognize
those dependencies, to download missing required packages as needed, and
to remove conflicting packages if it needs to.
urpmi gets the list of available RPMs, and the RPMs themselves, from a
B<media>. Roughly speaking, a media is described by a name and by a
location, specified by an URL. Currently supported media types are: local
drives, removable drives (such as CDs), ISO images, and networked media
via different protocols (http, https, ftp, ssh and rsync). NFS mounted
directories are treated like local drives.
=head2 Installing and updating RPMs
The tool used to install RPMs is urpmi. Its basic usage is as follows:
urpmi <list of package names>
That prompts urpmi to fetch and install all packages and their unmet
dependencies from the media you have configured. In the process, urpmi
might ask a few questions. Notably, if some packages need to be upgraded,
or if some new (unspecified) packages should be installed, it will ask for
confirmation. If some packages need to be removed (due to conflicts with
the requested packages), urpmi will ask for confirmation as well. In some
cases, urpmi will also propose a choice between different alternatives,
usually proposing the "best" package as a default.
Another very useful mode of action for urpmi is to ask it to upgrade all
packages to the latest version found on the media. This is done by
urpmi --auto-update
urpmi can also help installing RPM files directly. Instead of using
C<rpm -i foobar.rpm>, you can pass the path to the rpm file to urpmi: it
will then try to resolve the needed dependencies.
Useful options to urpmi include:
=over 4
=item B<--auto>
automatic mode: urpmi will not ask questions and always select the default
choice.
=item B<--test>
tests the installation of packages, but do not actually install anything or
modify the system.
=item B<--media> I<media1,...,mediaN>
Use only the specified media, instead of defaulting to all available
media. You can also specify a substring of media names, and urpmi will
select all media that contain this substring. (For example,
urpmi --auto-update --media updates
will search updates from all media that have "updates" in their name.)
=back
See the urpmi(8) manpage for the complete reference of all options that
urpmi supports.
=head2 Removing RPMs
The tool used to deinstall RPMs is urpme. The command
urpme <list of package names>
will attempt to remove all listed packages, plus the packages that depend
on them. It will refuse to uninstall "important" packages (that is, the
ones that are part of the base system.)
See the urpme(8) manpage for the reference of all options urpme supports.
urpme will detect packages that are no longer used: for example, libraries
that no application requires. To remove them, use B<urpme --auto-orphans>
=head1 Media management
=head2 Adding media
urpmi is usable only when you have defined some media. Usually the OS
installation procedure configures a predefined set of media, which
correspond to the installation method you've selected: that might be
installation CDs, or an HTTP or FTP server if you installed from a
networked mirror, and so on. But you might want to add media yourself.
For that, you should use the urpmi.addmedia program. Its usage is as
follows:
urpmi.addmedia [options] <name> <url>
In this synopsis, C<< <name> >> is the name of the new media,
C<< <url> >> the URL where the RPMs are to be found.
Supported URLs can be C<http://>, C<https://>, C<ftp://>, C<rsync://>, C<ssh://> (this
will use rsync over ssh), C<file://>, and C<cdrom://>. If the media requires
authentication, you can use the usual URL syntax:
<scheme>://<login>:<pass>@host/path
Those credentials won't be stored in any world-readable file.
In some cases, if your media points at an external HTTP or FTP server, you
might want to use a proxy to access it. This is possible by using the
C<--proxy> and C<--proxy-user> options (the second one in case of your
proxy requires authentication.)
=head2 Removing media
This is straightforward; to remove a media C<foo>, simply use the
command:
urpmi.removemedia foo
=head2 Updating media
Some media never change; this is the case, for example, for CD-ROMs and
the like. However, some other ones -- typically updates -- grow; new RPMs
are added to them, and old ones are removed. Thus, before using them, from
time to time, 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
or update only media specifically named:
urpmi.update updates-one updates-two
=head2 Creating your own media
The easiest way to create your own media is to let urpmi.addmedia do it.
However, this will work well only if you have a small number of rpms,
stored on disk or on a shared NFS mount. To do that, assuming that your
RPMs are under a directory /var/my-rpms, simply enter the command:
urpmi.addmedia my-media /var/my-rpms
However, to create 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 C<rpmtools> package. It is able to generate a mirror tree for one or
several media.
A typical media repository, under a root directory F</ROOT/>, has the
following structure: (here, we have two media, named C<first> and
C<second>)
ROOT/ - media/
|- first/
| `- media_info/
|- second/
| `- media_info/
`- media_info/
The RPMs are place in the C<first> and C<second> subdirectories.
Repository metadata is contained in the top-level F<media_info> directory.
Per-media metadata are contained in the F<first/media_info> and
F<second/media_info> subdirectories.
Per-media metadata consists in an C<hdlist.cz> file, that contains the
gzipped headers of the RPMs in the media, a C<synthesis.hdlist.cz> file,
much smaller than the hdlist and that contains only the information
necessary to urpmi to resolve dependencies, and optionally a C<pubkey>
file if the RPMs are signed (so urpmi can check that the RPMs it downloads
are signed with the key associated to this media.)
Before using F<gendistrib>, you must create a file F<media_info/media.cfg>
to describe this media repository. The syntax of this file is reminiscent
of F<.ini> files. It contains one section per media: for example,
[first]
hdlist=hdlist_first.cz
name=First supplementary media
Here, C<first> is the directory name, C<hdlist_first.cz> is the name of
the hdlist file that will be created (it must end with C<.cz>), and
C<name=> gives a human-readable descriptive name for the media.
Then, you can run gendistrib. It should be passed the F</ROOT/> directory as
parameter. It will then generate the hdlist and synthesis files and all
other files needed for proper repository operation.
For further information, see the gendistrib(1) manpage.
=head1 Searching for packages
=head2 urpmf
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 to search through package
names, provides, requires, RPM descriptions, etc. (or several of those at
once.)
For example, to find all packages that begin with "apache-":
urpmf --name '^apache-'
(the ^ being the beginning-of-line anchor used in standard regular
expressions.)
To find all packages that contain files whose pathname 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.
=head2 urpmq
urpmq is a tool to query the urpmi database. It has several modes of
operation. Here are a couple of useful uses.
urpmq -i package
will list the information for that package (like C<rpm -qi> would do for
installed packages.) The C<--summary> option is similar, but gives only
one-line concise information.
urpmq --sources package
will give the URL from which the package can be retrieved.
urpmq --requires-recursive package
will give the list of all RPMs that are required by the specified package
(recursively).
Inversely, the command
urpmq --whatrequires package
will give the list of all RPMs that require the specified package.
See the urpmq(8) manpage for the list of all options.
=head1 urpmi-parallel
urpmi-parallel is an add-on to urpmi that is useful to install packages on
a network: it will run an urpmi command in parallel on a specified number
of hosts. In more detail, the machine you run the command on (the
"server") tests its result on each machine in the group in turn (the
"clients"), 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 is not necessary to
have media defined on these.
To use it, follow those steps:
=over 4
=item *
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).
=item *
install urpmi-parallel-ssh and/or urpmi-parallel-ka-run on the server
machine. The first plugin uses plain ssh to distribute commands to other
hosts, the second one uses ka-run, an efficient parallelization method on
top of any remote shell (rsh or ssh), adapted to clusters.
=item *
Edit /etc/urpmi/parallel.cfg to look something like this:
mynetwork:ssh:host1:host2:host3
On this line, C<mynetwork> is the name of the alias you'll use to specify
the network to urpmi, C<ssh> is the install method (to use C<ka-run>, look
up the entry for /etc/urpmi/parallel.cfg in urpmi.files(5)), and hostN are
the hostnames of all clients on your network. You can put C<localhost> in
this list.
=item *
Run the urpmi command: for example, to install "package_name":
urpmi --parallel mynetwork package_name
=back
=head1 Restricted urpmi
urpmi has a "restricted" 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 the one of urpmi, but it disallows installing
arbitrary RPMs: those are forcibly downloaded from a registered media.
A number of dangerous options, listed in the rurpmi(8) manpage, are also
forbidden.
=cut
|