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?


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.)

  • Note 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. – James Antill Dec 10 '12 at 18:02
  • 1
    @JamesAntill, thanks for the hint, updated the answer accordingly. – maxschlepzig Dec 11 '12 at 10:01

Hmmm... I've checked it and

yum install openoffice*

works properly (wildcard is accepted)

  • 1
    The * should be escaped, or it could match a file in the current directory containing "openoffice" in its name. – WilQu Dec 6 '12 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.