Installing yum packages by pattern
Solution 1
You can use shell globbing patterns as package names:
If no package matches the given package name(s), they are assumed to be a shell glob and any matches are then installed.
(from yum(8))
But you have to make sure that your shell does not consume your glob:
# yum install 'openoffice*'
Without the single quotes the shell expands the glob if your directory contains files whose filenames begin with 'openoffice'.
Alternative (inspect package list)
You can query all installable package that match openoffice*
via:
$ yum list available 'openoffice*'
To extract those package names you can use repoquery
:
$ repoquery --qf='%{name}' --pkgnarrow=available 'openoffice*'
Thus you could install those packages via:
# xargs yum install < output_from_prev_command.log
(Those steps give you the chance to inspect the list of all 'openoffice*' matching packages, e.g. to remove obvious unwanted packages.)
Solution 2
Hmmm... I've checked it and
yum install openoffice*
works properly (wildcard is accepted)
Related videos on Youtube
stiv
Please take a look at linkedin page if you are interested.
Updated on September 18, 2022Comments
-
stiv over 1 year
I want to install all openoffice packages. Passing openoffice* obviously wouldn't work, because it'd look at file system. How can I do that?
-
WilQu over 11 yearsThe * should be escaped, or it could match a file in the current directory containing "openoffice" in its name.
-
Erik5388 over 11 yearsNote that instead of using "yum list available" (which is meant to be UI and not necessarily usable from sed) you are much better off using repoquery --pkgnarrow=available.
-
maxschlepzig over 11 years@JamesAntill, thanks for the hint, updated the answer accordingly.