OpenSuse

How to Setup and Use Zypper on OpenSUSE

If you’re running a Linux distribution like openSUSE or SUSE Linux Enterprise, you might already be familiar with the package manager called “Zypper”. Zypper is a powerful command-line tool that helps you manage the software packages on your Linux system.

With Zypper, you can install, update, and remove the software packages, as well as manage the repositories and dependencies. It’s an essential tool for any Linux user, especially if you’re working with a SUSE-based distribution.

In this tutorial, we will guide you through the process of setting up and using Zypper on Linux. We will also cover the basics of package management with Zypper including installing and removing the packages, updating your system, and managing the repositories.

Step-by-Step Guide on Installing Zypper

The following are the core steps of installing zypper:

Step 1: Confirm If Your System Has Zypper
Before you can start using Zypper on your Linux system, you need to install it first. Fortunately, most Linux distributions come with pre-installed zypper. If you’re not sure whether Zypper is installed on your system, you can check by opening a terminal and typing the following command:

zypper -v

If Zypper is installed, you’ll see its version number and additional information. If not, you need to install it using your distribution’s package manager.

Step 2: Install Zypper
You can install Zypper on openSUSE or SUSE Linux Enterprise using the following command:

sudo zypper install zipper

This code snippet downloads and installs Zypper and any necessary dependencies. You may be prompted to enter your sudo password depending on your system configuration.

Zypper may not be available in the default repositories on other Linux distributions like Fedora. In that case, you can download the Zypper package from the official website and install it manually. Once Zypper is installed, you can start using it to manage the packages on your Linux system.

Basic Zypper Commands

Now that you installed Zypper, it’s time to start using it to manage the packages on your Linux system. Here are some basic Zypper commands that you can use to get started:

Installing the Packages
To install a package using Zypper, open a terminal and type the following command:

sudo zypper install [package-name]

Replace [package-name] with the package name that you want to install. For example, to install the Chromium web browser, type the following command:

sudo zypper install chromium

Zypper downloads and installs the package and any necessary dependencies. Again, depending on your system configuration, you may be prompted to enter your sudo password.

Removing the Packages
To remove a package using Zypper, type the following command:

sudo zypper remove [package-name]

Replace [package-name] with the name of the package that you want to remove. For example, to remove the Chromium web browser, type the following command:

sudo zypper remove chromium

Zypper removes the package and any dependencies that are no longer needed.

Updating Your System

To update your system using Zypper, type the following command:

sudo zypper update

Zypper checks for any available updates, downloads, and installs them if necessary. This command updates all packages on your system, not just a specific package. You will see a result that is identical in the following illustration:

This output shows that the Zypper update command updates four packages: PackageA, PackageB, PackageC, and PackageD. It also shows the download size and asks for confirmation before updating.

Viewing the Package Information
To view the information about a package using Zypper, type the following command:

zypper info [package-name]

Replace [package-name] with the package name that you want to view the information about. Zypper displays a detailed information about the package including its version, dependencies, and size.

Managing the Repositories with Zypper

Zypper allows you to add, remove, and manage the software repositories on your Linux system. Here are some Zypper commands that you can use to manage the repositories:

Adding a Repository
To add a repository using zypper, type the following command:

sudo zypper addrepo [repository-url] [repository-name]

Replace [repository-url] with the URL of the repository that you want to add and replace [repository-name] with a name for the repository.

For example, to add the Google Chrome repository, type the following:

sudo zypper addrepo https://dl.google.com/linux/chrome/rpm/stable/x86_64/ google-chrome

Zypper downloads and imports the repository’s GPG key and adds the repository to your system.

Removing a Repository
To remove a repository using zypper, type the following command:

sudo zypper removerepo [repository-name]

Replace [repository-name] with the name of the repository that you want to remove. For example, to remove the Google Chrome repository, type the following command:

sudo zypper removerepo google-chrome

Zypper removes the repository from your system.

Enabling or Disabling a Repository
To enable or disable a repository using zypper, type the following command:

sudo zypper modifyrepo --enable/--disable [repository-name]

Replace [repository-name] with the name of the repository that you want to enable or disable. For example, to disable the Google Chrome repository, type the following command:

sudo zypper modifyrepo --disable google-chrome

Zypper enables or disables the repository on your system.

Conclusion

Zypper is a powerful package management tool that can help you manage your Linux system’s software and repositories. With zypper, you can easily install, update, and remove the packages and add, remove, and manage the repositories. In addition, Zypper provides a range of advanced features including the dependency resolution, package locks, and rollback support.

Learning to use Zypper lets you streamline your package management tasks and keeps your system up-to-date and secure. We hope this tutorial has provided you with a good introduction to Zypper and its capabilities and that you’ll find it as a useful tool in your Linux administration toolkit.

About the author

Kennedy Brian

Brian is a computer scientist with a bias for software development, programming, and technical content development. He has been in the profession since 2015. He reads novels, jogs, or plays table tennis whenever not on gadgets. He is an expert in Python, SQL, Java, and data and network security.