Archive:Zypper usage 11.0
|This article is being considered for deletion!|
openSUSE 11.0 is EOL --Zbuhman 01:17, 25 March 2011 (MDT).
Please do not blank, merge, or move this article, or remove this notice. Refer to this article's discussion page and our deletion policy for more information.
Version: 11.0 This article is about zypper 0.11.6 as it appeared in openSUSE 11.0. For other versions see Zypper versions, Zypper usage and Zypper usage 11.1.
This is what you will probably use most frequently.
zypper # to print the list of available global options and commands zypper help search # to print help for the search command zypper lu # to see what patch updates are needed zypper up # to apply the patch updates zypper se sqlite # to search for sqlite zypper rm sqlite2 # to remove sqlite2 zypper in sqlite3 # to install sqlite3 zypper in yast* # to install all packages matching 'yast*' zypper up -t package # to upgrade all installed packages with newer versions, where possible
The general syntax of zypper is:
zypper [global-options] command [command-options] [arguments] ...
The components enclosed in brackets are not required, thus the simplest way to execute zypper is to type its name followed by a command. For example, to apply needed patches to the system type:
Additionally, you can choose from one or more global options by typing them just before the command: (run the command, but don't ask me anything, decide on your own)
zypper --non-interactive update
To use the options specific to particular command, type them right after the command: (apply needed patches to the system but don't ask me to confirm any licenses, i've read them all before)
zypper update --auto-agree-with-licenses
Some of the commands require one or more arguments: (install or update mplayer package)
zypper install mplayer
Some of the options also require an argument: (update the system with newer packages)
zypper update -t package
All of the above combined: (install mplayer and amarok by using the factory repository only, be verbose)
zypper -v install --repo factory mplayer amarok
- repository - local or remote directory containing packages and various package information (package metadata). Repositories were formerly known as installation sources , services or catalogs).
- alias - repository alias is a short version of repository name for use in repository handling commands and options as removerepo or --repo.
- package - software package (RPM package, source package). Patches, patterns, and products are also commonly referred to as different types of packages.
- patch - represents a package or a group of packages needed to install an update (a bug fix mostly).
- pattern - represents a group of packages. For example an Http Server pattern would have the dependencies defined so that all packages needed to run and manage an http server would have been triggered for installation when upon installing the pattern.
- product - represents the whole product (e.g. 'openSUSE 10.3').
zypper provides a number of commands which can be grouped into the following categories:
- repository management
refresh, repos, addrepo, removerepo, modifyrepo, namerepo
- package management
install, remove, update, dist-upgrade, source-install
search, info, what-provides, list-updates, patch-check, patches, packages, patterns, products
locks, addlock, removelock
Additionally, update, list-updates, patch-check, and patches commands can be referred to as update management commands.
First, it is good to know how to get help. To print general help (list of commands and global options), just type zypper without any option or arguments. To print help for specific command, use:
# zypper help [command]
zypper -h [command] and zypper [command] -h is also possible for convenience.
You can specify existing repositories by their number in the list produced by zypper lr, alias, or URI. When using the numbers, make sure you always check zypper lr first, as the numbers may change after you made some changes to the repositories.
Listing Defined Repositories
$ zypper lr # | Alias | Name | Enabled | Refresh --+-----------------------+-----------------------+---------+-------- 1 | packman | Packman 11.0 | Yes | No 2 | fate | fate | No | No 3 | openSUSE-11.0-Updates | Updates for 11.0 | Yes | Yes 4 | repo-oss | openSUSE-11.0-Oss | Yes | No 5 | repo-non-oss | openSUSE-11.0-Non-Oss | Yes | No 6 | repo-debug | openSUSE-11.0-Debug | No | No
zypper lr -u # to include also repo URI in the table zypper lr -d # to include several other repo properties in the table zypper lr -P # to include also repo priority and sort the list by it zypper lr -e my # export all repository definitions into file named 'my.repo'
Before any packages can be installed at least one repository must be defined. To add a repository, use the addrepo command:
$ zypper ar http://download.videolan.org/pub/vlc/SuSE/11.0 vlc Adding repository 'vlc' [done] Repository 'vlc' successfully added Enabled: Yes Autorefresh: No URI: http://download.videolan.org/pub/vlc/SuSE/11.0
zypper ar http://download.opensuse.org/repositories/X11:/XGL/openSUSE_11.0/X11:XGL.repo # via .repo file zypper ar -c ftp://some.download.site myalias # probe the repository upon adding zypper ar my/dir/with/rpms local # add your local directory with rpm files as repository
See also Libzypp/URI for the list of supported media types and URIs.
After adding of a repository or when a repository becomes out of date, it needs to be refreshed. This mean downloading package metadata from it and preprocessing the data into .solv cache for quick reading.
$ zypper refresh Downloading repository 'Packman 11.0' metadata [done] Building repository 'Packman 11.0' cache [done] Downloading repository 'Updates for 11.0' metadata [done] Building repository 'Updates for 11.0' cache [done] Repository 'openSUSE-11.0-Oss' is up to date. All repositories have been refreshed.
If autorefresh is enabled for a repository, you don't need to worry about refreshing, it happens automatically when needed. However, some people prefer to be in control when the refresh takes place (e.g. to avoid waiting for the refresh to complete when you only wanted to see 'zypper info krusader'), so they disable autorefresh. See man zypper for more details.
zypper ref packman main # you can also specify which repositories to refresh zypper ref -f upd # force refresh of the 'upd' repository
$ zypper rr vlc 1 23 foo Repository 23 not found by alias, number or URI. Repository foo not found by alias, number or URI. Removing repository 'repo-debug' [done] Repository 'repo-debug' has been removed. Removing repository 'vlc' [done] Repository 'vlc' has been removed.
Disable repository #6:
$ zypper mr -d 6 Repository 'repo-non-oss' has been sucessfully disabled.
Enable autorefresh and rpm files caching for 'packman' repository and set its priority to 70:
$ zypper mr -rk -p 70 packman Autorefresh has been enabled for repository 'packman'. RPM files caching has been enabled for repository 'packman'. Repository 'packman' priority has been set to 70.
Disable RPM files caching for all repositories:
$ zypper mr -Ka Nothing to change for repository 'local'. RPM files caching has been disabled for repository 'packman'. Nothing to change for repository 'fate'. Nothing to change for repository 'upd'. Nothing to change for repository 'repo-oss'. Nothing to change for repository 'repo-non-oss'.
Enable RPM files caching for all repositories:
$ zypper mr -ka RPM files caching has been enabled for repository 'repo-non-oss'. RPM files caching has been enabled for repository 'Main Repository (OSS)'. RPM files caching has been enabled for repository 'Main Repository (NON-OSS)'. RPM files caching has been enabled for repository 'openSUSE-11.0-Updates'.
$ zypper nr 3 upd Repository 'openSUSE-11.0-Updates' renamed to 'upd'.
This command is currently only able to change the alias of the repository. If you wish to change the displayed name of the repository, take a look at the mr command.
Keep the aliases short and simple for an easy use as arguments of commands and --repo options. Using an alias is safer than using repo number (since that may change and you can easily make a mistake) and easier than using URI (since they are long, leaving you with copy-and-paste).
You can export your complete repository list to a file and import it later or on another machine.
zypper lr --export backups/repos/foo.repo zypper ar backups/repos/foo.repo
You can install packages by name or by capability they provide:
$ zypper install git Reading installed packages... The following NEW packages are going to be installed: subversion-perl sqlite3 perl-DBD-SQLite git-svn git-cvs git Overall download size: 1.1 M. After the operation, additional 4.6 M will be used. Continue? [YES/no]: Downloading package subversion-perl-1.5.0-96.1.x86_64 (1/6), 950.0 K (4.1 M unpacked) Downloading: subversion-perl-1.5.0-96.1.x86_64.rpm [done] Installing: subversion-perl-1.5.0-96.1 [done] Downloading package sqlite3-3.5.7-17.1.x86_64 (2/6), 30.0 K (40.0 K unpacked) Downloading: sqlite3-3.5.7-17.1.x86_64.rpm [done] Installing: sqlite3-3.5.7-17.1 [done] Downloading package perl-DBD-SQLite-1.14-41.1.x86_64 (3/6), 44.0 K (103.0 K unpacked) Downloading: perl-DBD-SQLite-1.14-41.1.x86_64.rpm [done] Installing: perl-DBD-SQLite-1.14-41.1 [done] Downloading package git-svn-184.108.40.206-26.1.x86_64 (4/6), 66.0 K (195.0 K unpacked) Downloading: git-svn-220.127.116.11-26.1.x86_64.rpm [done] Installing: git-svn-18.104.22.168-26.1 [done] Downloading package git-cvs-22.214.171.124-26.1.x86_64 (5/6), 63.0 K (205.0 K unpacked) Downloading: git-cvs-126.96.36.199-26.1.x86_64.rpm [done] Installing: git-cvs-188.8.131.52-26.1 [done] Downloading package git-184.108.40.206-26.1.x86_64 (6/6), 10.0 K (3.0 K unpacked) Downloading: git-220.127.116.11-26.1.x86_64.rpm [done] Installing: git-18.104.22.168-26.1 [done]
...or by capability they provide:
$ zypper in MozillaFirefox \< 3 Reading installed packages... 'MozillaFirefox' providing 'MozillaFirefox<3' is already installed. Nothing to do.
$ zypper in MozillaFirefox \>= 3 Reading installed packages... The following packages are going to be upgraded: mozilla-xulrunner190-translations MozillaFirefox mozilla-xulrunner190-gnomevfs mozilla-xulrunner190 MozillaFirefox-translations The following package is going to be REMOVED: mozilla-xulrunner190-lang Overall download size: 11.0 M. After the operation, 12.9 M will be freed. Continue? [Y/n/p/?]:
$ zypper in 'libqtiff.so()(64bit)' Reading installed packages... 'libqt4-x11' providing 'libqtiff.so()(64bit)' is already installed. Nothing to do.
zypper in yast* # install all yast modules zypper in -t pattern lamp_server # install lamp_server pattern (packages needed for a LAMP server) zypper in vim -emacs # install vim and remove emacs in one go zypper in amarok packman:libxine1 # install libxine1 from packman and amarok from any repo zypper in bitchx-1.1-81.x86_64.rpm # install bitchx rpm from local directory zypper in -f subversion # force reinstallation of subversion
The remove command is very much like the install command, except that the effect is the opposite :O)
$ zypper remove sqlite Reading installed packages... The following packages are going to be REMOVED: sqlite3 perl-DBD-SQLite git-cvs git After the operation, 351.0 K will be freed. Continue? [YES/no]: n
Source Packages and Build Dependencies
$ zypper si zypper Reading installed packages... The following NEW packages are going to be installed: libzypp-devel libsatsolver-devel The following source package is going to be installed: zypper Overall download size: 1.5 M. After the operation, additional 6.7 M will be used. Continue? [YES/no]:
You can also install only the build deps or only the source package:
zypper si -D zypper # only the source packages (no build deps) zypper si -d zypper # only the build deps (no source package)
update -t package
The following is about updating packages with their newer available versions. See also Update Management for another type of update.
zypper dup # use the distribution upgrade algorithm (handles package splits, unmaintaned packages and similar) zypper up -t package # update all installed packages with newer version as far as possible zypper up -t package libzypp zypper # update libzypp and zypper zypper in libzypp sqlite3 # update sqlite3 or install it if not yet installed
By default, the search command looks for packages of any type, status or repository, having names containing specified string (compares case-insensitively):
$ zypper se sqlite Reading installed packages... S | Name | Summary | Type --+--------------------------+----------------------------------------------------------------+-------- | libapr-util1-dbd-sqlite3 | DBD driver for SQLite 3 | package i | libgda-3_0-sqlite | Sqlite Provider for GNU Data Access (GDA) | package | libqt4-sql-sqlite | Qt 4 sqlite plugin | package i | libsqlite3-0 | Shared libraries for the Embeddable SQL Database Engine | package | libsqlite3-0-32bit | Shared libraries for the Embeddable SQL Database Engine | package | mediatomb-sqlite | UPnP AV MediaServer | package i | mono-data-sqlite | Database connectivity for Mono | package | pdns-backend-sqlite2 | SQLite 2 backend for pdns | package | pdns-backend-sqlite3 | SQLite 3 backend for pdns | package i | perl-DBD-SQLite | The DBD::SQLite is a self contained RDBMS in a DBI driver | package i | php5-sqlite | PHP5 Extension Module | package | python-sqlite2 | Python bindings for sqlite 2 | package | qt3-sqlite | SQLite Database Plug-In for Qt | package | rekall-sqlite | Rekall sqlite Database Backend | package | rubygem-sqlite3 | A Ruby interface for the SQLite3 database engine | package i | sqlite2 | Embeddable SQL Database Engine | package | sqlite2-32bit | Embeddable SQL Database Engine | package | sqlite2-devel | Embeddable SQL Database Engine | package i | sqlite3 | Embeddable SQL Database Engine | package | sqlite3-devel | Embeddable SQL Database Engine | package | sqlite3-tcl | Tcl binding for SQLite | package | tntdb1-sqlite | Tntdb is a c++-class-library for easy database-access - sqlite | package | ulogd-sqlite | SQLite output plugin for ulogd | package
The i in the first column says the package is already installed. To see all available versions of matching packages, use --details/-s option:
$ zypper search -s --match-exact virtualbox-ose Reading installed packages... S | Name | Type | Version | Arch | Repository --+----------------+---------+------------+--------+------------------------------------ v | virtualbox-ose | package | 1.6.2-2.1 | x86_64 | VirtualBox OSE (OBS, openSUSE 11.0) i | virtualbox-ose | package | 1.5.6-33.1 | x86_64 | openSUSE-11.0-Oss v | virtualbox-ose | package | 1.5.6-20.5 | x86_64 | VirtualBox OSE (OBS, openSUSE 11.0) v | virtualbox-ose | package | 1.6.2-2.1 | i586 | VirtualBox OSE (OBS, openSUSE 11.0) v | virtualbox-ose | package | 1.5.6-33.1 | i586 | openSUSE-11.0-Oss v | virtualbox-ose | package | 1.5.6-20.3 | i586 | VirtualBox OSE (OBS, openSUSE 11.0)
The i mean this particular version is installed, v means other version of this package is currently installed.
zypper se -dC --match-words RSI # look for RSI acronym (case-sensitively), also in summaries and descriptions zypper se 'yast*' # show all packages starting with 'yast' (beware of shell expansion, quote the strings if unsure!) zypper se -r packman # list all packages from 'packman' repository zypper se -i sqlite # show all installed packages containing 'sqlite' in their name zypper se -t pattern -r repo-oss # list all patterns available in the 'repo-oss' repository zypper se -t product # list all available products
Obtaining Information about Packages
$ zypper info amarok Reading installed packages... Information for package amarok: Repository: Packman 11.0 Name: amarok Version: 22.214.171.124-103.pm.1 Arch: x86_64 Vendor: packman.links2linux.de Installed: Yes Status: up-to-date Installed Size: 12.1 M Summary: Media Player for KDE Description: Amarok is a media player for all kinds of media, supported by aRts, GStreamer or Xine (depending on the packages you install). This includes MP3, Ogg Vorbis, audio CDs and streams. It also supports audio effects of all kinds that are provided by aRts. Playlists can be stored in .m3u or .pls files. Amarok also provides audio file collection management, by using either an embedded sqlite3, a MySQL or a PostgreSQL database.
This command displays detailed information about package named 'amarok'.
zypper info -t patch MozillaFirefox # show information about 'MozillaFirefox' patch zypper patch-info MozillaFirefox # the same as above zypper info -t pattern lamp_server # show info about 'lamp_server' pattern zypper info -t product openSUSE-FTP # show info about specified product
To list all providers of specified capability, do:
$ zypper wp firefox Reading installed packages... S | Name | Type | Version | Arch | Repository --+----------------+---------+-------------+--------+------------------ i | MozillaFirefox | package | 3.0-0.1 | x86_64 | Updates for 11.0 v | MozillaFirefox | package | 2.9.95-25.1 | x86_64 | openSUSE-11.0-Oss v | MozillaFirefox | package | 3.0-0.1 | i586 | Updates for 11.0 v | MozillaFirefox | package | 2.9.95-25.1 | i586 | openSUSE-11.0-Oss
This command is similar to rpm -q --whatprovides firefox, but rpm is only able to query the RPM database (database of the installed packages). Zypper, on the other hand, will tell you about providers of the capability from any repository, not only the installed ones.
Commands patches, packages, patterns, and products are similar to search -s -t [patch,package,pattern,product], except that they display some additional information specific to the corresponding package type. For example patches shows also the status of patches (Needed/Security/Not Applicable).
Commands list-updates and patch-check are discussed in Update Management.
Package locks serve the purpose of preventing changes to the packages on the system. Packages matching an active lock can't change their installed status; installed packages can't be removed or upgraded, packages not yet installed can't be installed.
To lock all packages starting with 'yast2', do:
$ zypper al 'yast2*' Reading installed packages... Specified lock has been successfully added.
Again beware of shell expansion, use quotes if there is a possibility that yast* will match some files or directories in the working directory.
To list currently active locks:
$ zypper ll # | Name | Type | Repository --+------------------+---------+----------- 1 | libpoppler3 | package | (any) 2 | libpoppler-glib3 | package | (any) 3 | yast* | package | (any)
To remove a lock, do:
$ zypper rl yast2-packager Reading installed packages... The following query locks some of the objects you want to unlock: type: package match_type: glob case_sensitive: on solvable_name: yast2* Do you want remove this lock? [YES/no]: y Lock count has been succesfully decreased by: 1
zypper al zypper # lock package 'zypper' (exact match) zypper al -r repo-oss virtualbox* # restrict the lock to 'repo-oss' repository (allowing installation from others) zypper rl 3 # remove lock by number
You can manipulate the locks also by directly editing the locks file.
You may occasionally end up with a broken system when it comes to package dependencies. If some of your applications fails to start with a message indicating that it misses something, this is something for zypper to check:
$ rpm -e --nodeps mozilla-xulrunner190 $ firefox Could not find compatible GRE between version 1.9.0 and 1.9.0. $ zypper ve Reading installed packages... Some of the dependencies of installed packages are broken. In order to fix these dependencies, the following actions need to be taken: The following NEW package is going to be installed: mozilla-xulrunner190 Overall download size: 6.5 M. After the operation, additional 23.5 M will be used. Continue? [YES/no]: y
Install New Recommended Packages
This command finds and installs newly added recommended packages for packages you have already installed. This provides an easy way to get new language bundles for your software or drivers for newly added hardware.
$ zypper inr Reading installed packages... The following NEW packages are going to be installed: kdebase4-openSUSE-lang bundle-lang-common-cs Overall download size: 534.0 K. After the operation, additional 1.9 M will be used. Continue? [YES/no]:
The following is particularly useful for people using stable releases and want update their systems with patches released through online update repositories (for package updates, see Updating Packages). Update repositories are added by default during installation or upgrade of the system, or they can be added via Online Update Configuration from the Software tab in YaST Control Center, or manually using zypper. Here is the list of available openSUSE update repositories.
YaST equivalent of this feature is the Online Update module.
To list all needed patch updates, do:
$ zypper lu Reading installed packages... Patches Repository | Name | Version | Category | Status -----------------+--------------------+---------+-------------+------- Updates for 11.0 | KDE4-fixes | 38 | recommended | Needed Updates for 11.0 | MozillaFirefox | 50 | recommended | Needed Updates for 11.0 | NetworkManager-kde | 49 | recommended | Needed
Sometimes only updates affecting the package management are listed, since these should be applied first. Once applied, the rest of available updates will be listed by this command.
This command defaults to -t patch. To list all available package updates, use:
zypper lu -t package
To apply the needed patches, do:
$ zypper up Reading installed packages... The following packages are going to be upgraded: NetworkManager-kde mozilla-nss mozilla-nspr kde4-korganizer The following NEW patches are going to be installed: NetworkManager-kde MozillaFirefox KDE4-fixes Overall download size: 2.9 M. After the operation, additional 283.0 K will be used. Continue? [YES/no]:
The list-updates command only lists needed patches. To list all available patches, use:
$ zypper patches Reading installed packages... Catalog | Name | Version | Category | Status -----------------+--------------------+---------+-------------+--------------- Updates for 11.0 | KDE4-fixes | 38 | recommended | Installed Updates for 11.0 | MozillaFirefox | 50 | recommended | Installed Updates for 11.0 | NetworkManager-kde | 49 | recommended | Installed Updates for 11.0 | autoyast2 | 37 | recommended | Installed Updates for 11.0 | courier-authlib | 42 | security | Not Applicable Updates for 11.0 | insserv | 47 | recommended | Installed Updates for 11.0 | opera | 43 | security | Installed
This command will tell you whether there are any important patches available for your system and the number of such patches:
$ zypper pchk Reading installed packages... 0 patches needed (0 security patches)
Getting Information About Patches
info -t patch
$ zypper info -t patch MozillaFirefox Reading installed packages... Information for patch MozillaFirefox: Name: MozillaFirefox Version: 50 Arch: noarch Vendor: firstname.lastname@example.org Status: Installed Category: recommended Created On: Thu 01 Jan 1970 01:00:00 AM CET Reboot Required: No Package Manager Restart Required: No Interactive: No Summary: Mozilla Firefox 3.0 Description: This patch updates Mozilla Firefox to the final 3.0 version. The dependend libraries mozilla-xulrunner190, mozilla-nspr and mozilla-nss were also brought to their release version.
Using Zypper in Scripts and Applications
Zypper supports several global options which make it suitable for use within automated processes like scripts. Also, several different exit codes listed in zypper's manual page can be checked for when using zypper in an automated process.
Non Interactive Mode
In this mode zypper does not prompt the user for any answers and uses default answers instead. When using this option it is guaranteed that zypper will not hang prompting for an answer on stdin, or in an endless loop.
For example, to update your system automatically without confirmation, you can type
# zypper --non-interactive update
This command does not require confirmation from the user to proceed with update, skips all interactive patches which would need additional confirmation and also automatically answers any other prompts.
No GPG Checks Mode
If this option is used, zypper will always choose to continue if some of the gpg checks fails, e.g. a repository file is not signed and should be, a file is signed and the gpg check fails, etc.
Auto-agree with Licenses
This is special option for the install, remove and update commands. By using this, the user declares he/she agrees with the terms of licenses the command will install, and zypper will automatically say 'yes' to the license confirmation prompt. This is useful for people installing the same set of packages on multiple machines (by an automated process) and have read all the licenses before.
Avoids displaying too much texts like progress information and only displays result of the operation and error messages.
This option makes zypper to talk in XML. This allows scripts, graphical front-ends or other types of applications which would like to use zypper, to parse zypper's output in a well-defined, standard way. The RNC schema of zypper's XML output is available here and at /usr/share/zypper/xml/xmlout.rnc.
Not all (but most of) the output is currently in XML; the goal is to have all possible output in XML.
The following should be a complete list of cases where zypper needs user interaction together with the replies used in non-interactive mode. All the additional options mentioned here have higher priority over --non-interactive, so if used, the answer they imply are automatically used even if --non-interactive isn't used.
Where --no-gpg-checks is applied, a message is displayed or a warning is written to stderr and logged.
|prompt||default answer||with --no-gpgp-checks||note|
|accept unsigned file?||N||Y|
|import key into keyring?||N||N||a new key can be imported in the interactive mode only|
|accept unknown key?||N||Y|
|verification of signed file failed, continue?||N||Y|
|no digest for a file, continue?||N||Y|
|accept unknown digest?||N||Y|
|prompt||default answer||other answer||note|
|proceed with installation/removal/update?||Y||in addition, the --no-confirm option can be used with the install/remove/update commands even without the global --non-interactive|
|confirm 3rd party license||N||Y if --auto-agree-with-licenses is used||in addition, for zypper update, --skip-interactive option can be used to exclude interactive patches from to-be-installed list (a heritage of rug)|
|confirm a patch message||Y|
|problem while installing/removing a resolvable, Abort/Retry/Ignore?||ABORT||this is ugly and can be improved in future|
|problem while downloading a package, Abort/Retry/Ignore?||ABORT||this is also ugly, can be enhanced somehow in the future|
|dependency conflict, #/s/r/c (solution number, skip, retry, or cancel)||c||always cancel, user interaction is needed to resolve dependencies|
|media change request||ABORT|
|remove problematic lock?||Y|
In XML output, prompts are indicated by <prompt> tag, containing id attribute. Enumeration of all known ids is available in prompt.h include file packaged with zypper (/usr/include/zypper/prompt.h).
Compatibility with Rug
Zypper's syntax is similar to that of rug but its command and option set has started to diversify from rug as well as its output and behavior. However, zypper is able to work also in rug-compatible mode and supports most of the rug commands. For more details see man zypper, section COMPATIBILITY WITH RUG.