Package Management With Zypper

November 5th, 2009 by Mitch Frazier in

Your rating: None Average: 4.3 (9 votes)

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 Associate Editor for Linux Journal and the Web Editor for linuxjournal.com.


Special Magazine Offer -- Free Gift with Subscription
Receive a free digital copy of Linux Journal's System Administration Special Edition as well as instant online access to current and past issues. CLICK HERE for offer

Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
SheeEttin's picture

So, if it's so great...

On November 19th, 2009 SheeEttin (not verified) says:

So, if it's so great, how can I take it for a spin on Ubuntu? :)

Mitch Frazier's picture

Try this

On November 19th, 2009 Mitch Frazier says:

  apt-get install opensuse

If that doesn't work try different combinations of upper and lower case for "suse" in the package name.

__________________________

Mitch Frazier is an Associate Editor for Linux Journal and the Web Editor for linuxjournal.com.

Anonymous's picture

try zypper moo and you get a

On November 6th, 2009 Anonymous (not verified) says:

try
zypper moo
and you get a porcupine :D

Mitch Frazier's picture

Thanks

On November 9th, 2009 Mitch Frazier says:

That's nice:

$ zypper moo
   \\\\\
  \\\\\\\__o
__\\\\\\\'/_
__________________________

Mitch Frazier is an Associate Editor for Linux Journal and the Web Editor for linuxjournal.com.

Anonymous's picture

"powerful satisfiability solver"

On November 6th, 2009 Anonymous (not verified) says:

The "powerful satisfiability solver" is because ZYpp is based on this paper from the University of California, San Diego: http://cseweb.ucsd.edu/~lerner/papers/opium.pdf.

You can see in it that the dependency solver of ZYpp is *perfect* while APT makes errors.

Chad McCullough's picture

Nice article

On November 6th, 2009 Chad McCullough (not verified) says:

Very nice article. I'm an apt-getter but I loved the last line, " So to all you apt-getters out there, all I can say is: zypp it." :)

Anonymous's picture

Zypper

On November 6th, 2009 Anonymous (not verified) says:

Thanks for this article. I first learned apt-get so that is what I'm most comfortable with and never really liked rpm. Zypper looks like it's pretty strait forward. Maybe it's time to give openSuse another try

Anonymous's picture

It's not the same

On November 5th, 2009 Anonymous (not verified) says:

The apt-get system has years of development. You can't compete with that.

I used ancient RH rpm, medium-ancient RH with up2date, yum enabled distros, etc. My laptop now runs openSUSE with yast and zypper (KDE fan here! Good job in 11.2!).

apt-get/dpkg/deb beats everything by miles. There's package/repository pinning, there's dist-upgrade, debconf with text and GUI frontends for package configuration... I can't even think of everything now.

You can install gnome-desktop with 1 command and remove it with all with 2 commands. And it's easy to use!

Don't get me wrong. I hope zypper gets there soon, but meanwhile it's better to wait, explain how to use and avoid comparing with the "Lion King" :-)

Zypper can install groups of packages also, they're called patterns:

zypper install --type pattern xfce
Reading installed packages...

The following NEW packages are going to be installed:
  xsane xfwm4 xfprint xfce4-volstatus xfce4-session xfce4-panel xfce4-mixer
xfce4-desktop-branding-openSUSE xfce4-desktop xfce4-appfinder xfce-mcs-plugins
xfce-mcs-manager xarchiver thunar-volman thunar orage notification-daemon-xfce
mousepad libxfcegui4 libxfce4util libxfce4mcs gtk-xfce-engine fortune exo Terminal
xfce4-icon-theme

The following NEW patterns are going to be installed:
  yast2_install_wf yast2_basis xfce x11_yast x11_opt x11 sw_management fonts_opt fonts
enhanced_base_opt enhanced_base base apparmor_opt apparmor

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

So, let me say it one more time: zypp it. :)

__________________________

Mitch Frazier is an Associate Editor for Linux Journal and the Web Editor for linuxjournal.com.

Bhaskar Chowdhury's picture

zypper then is much faster then YAST/YAST2

On November 5th, 2009 Bhaskar Chowdhury (not verified) says:

Hey guys,

I have been using "zypper" quite some time now. The most noticeable difference I found that (as with every comma nd line app),it(zypper) is much faster then his gui cousin.

Off topic:

"emerge" ,the gentoo package manager is the very best of all breed. Am I biased??? hope certainly not. :)

Thanks
Bhaskar

geco2's picture

install an older version

On November 5th, 2009 geco2 (not verified) says:

Hiho,

have you ever installed an specific version from one package in a repository?

yum install my-package-0.0.1-0

apt-get install my-package=0.0.1-0

zypp it ^^

HuH?'s picture

zypper in -C (--capability)

On November 5th, 2009 HuH? (not verified) says:

zypper in -C (--capability) packagefoo=2.4.0rc3-0.pm.1

Like this?

Odd-rationale's picture

Repo Priorities

On November 5th, 2009 Odd-rationale (not verified) says:

I love zypper as well. It seems to be almost, if not more, complete package manager than apt.

One very cool feature of zypper the ability to priorities your repos. Priorities allows you to install packages from a preferred repo, even though it is lower in version number. With the openSUSE Build Service, you can end up with a long list of repos. (I'm sure Ubuntu users have a similar issue with PPA's.) Priorities really help keeps things straight.

Sorpigal's picture

Funny, that sounds like apt

On November 13th, 2009 Sorpigal (not verified) says:

Funny, that sounds like apt pinning which has been around in Debian for about a decade.

The fact is that even if the underlying logic is better, which I do not admit, it takes a lot of effort to equal (nevermind surpass!) the deep feature set and utility of apt.

Post new comment

Please note that comments may not appear immediately, so there is no need to repost your comment.
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <i> <b>
  • Lines and paragraphs break automatically.

More information about formatting options

Newsletter

Each week Linux Journal editors will tell you what's hot in the world of Linux. You will receive late breaking news, technical tips and tricks, and links to in-depth stories featured on www.linuxjournal.com.
Sign up for our Email Newsletter

Tech Tip Videos

From the Magazine

December 2009, #188

If last month's Infrastrucuture issue was too "big" for you then try on this month's Embedded issue. Find out how to use Player for programming mobile robots, build a humidity controller for your root cellar, find out how to reduce the boot time of your embedded system, and if you're new to embedded systems find out the basics that go into one. You can also read about the Beagle Board, the Mesh Potato and a spate of other interestingly named items. And along with our regular columns don't miss our new monthly column: Economy Size Geek.


Read this issue