Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




openSUSE 11.1 Reference Guide
Previous Page Home Next Page

7.1 Using Zypper

Zypper is a command line tool for installing and updating packages. It is especially useful to accomplish remote software management tasks or to manage software from shell scripts.

zypper has a help overview built in:

zypper help

7.1.1 General Usage

The general syntax of zypper is:

zypper [global-options] command [command-options] [arguments] ...

The components enclosed in brackets are not required. 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 type:

zypper update

Additionally, you can choose from one or more global options by typing them just before the command. For example, --non-interactive means, run the command without asking anything, decide on your own:

zypper --non-interactive update

To use the options specific to a particular command, type them right after the command. For example, --auto-agree-with-licenses means, apply all needed patches to the system without asking for confirming any licenses—all of them were read in advance:

zypper update --auto-agree-with-licenses

Some of the commands require one or more arguments:

zypper install mplayer

Some of the options also require an argument. The following means, update the system with newer packages:

zypper update -t package

All of the above combined means, install using the factory repository only and be verbose:

zypper -v install --repo factory mplayer amarok

7.1.2 Installing and Removing Software with Zypper

To install a package from registered repositories, use

zypper install package_name

You can also install a local or remote RPM directly:

zypper install

To remove an installed package, use

zypper remove package_name

WARNING: Do not Remove Packages Mandatory for the System

Do not remove packages such as glibc, zypper, kernel, or similar. These packages are mandatory for the system and if missing, the system may stop working.

By default, zypper asks for confirmation before installing or removing a selected package. Override this behavior using the --non-interactive option. This option must be given before the actual mode (install, remove, and update) as in

zypper --non-interactive install package_name

This option allows using zypper in scripts and cron jobs.

If you want to install the corresponding source package of a package, use

zypper source-install package_name

With this command, you will also install the build dependencies of the specified package. If you do not want this, add the switch --no-build-deps as follows:

zypper source-install --no-build-deps package_name

Of course, this will only work, if you have the repository with the source packages added to your repository list. For more information about adding repositories, see Section 7.1.4, Managing Repositories.

7.1.3 Updating Software with Zypper

There are two different ways to update software using zypper. To integrate all officially released patches into your system, just run

zypper update

In this case, all patches available in your repositories are checked for relevance, and installed if necessary.

If a repository just has new packages, but does not provide patches, zypper update does not show any effect. To update all of these packages, you must specify to install updates of the type package:

zypper update -t package

To update individual packages, use the installation command:

zypper install package_name

A list of all new packages available can be obtained with the command:

zypper list-updates -t package

7.1.4 Managing Repositories

All installation or update commands of zypper rely on a list of repositories known to zypper. To list all repositories known to the system, use the command:

zypper repos

The result will look similar to the following output:

# | Enabled | Refresh | Type  | Alias             | Name
1 | Yes     | Yes     | yast2 | openSUSE-DVD 11.0 | openSUSE-DVD 11.0
2 | Yes     | No      | yast2 | Main (OSS)        | Main (OSS)
3 | Yes     | No      | yast2 | Main (Non-OSS)    | Main (Non-OSS)

If you want to remove a repository from the list, use the command zypper renamerepo together with the alias of the repository you want to delete. To remove the Main Repository (Non-OSS) from the example, use the following command:

zypper renamerepo Main Repository (Non-OSS)

To add a repository, run

zypper addrepo URI Alias

URI can either be an Internet repository (see for a list of available repositories), a directory, or a CD or DVD. The Alias is a shorthand and unique identifier of the repository. You can freely choose it, with the only exception that is has to be unique. zypper will issue a warning if you specify an alias that is already in use.

7.1.5 Querying

Various querying commands such as search, info, or what-provides are available.

search works on package names and displays status (S) information in the first column of the output.

info with a package name as an arguments displays detailed information about a package.

The what-provides package is similar to rpm -q --whatprovides package, but rpm is only able to query the RPM database (that is the database of all installed packages). Zypper, on the other hand, will tell you about providers of the capability from any repository, not only those that are installed.

Especially for debugging purposes, switches such as --plus-repo, --disable-repositories, and --disable-system-resolvables are available. Use them, if you want to search within one repository only. For detailed usage information, see the zypper manpage (man zypper).

7.1.6 Using the Zypper Shell

Sometimes, several different zypper commands must be run in a sequence. To prevent zypper from rereading all the databases for each zypper command, it is possible to run zypper in shell mode:

zypper shell

When the shell is running, just issue the zypper commands with the respective parameters:

zypper> in zsh
zypper> exit

Using the zypper shell is usually faster, because all the relevant data stay in memory.

Zypper supports the readline library. This means you can use all the command line editing functions in the Zypper shell that are also available in the Bash shell. Zypper maintains its command history in file ~/.zypper_history.

7.1.7 For More Information

For more information about updating from the command line, enter zypper --help or see the zypper(8) man page. For examples and detailed information, visit

openSUSE 11.1 Reference Guide
Previous Page Home Next Page

  Published under the terms fo the GNU General Public License Design by Interspire