zypper

Langue: en

Autres versions - même langue

Version: 52193 (openSuse - 09/10/07)

Section: 8 (Commandes administrateur)

SYNTAX

zypper [--global-options] <command> [--command-options] [command-arguments]

zypper --help [command]

DESCRIPTION

zypper is a command-line interface to ZYpp system management library. It can be used to install, update, remove software, manage repositories, perform various searches, and more.

COMMANDS

zypper provides a number of commands. Each command accepts the options listed in the GLOBAL OPTIONS section. In addition, many commands have specific options, which are listed in this section.

General Commands

shell (sh)
Starts a shell for entering multiple commands in one session. End it by "exit", "quit", or Ctrl-D.

Package Management Commands

zypper works with several types of resource objects, called resolvables. A resolvable is a package, patch, pattern, language, or a product.

package - all RPM packages including patch and delta packages
patch - update of the packages, it can include special scripts and messages
pattern - group of packages
language - group of packages with language support
product - group of packages, which are necessary to install a product

info (if) <name> ...
Displays full info for the specified packages.
install (in) [options] <name> ...
install (in) [options] --capability <capability> ...
Install or update packages or other resolvables.

The resolvables can be selected by their name or by a capability they provide.

Capability is: NAME, or "NAME[OP<EDITION>]", where OP is <, <=, =, >=, or > and EDITION is VERSION[-RELEASE], for example: zypper=0.8.8-2.

The NAME component of a capability is not only a package name but any symbol provided by packages: /bin/vi, libcurl.so.3, perl(Time::ParseDate). Just remember to quote to protect the special characters from the shell, for example: zypper\>0.8.10 or 'zypper>0.8.10'

If EDITION is not specified, the newest available version will be installed. This also means that if the package is already installed and newer versions are available, it will get upgraded to the newest one.

-r, --repo <alias>
Install resolvables only from the repository specified by the alias.
-t, --type <resolvable_type>
Type of resolvable (default: package)
-n, --name
Select resolvables by their name (default).
-f, --force
Install even if the item is already installed (reinstall)
-n, --capability
Select resolvables by capabilities.
-l, --auto-agree-with-licenses
Automatically say 'yes' to third party license confirmation prompt. By using this option, you choose to agree with licenses of all third-party software this command will install. This option is particularly useful for administators installing the same set of packages on multiple machines (by an automated process) and have the licenses confirmed before.
--debug-solver
Create solver test case for debugging. Use this option, if you think the dependencies were not solved all right and attach the resulting /var/log/zypper.solverTestCase directory to your bug report. To use this option, simply add it to the problematic install or remove command.
source-install (si) <name> ...
Install source packages specified by their names.

This command will try to find the newest available versions of the source packages and use rpm -i to install them.

list-updates (lu) [options]
List available updates.
-t, --type <resolvable_type>
Type of resolvable (default: patch)
-r, --repo <alias>
List only updates from the repository specified by the alias.

See also the NOTE at update.

remove (rm) [options] <name> ...
remove (rm) [options] --capability <capability> ...
Remove packages or other resolvables.

The resolvables can be selected by their name or by a capability they provide. For details see the install command

-r, --repo <alias>
Operate only with resolvables from repository specified by alias.
-t, --type <resolvable_type>
Type of resolvable (default: package)
-n, --name
Select resolvables by their name (default).
-n, --capability
Select resolvables by capabilities.
--debug-solver
Create solver test case for debugging. See the install command for details.
update (up) [options]
Update all installed packages or other resolvables with patches or their newer versions, where applicable. To update individual packages, use zypper install <name> (see documentation of the install command for details).
-t, --type <resolvable_type>
Type of resolvable (default: patch)
-r, --repo <alias>
Limit updates to repository specified by alias.
--skip-interactive
This will skip interactive patches, that is, those that need reboot, contain a message, or update a package whose license needs to be confirmed.
-l, --auto-agree-with-licenses
Automatically say 'yes' to third party license confirmation prompt. By using this option, you choose to agree with licenses of all third-party software this command will install. This option is particularly useful for administators installing the same set of packages on multiple machines (by an automated process) and have the licenses confirmed before.

NOTE: Zypper prefers to update only those packages for which a patch description exists, like on the SUSE update servers. To operate on all packages for which there is a better version instead, select --type package which is also the default in rug compatibility mode.

search (se) [options] [querystring] ...
Search for resolvables matching given strings. * (any substring) and ? (any character) wildcards can also be used within search strings.
Results of search are printed in a table with following columns: S (status), Catalog, Type (type of resolvable), Name, Version, Arch (architecture). Status column can contain following values: i - installed, v - another version installed, or an empty space for neither of the former cases.
In rug compatibility mode the --type option defaults to package. Furthermore, Instead of the Type column, rug's Bundle column is printed, however, with no contents.
This command accepts the following options:
--match-all
Search for a match to all search strings (default).
--match-any
Search for a match to any of the search strings.
--match-substrings
Matches for search strings may be partial words (default).
--match-words
Matches for search strings may only be whole words.
--match-exact
Searches for an exact name of the resolvable.
-d, --search-descriptions
Search also in summaries and descriptions.
-i, --installed-only
Show only resolvables that are already installed.
-u, --uninstalled-only
Show only resolvables that are not currently installed.
-t, --type <type>
Search only for resolvables of specified type. See the beginning of the subsection for the list of available resolvable types. Multiple -t option are allowed.
-r, --repo <alias>
Search only in the repository specified by the alias. Multiple -r options are allowed.
--sort-by-name
Sort resolvables by name (default).
--sort-by-repo
Sort resolvables by catalog, not by name.

Patch Management

patch-check (pchk)
Check for patches. Displays a count of applicable patches and how many of them have the security category.

See also the EXIT CODES section for details on exit status of 0, 100, and 101 returned by this command.

-r, --repo <alias>
Check for patches only in the repository specified by the alias.
patches (pch)
List patches. Lists all patches that are available, including installed and not applicable ones.
-r, --repo <alias>
Check for patches only in the repository specified by the alias.
patch-info <name> ...
Displays full info for the specified patches.
-r, --repo <alias>
Work only with the repository specified by the alias.
 

Repository Management

zypper is able to work with YaST, YUM, and aptrpm repositories, ZENworks 7 Linux Management, ZENworks 6.6.x Linux Management servers, as well as local files.

addrepo (ar) [options] <URI> <alias>
Add a new repository specified by URI and assign specified alias to it.
-r, --repo <FILE.repo>
Read URI and alias from specified .repo file
-t, --type <TYPE>
Type of repository (yast2, rpm-md, or plaindir). There are several aliases defined for these types: yast2 - susetags, yast, YaST, YaST2, YAST; rpm-md - repomd, rpmmd, yum, YUM; plaindir - Plaindir.
-d, --disabled
Add the repository as disabled.
-n, --no-refresh
Add the repository with auto-refresh disabled.

NOTE: This command does not automatically refresh the newly added repositories. You have to use the refresh command after finishing your modifications to repositories with *repo commands.

removerepo (rr) [options] <alias|URI>
Delete repository specified by alias or URI.
--loose-auth
Ignore user authentication data in the URI
--loose-query
Ignore query string in the URI
repos (lr)
List all defined repositories.
The following data are printed for each repository found: # (repository number), Enabled (whether the repository is enabled), Refresh (whether autorefresh is enabled for the repository), Type (rpm-md, yast2, plaindir), Alias (shorthand for Name), and Name. If -v global option is used, an additional URI column will be displayed containing the base URI of the repository.
Repository number is a unique identifier of the repository in current repository set. If you add, remove or change a repository, the numbers may change. Beware of that when using the numbers with the repository handling commands (although not possible right now, the feature will be reimplmented soon). On the other hand, using the alias instead of the number is always safe.
-e, --export <FILE|->
This option causes zypper to write repository definition of all defined repositories into a single file in repo file format. If '-' is specified instead of a file name, the repositories will be written to the standard output.
renamerepo (nr) <alias> <new-alias>
Assign new alias to the repository specified by alias.
modifyrepo (mr) <options> <alias>
Modify properties of the repository specified by alias.
-e, --enable
Enable the repository.
-d, --disable
Disable the repository.
-a, --enable-autorefresh
Enable auto-refresh for the repository.
--disable-autorefresh
Disable auto-refresh for the repository.
refresh (ref) [alias|#] ...
Refresh repositories specified by their alias or number. If no repositories are specified, all enabled repositories will be refreshed.
See also METADATA REFRESH POLICY section for more details.
-f, --force
Force a complete refresh of specified repositories. This option will cause both the download of raw metadata and parsing of the metadata to be forced even if everything indicates a refresh is not needed.
-b, --force-build
Force only reparsing of cached metadata and rebuilding of the database. Raw metadata download will not be forced.
-d, --force-download
Force only download of current copy of repository metadata. Parsing and rebuild of the database will not be forced.
-B, --build-only
Only parse the metadata and build the database, don't download raw metadata into the cache. This will enable you to repair damaged database from cached data without accessing network at all.
-D, --download-only
Only download the raw metadata, don't parse it or build the database.

GLOBAL OPTIONS

-h, --help
Help. If a command is specified together with --help option, command specific help is displayed.
-V, --version
Print zypper version number and exit.
-v, --verbose
Increase verbosity. For debugging output specify this option twice.
-q, --quiet
Suppress normal output. Brief (esp. result notification) messages and error messages will still be printed, though. If used together with conflicting --verbose option, the --verbose option takes preference.
-t, --terse
Terse output for machine consumption.
-s, --table-style
Specifies table style to use. Table style is identified by an integer number. TODO
-r, --rug-compatible
Turns on rug compatibility. See section COMPATIBILITY WITH RUG for details.
-n, --non-interactive
Switches to non-interactive mode. In this mode zypper doesn't ask user to type answers to various prompts, but uses default answers automatically. The behaviour of this option is somewhat different than that of options like '--yes', since zypper can answer different answers to different questions. The answers also depend on other options like '--no-gpg-checks'.
--no-gpg-checks
Ignore GPG check failures and continue. If a GPG issue occurs when using this option zypper prints and logs a warning and automatically continues without interrupting the operation. Use this option with causion, as you can easily overlook security problems by using it.
-R, --root <dir>
Operates on a different root directory.

METADATA REFRESH POLICY

Zypper works with the metadata (information extracted from the RPM packages and other data) stored within repositories. The following refresh (metadata update) policy has been established in order to ensure zypper is working on the up-to-date metadata.

Refreshing a repository means downloading metadata of resolvables from media (if needed), storing it in local cache (typically under /var/cache/zypp/raw/<alias> directory) and preparsing the metadata into an sqlite database (/var/cache/zypp/zypp.db).

The metadata get refreshed either automatically or on user request. An automatic refresh takes place right before reading metadata from the database if the autorefresh is enabled for the repository and the metada is reported as being out of date. If the autorefresh is disabled, the repository will only be refreshed on user request. You can request a refresh by calling zypper refresh (see the documentation of the refresh command for details).

The status of the repository metadata is checked for changes before actually doing the refresh. A change is detected by downloading one or two metadata index files (small files) and comparing the checksums of the cached ones and the remote ones. If the files differ, the repository is out of date and will be refreshed.

To delay the up-to-date check (and thus the automatic refresh) for a certain number of minutes, edit the value of the repo.refresh.delay attribute of ZYpp config file (/etc/zypp/zypp.conf). This means, zypper will not even try to download and check the index files, and you will be able to use zypper for operations like search or info without internet access or root privileges.

LOCKS

The file /etc/zypp/locks can contain a list of packages to be locked. These will not be updated or removed by the solver.

Empty lines and lines beginning with # are ignored. Each line is of the form "PATTERN [ OP EDITION ]" where PATTERN is a name with shell wildcards ? and *, OP is one of < <= = >= >, and EDITION is VERSION[-RELEASE].

Example:
# Don't update the old KDE
kde* < 3.5

FILES

/etc/zypp/repos.d
Directory containing repository configuration (*.repo) files. You can use the repo commands to manipulate these files, or you can edit them yourself. In either case, after doing the modifications, executing zypper refresh is strongly recommended.
/etc/zypp/zypp.conf
ZYpp configuration file.
/etc/zypp/locks
File with package lock definitions, see the section LOCKS.
/var/cache/zypp/raw
Directory for storing raw metadata contained in repositories.
/var/cache/zypp/zypp.db
Sqlite database file containing pre-parsed metadata of all repositories.
~/.zypper_history
Command history for the shell.

EXIT CODES

There are several exit codes defined for zypper for use e.g. within scripts. These codes are defined in header file src/zmart.h found in zypper source package. Codes from interval (1-5) denote an error, numbers (100-103) provide a specific information, 0 represents a normal successfull run. Following is a list of these codes with descriptions.

0 - ZYPPER_EXIT_OK
Successfull run of zypper with no special info.
1 - ZYPPER_EXIT_ERR_BUG
Unexpected situation occured, probably caused by a bug.
2 - ZYPPER_EXIT_ERR_SYNTAX
zypper was invoked with an invalid command or option, or a bad syntax.
3 - ZYPPER_EXIT_ERR_INVALID_ARGS
Some of provided arguments were invalid. E.g. an invalid URI was provided to the addrepo command.
4 - ZYPPER_EXIT_ERR_ZYPP
A problem reported by ZYPP library. E.g. another instance of ZYPP is running.
5 - ZYPPER_EXIT_ERR_PRIVILEGES
User invoking zypper has insufficient privileges for specified operation.
100 - ZYPPER_EXIT_INF_UPDATE_NEEDED
Returned by the patch-check command if there are patches available for installation.
101 - ZYPPER_EXIT_INF_SEC_UPDATE_NEEDED
Returned by the patch-check command if there are security patches available for installation.
102 - ZYPPER_EXIT_INF_REBOOT_NEEDED
Returned after a successfull installation of a patch which requires reboot of computer.
103 - ZYPPER_EXIT_INF_RESTART_NEEDED
Returned after a successfull installation of a patch which requires restart of the package manager itself. This means that one of patches to be installed affects the package manager itself and the command used (e.g. zypper update) needs to be executed once again to install any remaining patches.

COMPATIBILITY WITH RUG

zypper is designed to be compatible with rug, which is a command-line interface to the ZENworks Linux Management (ZLM) agent. Compared to rug, zypper does not need the ZLM daemon to run, and is intented to provide more and improved functionality. Following is a list of zypper-rug command aliases, supported rug command line options, and compatibility notes. See also compatibility notes in descriptions of zypper commands.

To enable rug compatible behaviour, use the -r or --rug-compatible global option with each command.

Service Management Commands

ZENworks distinguishes services and catalogs. A service is added by URI and contains one or more catalogs. Libzypp does not have this distinction (yet) but for compatibility it is able to use the same command and option names (service-add, --catalog) as rug.

Currently, a Repository in zypper is a synonym for both Service and Catalog in ZLM.

rug service-add (sa)
zypper addrepo (ar)
rug service-delte (sd)
zypper removerepo (rr)
rug service-list (sl)
zypper repos (lr)

 zypper doesn't include 'Enabled' and 'Refresh' columns and prints rug's 'Status' column with values "Active" or "Disabled" instead.

Package Management Commands

rug install (in)
zypper install (in)
-y, --no-confirm
Don't require user interaction. This option is implemented using zypper's non-interactive mode.
--agree-to-third-party-licenses
This option is an alias to zypper's --auto-agree-with-licenses option.
rug remove (rm)
zypper remove (rm)
-y, --no-confirm
Don't require user interaction. This option is implemented using zypper's non-interactive mode.
rug update (up)
zypper update (up)
-y, --no-confirm
Don't require user interaction. This option is implemented using zypper's non-interactive mode.
--agree-to-third-party-licenses
This option is an alias to zypper's --auto-agree-with-licenses option.
rug search (se)
zypper search (se)
--sort-by-catalog
Sort resolvables by catalog, not by name. This option is an alias to zypper's --sort-by-repo option.

Other Compatibility Notes

-c, --catalog <catalog>
This option is an alias to zypper's --repo <alias> and it will restrict the operation of commands like search, install, etc to the repository specified by the alias.

AUTHORS

Martin Vidner <mvidner@suse.cz>
Duncan Mac-Vicar <dmacvicar@suse.de>
Jan Kupec <jkupec@suse.cz>

SEE ALSO

rug(1), YaST2(8)