Jump to contentJump to page navigation: previous page [access key p]/next page [access key n]

Zypper package manager

Publication Date: 09/24/2021

1 Environment

  • File Name: concept-zypper.xml
  • ID: environment-zypper

This document applies to the following products and product versions:

  • SUSE Linux Enterprise Server 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3

  • SUSE Linux Enterprise Server for SAP Applications 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3

  • SUSE Linux Enterprise High Availability Extension 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3

  • SUSE Linux Enterprise High Performance Computing 15 SP3, 15 SP2, 15 SP1, 15 GA

  • SUSE Linux Enterprise Desktop 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3

  • SUSE Linux Enterprise Real Time 15 SP3, 15 SP2, 15 SP1, 15 GA, 12 SP5, 12 SP4, 12 SP3

2 What is Zypper?

  • File Name: concept-zypper.xml
  • ID: what-is-zypper

Zypper is a command-line package manager for installing, updating and removing packages. It can also be used to manage repositories.

3 How does Zypper work?

  • File Name: concept-zypper.xml
  • ID: how-it-works-zypper

Zypper works and behaves as a regular command-line tool. It features subcommmands, arguments, and options that can be used to perform specific tasks.

4 Benefits of Zypper

  • File Name: concept-zypper.xml
  • ID: benefits-zypper

Zypper offers several benefits compared to graphical package managers.

  • Being a command-line tool, Zypper is faster in use and light on resources.

  • Zypper actions can be scripted.

  • Zypper can be used on systems that do not have graphical desktop environments. This makes it suitable for use with servers and remote machines.

5 General usage

  • File Name: concept-zypper.xml
  • ID: general-usage-zypper

The general syntax of Zypper is:

zypper [GLOBAL_OPTIONSSUBCOMMAND [SUBCOMMAND_OPTIONS] [ARGUMENTS]

The components enclosed in brackets are not required. See zypper help for a list of general options and all subcommands. To get help for a specific subcommand, type zypper help SUBCOMMAND.

Zypper subcommands

The simplest way to execute Zypper is to type its name, followed by a command. For example, to apply all needed patches to the system, use:

tux > sudo zypper patch
Global options

Additionally, you can choose from one or more global options by typing them immediately before the command:

tux > sudo zypper --non-interactive patch

In the above example, the option --non-interactive means that the command is run without asking anything (automatically applying the default answers).

Command-specific options

To use options that are specific to a particular command, type them immediately after the command:

tux > sudo zypper patch --auto-agree-with-licenses

In the above example, --auto-agree-with-licenses is used to apply all needed patches to a system without you being asked to confirm any licenses. Instead, license will be accepted automatically.

Arguments

Some commands require one or more arguments. For example, when using the command install, you need to specify one or more packages you want to install:

tux > sudo zypper install mplayer

Some options also require a single argument. The following command will list all known patterns:

tux > zypper search --type pattern

You can combine all of the above. For example, the following command will install the mc and vim packages from the factory repository while being verbose:

tux > sudo zypper --verbose install --from factory mc vim

The --from option keeps all repositories enabled (for solving any dependencies) while requesting the package from the specified repository. The option --repo is an alias for --from, and you may use either one.

Most Zypper commands have a dry-run option that does a simulation of the given command. It can be used for test purposes:

tux > sudo zypper remove --dry-run MozillaFirefox

Zypper supports the global --userdata STRING option. You can specify a string with this option, which gets written to Zypper's log files and plug-ins (such as the Btrfs plug-in). It can be used to mark and identify transactions in log files.

tux > sudo zypper --userdata STRING patch

6 Using Zypper subcommands

  • File Name: concept-zypper.xml
  • ID: general-usage-zypper-subcommands

Zypper subcommands are executables that are stored in the directory /usr/lib/zypper/commands. If a subcommand is not found in this directory, Zypper automatically searches the rest of your $PATH for it. This enables writing your own local extensions and storing them in userspace.

Executing subcommands in the Zypper shell, and using global Zypper options are not supported.

List your available subcommands:

tux > zypper help subcommand
[...]
Available zypper subcommands in '/usr/lib/zypper/commands'

  appstream-cache
  lifecycle
  migration
  search-packages

Zypper subcommands available from elsewhere on your $PATH

  <none>

View the help screen for a subcommand:

tux > zypper help appstream-cache
Print this page