openSUSE Package Management Cheat Sheet
Debian/Ubuntu have long been my primary Linux distributions, although like all good Linux users I have used Fedora, CentOS, Gentoo, Red Hat, Slackware, Arch Linux, Mageia, and other Linux distributions because why not? It is a feast of riches and the best playground there is.
I became a SUSE employee recently, so naturally I've been spending more time with openSUSE. openSUSE is sponsored by SUSE, and it is an independent community project. There are two openSUSE flavors: Tumbleweed and Leap. Tumbleweed is a bleeding-edge rolling release, containing the latest software versions. Leap is more conservative, and it incorporates core code from SUSE Linux Enterprise Server (SLES) 12. Both are plenty good for everyday use.
openSUSE is an RPM-based distro so you can use your favorite RPM commands. YaST (Yet another Setup Tool) is one of the most famous, or infamous, SUSE tools. YaST supports nearly every aspect of systems administration: hardware configuration, server management, software management, networking, user management, virtualization, security...you name it, it's probably in YaST. YaST has both a graphical and console interface. YaST is vast.
I prefer less monolithic apps, and openSUSE has another tool for package and software repository management,
zypper. I like
zypper. It's fast and does the job.
zypper is command-line only so you have only one interface to learn, which is something I highly approve of. Many of
zypper's commands have easy-to-remember shortcuts such as
zypper help for a command listing,
zypper help [command name] to get additional information on any command, and
man zypper for detailed help.
Remember the olden days of distro-only repositories, with few third-party repos to choose from? If your particular Linux distribution did not package an application that you wanted, or did not maintain an up-to-date version your only option was compiling from source code. When Ubuntu created Personal Package Archives (PPAs) the floodgates opened and now third-party and special-purpose repos are everywhere.
openSUSE ships with a batch of configured repositories (see Package repositories for lists of official and third-party repos). Not all of them are enabled. You can see a table with enabled/disabled status, and also generate a table with additional information such as the repository URLs:
zypper lr zypper lr -d
Enable and disable an installed repo, without removing it:
zypper mr -e repo-debug zypper mr -d repo-debug
Remove and add a repo:
zypper rr repo-debug zypper ar -name "repo-debug" http://download.opensuse.org/debug/distribution/leap/42.2/repo/oss/
--name is required and arbitrary, so you call it anything you want. You can refresh all repositories, or selected repos:
zypper refresh zypper refresh openSUSE-Leap-4.2-Update
Generate a table of all packages in a repo, and their installed status:
zypper se --repo openSUSE-Leap-4.2-Update
zypper won't list the files in installed packages, but good old
rpm will, like this example for python:
rpm -qi python
Clear your local package cache to force fresh package downloads:
Search For Packages
zypper's search function is fast and easy. You can run a simple name search, see version, architecture, and repository, and search for installed and uninstalled only, like these examples for tiff:
zypper se tiff zypper se -s tiff zypper se -i tiff zypper se -u tiff
You can search for the exact package name, which is great for excluding giant listings of libraries and plugins:
zypper se -x tiff
Name specific repositories to search in:
zypper se --repo openSUSE-Leap-4.2-Update tiff
Installing packages is easy peasey, so let's install digiKam:
zypper in digikam
Install digiKam from a special repository:
zypper in --repo myspecialrepo digikam
Do a dry-run before installation:
zypper in -D --repo myspecialrepo digikam
Download the package without installing it:
zypper in -d --repo myspecialrepo digikam
Getting rid of packages is just as easy. We don't want digiKam anymore (which is silly, because everyone wants digiKam):
zypper rm digikam
Do a dry-run first:
zypper rm -D digikam
Remember when there were flamewars over dependency-resolving package managers like apt-get, Yum, and zypper, like having automatic dependency-resolution was a bad thing? We sure were weird back then. See Using Zypper for more help and some advanced usage.
Learn more about Linux through the free "Introduction to Linux" course from The Linux Foundation and edX.