Package Management With Zypper

As I've mentioned before I'm an openSUSE user, and as long as they don't make the "U" lower case again, I'll probably stick with it. When it comes to package management, OpenSUSE and SUSE Linux Enterprice (and SuSE before them) are usually associated with YaST (and yes, I'm still waiting for them to upper case the "a"). YaST works well but it's a bit verbose for installing a single package, and of course that's just more fodder for the apt-getters with all their apt-get install this and their apt-get install thats. And you can't argue with them, but there are other options with openSUSE: yum and apt4rpm come to mind, but the preferred solution is zypper.

Zypper is a command line tool for package management, it's based on ZYpp, aka libzypp. The WikiPedia entry for Zypp says:

Unlike other common package managers, it provides a powerful satisfiability solver to compute package dependencies and a convenient package management API.

Since we don't want our heads to explode we'll just take it for granted that a powerful satisfiability solver is a good thing.

It turns out that YaST is also (now) based on ZYpp so you don't need to worry that you're missing out on something by using zypper.

Zypper is fairly straightforward to use. If you want to search for a package do zypper search STRING.... The STRING(s) can include * and ? wildcards and there are options for matching all or any of the strings and for full exact matches (the default is a partial match). If you want to search the package descriptions there's an option for that also. For example to search for packages with the word "mail" in the name or in the description do:

$ zypper search --search-descriptions mail
$ # --search-descriptions can be abbreviated as -d
Reading installed packages...

S | Name                 | Summary                                | Type
--+----------------------+----------------------------------------+-----------
  | Buddi                | Buddi - Personal budget software ...   | package
  | CgEddie              | A simple editor with syntax high ...   | package
  | FrostWire            | Gnutella peer-to-peer (P2P) file ...   | package
  ...
i | yast2-mail           | YaST2 - Mail Configuration             | package
  | yast2-mail-plugins   | YaST2-Users/Group Plugins for the ...  | package
  | yum-updatesd         | YUM update notification daemon         | package

When installing packages with zypper, as you'd expect/hope, zypper takes care of installing the package's dependencies:

$ zypper install Buddi
Reading installed packages...

The following NEW packages are going to be installed:
  BrowserLauncher2 swingx Buddi jcommon jfreechart

Overall download size: 4.1 M. After the operation, additional 5.2 M will be used.
Continue? [YES/no]:

Some of the other interesting commands that zypper supports are:

  • refresh - to refresh the package information from the repositories you have defined.
  • addrepo - to add a new repository.
  • remove - to remove a package.
  • list-updates - to list the updates/patches that are available for the packages you have installed.

For a full list of the commands that zypper supports type zypper help and check the man page for more details.

One of Ubuntu's WOW factors seems to be apt-get dist-upgrade, i.e. the ability to upgrade to the next version of Ubuntu (and actually it's a feature of any debian based distro). This is another thing that the apt-getters puff up about, well enter zypper dist-upgrade or zypper dup. This allows you to upgrade from one version of openSUSE to the next. I have not used this feature yet, but posts on the openSUSE wiki seem to indicate that it works well.

So to all you apt-getters out there, all I can say is: zypp it. :

Mitch Frazier is an embedded systems programmer at Emerson Electric Co. Mitch has been a contributor to and a friend of Linux Journal since the early 2000s.

Load Disqus comments