A Quick Guide To Using Zypper For Package Management In openSUSE Linux

Using Linux command line is quicker for adding, removing, installing and updating software packages.

Various distros have their own package management tools, for e.g : Debian based distros use apt, Fedora/ Red Hat has dnf and openSUSE has zypper.

Let’s take a quick look at how to use zypper in openSUSE for updating, removing and finding various software packages. (Root privileges are needed for running most of these commands.)

If you are familiar with other Linux distros and have used apt and other such tools, using zypper will feel similar to those.

Here is a list of commonly used zypper commands for various package related tasks:

a list of common zypper commands for package management in openSUSE

Installing system and security patches:

To apply various patches (both system and security related), open the Terminal in openSUSE and type in:

zypper patch-check

This will check for available patches but won’t apply them.

checking for patches using zypper in openSUSE

To get a list of available patches:

zypper list-patches

A list of all available patches will be displayed if any but won’t be applied.

finding list of available patches using zypper

Finally, to apply them if any, use the command :

zypper patch

applying patches using zypper

The patches if any will now be downloaded and installed. This will apply necessary patches but not from any 3rd party repositories.

To install patches from 3rd party repositories, simply use the –with-update parameter:

zypper patch –with-update

applying patches from 3rd party repositories in openSUSE using zypper

Managing software packages:

Similar to checking patches, to see if any software updates for installed packages are available, type in :

zypper list-updates

finding list of available updates for packages from openSUSE command line using zypper

To download and install the updates, use the following command:

zypper update

updating existing installed packages in openSUSE using zypper

To know information about any package, the command is:

zypper info pkgname

finding information about specific package using zypper in openSUSE

This will display all the related information about the queried package.

To install a package:

zypper install pkgname

installing packages using zypper in openSUSE

The package will then be installed with it’s dependencies.

You can also update an existing package individually:

zypper update pkgname

updating individual packages using zypper

Also, you can search for a list of packages using wild cards. So for example, to search for a package which starts with initial letters ‘neof’ with the rest being any other letters, the command will be:

zypper search “neof*”

using wildcards to search for packages and install using zypper

A list of all the packages matching the above wild card expression will be displayed. This is useful when you don’t know the exact package name.

You can also use the exact match when searching for packages by using the –match-exact parameter followed by package name:

zypper search –match-exact “pkgname”

using exact match phrase to find packages using zypper

Use the remove parameter to uninstall packages:

zypper remove pkgname

uninstalling packages using zypper

Also, to fix and dependencies errors and verify them, the command is:

zypper verify

verifying dependencies and fixing them using zypper

Managing repositories:

To view all the available repositories in openSUSE :

zypper repos

listing available repositories in openSUSE using zypper

To add a new 3rd party repository, use the ar parameter with -cf (check the repository path and auto refresh) followed by the path to that repository and the name:

zypper ar -cf repositoryURL reponame

adding 3rd party repository using zypper in openSUSE

To refresh all repsitories manually:

zypper refresh

refreshing existing repositories using zypper

Finally, use the help command to quickly find out various parameters that can be used with zypper:

zypper help

zypper help page from openSUSE command line

All done.

Comments are closed.